2005-11-24 20:34:00 +05:00
|
|
|
<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
|
|
|
|
|
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<title>Basic Geometrical Objects</title>
|
|
|
|
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
|
|
|
|
<meta name="generator" content="RoboHelp by eHelp Corporation www.ehelp.com">
|
|
|
|
<link rel="stylesheet" href="default_ns.css"><script type="text/javascript" language="JavaScript" title="WebHelpSplitCss">
|
|
|
|
<!--
|
|
|
|
if (navigator.appName !="Netscape")
|
|
|
|
{ document.write("<link rel='stylesheet' href='default.css'>");}
|
|
|
|
//-->
|
|
|
|
</script>
|
|
|
|
<style type="text/css">
|
|
|
|
<!--
|
|
|
|
p.whs1 { font-family:'Lucida Console' , monospace; }
|
|
|
|
-->
|
|
|
|
</style><script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">
|
|
|
|
<!--
|
|
|
|
function reDo() {
|
|
|
|
if (innerWidth != origWidth || innerHeight != origHeight)
|
|
|
|
location.reload();
|
|
|
|
}
|
|
|
|
if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {
|
|
|
|
origWidth = innerWidth;
|
|
|
|
origHeight = innerHeight;
|
|
|
|
onresize = reDo;
|
|
|
|
}
|
|
|
|
onerror = null;
|
|
|
|
//-->
|
|
|
|
</script>
|
|
|
|
<style type="text/css">
|
|
|
|
<!--
|
|
|
|
div.WebHelpPopupMenu { position:absolute; left:0px; top:0px; z-index:4; visibility:hidden; }
|
|
|
|
-->
|
|
|
|
</style><script type="text/javascript" language="javascript1.2" src="whmsg.js"></script>
|
|
|
|
<script type="text/javascript" language="javascript" src="whver.js"></script>
|
|
|
|
<script type="text/javascript" language="javascript1.2" src="whproxy.js"></script>
|
|
|
|
<script type="text/javascript" language="javascript1.2" src="whutils.js"></script>
|
|
|
|
<script type="text/javascript" language="javascript1.2" src="whtopic.js"></script>
|
|
|
|
</head>
|
|
|
|
<body><script type="text/javascript" language="javascript1.2">
|
|
|
|
<!--
|
|
|
|
if (window.gbWhTopic)
|
|
|
|
{
|
|
|
|
if (window.addTocInfo)
|
|
|
|
{
|
|
|
|
addTocInfo("GEOM module\nTUI Scripts\nCreation of Geometric Objects\nBasic Geometrical Objects");
|
|
|
|
addButton("show",BTN_TEXT,"Show","","","","",0,0,"","","");
|
|
|
|
|
|
|
|
}
|
|
|
|
if (window.writeBtnStyle)
|
|
|
|
writeBtnStyle();
|
|
|
|
|
|
|
|
if (window.writeIntopicBar)
|
|
|
|
writeIntopicBar(1);
|
|
|
|
|
|
|
|
if (window.setRelStartPage)
|
|
|
|
{
|
|
|
|
setRelStartPage("geom.htm");
|
|
|
|
|
|
|
|
autoSync(1);
|
|
|
|
sendSyncInfo();
|
|
|
|
sendAveInfoOut();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (window.gbIE4)
|
|
|
|
document.location.reload();
|
|
|
|
//-->
|
|
|
|
</script>
|
|
|
|
<h1>Basic Geometrical Objects</h1>
|
|
|
|
|
|
|
|
<h3><a name=bookmark>Creation of a Point</a></h3>
|
|
|
|
|
|
|
|
<p class="whs1">import geompy</p>
|
|
|
|
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
<p># create vertices</p>
|
|
|
|
|
|
|
|
<p class="whs1">p0 = geompy.MakeVertex(0.,
|
|
|
|
0., 0.)</p>
|
|
|
|
|
|
|
|
<p class="whs1">p100 = geompy.MakeVertexWithRef(p0,
|
|
|
|
100., 100., 100.)</p>
|
|
|
|
|
|
|
|
<p class="whs1">px = geompy.MakeVertex(100.,
|
|
|
|
0., 0.)</p>
|
|
|
|
|
|
|
|
<p class="whs1">py = geompy.MakeVertex(0.,
|
|
|
|
100., 0.)</p>
|
|
|
|
|
|
|
|
<p class="whs1">pz = geompy.MakeVertex(0.,
|
|
|
|
0., 100.)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
<p># create a curve and a vertex on it</p>
|
|
|
|
|
|
|
|
<p class="whs1">Arc = geompy.MakeArc(py,
|
|
|
|
pz, px)</p>
|
|
|
|
|
|
|
|
<p class="whs1">p_on_arc = geompy.MakeVertexOnCurve(Arc,
|
|
|
|
0.25)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
<p># add objects in the study</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_p0 =
|
|
|
|
geompy.addToStudy(p0, "Vertex
|
|
|
|
0")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_p100 =
|
|
|
|
geompy.addToStudy(p100, "Vertex 100")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_px =
|
|
|
|
geompy.addToStudy(px, "Vertex
|
|
|
|
X")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_py =
|
|
|
|
geompy.addToStudy(py, "Vertex
|
|
|
|
Y")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_pz =
|
|
|
|
geompy.addToStudy(pz, "Vertex
|
|
|
|
Z")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_Arc =
|
|
|
|
geompy.addToStudy(Arc, "Arc")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_p_on_arc = geompy.addToStudy(p_on_arc,
|
|
|
|
"Vertex on Arc")</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
<p># display vertices</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_p0)</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_p100)</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_Arc)</p>
|
|
|
|
|
|
|
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.createAndDisplayGO(id_p_on_arc)</span>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
<h3><a name=bookmark1>Creation of a Line</a></h3>
|
|
|
|
|
|
|
|
<p class="whs1">import geompy</p>
|
|
|
|
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
<p># create vertices</p>
|
|
|
|
|
|
|
|
<p class="whs1">p0 = geompy.MakeVertex(0.,
|
|
|
|
0., 0.)</p>
|
|
|
|
|
|
|
|
<p class="whs1">p100 = geompy.MakeVertexWithRef(p0,
|
|
|
|
100., 100., 100.)</p>
|
|
|
|
|
|
|
|
<p class="whs1">px = geompy.MakeVertex(100.,
|
|
|
|
0. , 0.
|
|
|
|
)</p>
|
|
|
|
|
|
|
|
<p class="whs1">py = geompy.MakeVertex(0.
|
|
|
|
, 100.,
|
|
|
|
0. )</p>
|
|
|
|
|
|
|
|
<p class="whs1">pz = geompy.MakeVertex(0.
|
|
|
|
, 0. ,
|
|
|
|
100.)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># create a vector from two points</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">vxy =
|
|
|
|
geompy.MakeVector(px, py)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># create a line from a point and a vector</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">line1 = geompy.MakeLine(pz,
|
|
|
|
vxy)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p>#create a line from two points</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">line2 = geompy.MakeLineTwoPnt(p0,
|
|
|
|
p100)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
<p># add objects in the study</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_vxy =
|
|
|
|
geompy.addToStudy(vxy, "Vector")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_line1 =
|
|
|
|
geompy.addToStudy(line1,"Line1")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_line2 =
|
|
|
|
geompy.addToStudy(line2,"Line2")</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
<p># display lines</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_vxy)</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_line1)</p>
|
|
|
|
|
|
|
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.createAndDisplayGO(id_line2)</span>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
<h3><a name=bookmark2>Creation of a
|
|
|
|
Circle</a></h3>
|
|
|
|
|
|
|
|
<p class="whs1">import geompy</p>
|
|
|
|
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
<p># create vertices</p>
|
|
|
|
|
|
|
|
<p class="whs1">p0 = geompy.MakeVertex(0.,
|
|
|
|
0., 0.)</p>
|
|
|
|
|
|
|
|
<p class="whs1">px = geompy.MakeVertex(100.,
|
|
|
|
0. , 0.
|
|
|
|
)</p>
|
|
|
|
|
|
|
|
<p class="whs1">py = geompy.MakeVertex(0.
|
|
|
|
, 100.,
|
|
|
|
0. )</p>
|
|
|
|
|
|
|
|
<p class="whs1">pz = geompy.MakeVertex(0.
|
|
|
|
, 0. ,
|
|
|
|
100.)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># create a vector on two points</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">vxy =
|
|
|
|
geompy.MakeVector(px, py)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># create a circle from a point, a vector and a radius</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">circle1 = geompy.MakeCircle(pz,
|
|
|
|
vxy, 30)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p>#create a circle from three points</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">circle2 = geompy.MakeCircleThreePnt(p0,
|
|
|
|
px, py)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># add objects in the study</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">id_vxy =
|
|
|
|
geompy.addToStudy(vxy, "Vector")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_circle1 =
|
|
|
|
geompy.addToStudy(circle1,"Circle1")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_circle2 =
|
|
|
|
geompy.addToStudy(circle2,"Circle2")</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
<p># display circles</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_vxy)</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_circle1)</p>
|
|
|
|
|
|
|
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.createAndDisplayGO(id_circle2)</span>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
<h3><a name=bookmark3>Creation of an Ellipse</a></h3>
|
|
|
|
|
|
|
|
<p class="whs1">import geompy</p>
|
|
|
|
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
<p># create vertices</p>
|
|
|
|
|
|
|
|
<p class="whs1">p0 = geompy.MakeVertex(0.,
|
|
|
|
0., 0.)</p>
|
|
|
|
|
|
|
|
<p class="whs1">p50 = geompy.MakeVertex(50.,
|
|
|
|
50., 50.)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># create a vector from two points</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">vector =
|
|
|
|
geompy.MakeVector(p0, p50)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># create an ellipse from a point, a vector and radiuses</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">ellipse = geompy.MakeEllipse(p50,
|
|
|
|
vector, 50, 25)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># add objects in the study</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">id_vector =
|
|
|
|
geompy.addToStudy(vector, "Vector")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_ellipse = geompy.addToStudy(ellipse,"Ellipse")</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># display the ellipse and its normal vector</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_vector)</p>
|
|
|
|
|
|
|
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.createAndDisplayGO(id_ellipse)</span>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
<h3><a name=bookmark4>Creation of a Curve</a></h3>
|
|
|
|
|
|
|
|
<p class="whs1">import geompy</p>
|
|
|
|
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
<p># create vertices</p>
|
|
|
|
|
|
|
|
<p class="whs1">p0 = geompy.MakeVertex(0.
|
|
|
|
, 0. ,
|
|
|
|
0. )</p>
|
|
|
|
|
|
|
|
<p class="whs1">p1 = geompy.MakeVertex(50.
|
|
|
|
, 100., 200.)</p>
|
|
|
|
|
|
|
|
<p class="whs1">p2 = geompy.MakeVertex(150.,
|
|
|
|
50., 100.)</p>
|
|
|
|
|
|
|
|
<p class="whs1">p3 = geompy.MakeVertex(100.,
|
|
|
|
150., 170.)</p>
|
|
|
|
|
|
|
|
<p class="whs1">p4 = geompy.MakeVertex(200.,
|
|
|
|
200., 150.)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># create a polyline from a list of points</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">polyline = geompy.MakePolyline([p0,
|
|
|
|
p1, p2, p3, p4])</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># create a bezier curve from a list of points</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">bezier = geompy.MakeBezier([p0,
|
|
|
|
p1, p2, p3, p4])</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p>#create a b-spline curve from a list of points</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">interpol = geompy.MakeInterpol([p0,
|
|
|
|
p1, p2, p3, p4])</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># add objects in the study</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">id_p0 =
|
|
|
|
geompy.addToStudy(p0, "Point1")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_p1 =
|
|
|
|
geompy.addToStudy(p1, "Point2")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_p2 =
|
|
|
|
geompy.addToStudy(p2, "Point3")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_p3 =
|
|
|
|
geompy.addToStudy(p3, "Point4")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_p4 =
|
|
|
|
geompy.addToStudy(p4, "Point5")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_polyline = geompy.addToStudy(polyline,
|
|
|
|
"Polyline")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_bezier =
|
|
|
|
geompy.addToStudy(bezier, "Bezier")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_interpol = geompy.addToStudy(interpol,
|
|
|
|
"Interpol")</p>
|
|
|
|
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># display the points and the curves</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_p0)</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_p1)</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_p2)</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_p3)</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_p4)</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_polyline)</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_bezier)</p>
|
|
|
|
|
|
|
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.createAndDisplayGO(id_interpol)</span>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
<h3><a name=bookmark5>Creation of a Vector</a></h3>
|
|
|
|
|
|
|
|
<p class="whs1">import geompy</p>
|
|
|
|
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
<p># create vertices</p>
|
|
|
|
|
|
|
|
<p class="whs1">p1 = geompy.MakeVertex(10.,
|
|
|
|
50., 20.)</p>
|
|
|
|
|
|
|
|
<p class="whs1">p2 = geompy.MakeVertex(70.,
|
|
|
|
70., 70.)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># create a vector from two points</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">vector1 = geompy.MakeVector(p1,
|
|
|
|
p2)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># create a vector from the given components</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">vector2 = geompy.MakeVectorDXDYDZ(30,
|
|
|
|
30, 100)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># add objects in the study</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">id_p1 =
|
|
|
|
geompy.addToStudy(p1, "Point1")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_p2 =
|
|
|
|
geompy.addToStudy(p2, "Point2")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_vector1 = geompy.addToStudy(vector1,"Vector1")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_vector2 = geompy.addToStudy(vector2,"Vector2")</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># display the points and the vectors</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_p1)</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_p2)</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_vector1)</p>
|
|
|
|
|
|
|
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.createAndDisplayGO(id_vector2)</span>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
<h3><a name=bookmark6>Creation of a Plane</a></h3>
|
|
|
|
|
|
|
|
<p class="whs1">import geompy</p>
|
|
|
|
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
|
|
|
<p># create vertices</p>
|
|
|
|
|
|
|
|
<p class="whs1">p1 = geompy.MakeVertex(
|
|
|
|
0., 0.,
|
|
|
|
100.)</p>
|
|
|
|
|
|
|
|
<p class="whs1">p2 = geompy.MakeVertex(100.,
|
|
|
|
0.,
|
|
|
|
0.)</p>
|
|
|
|
|
|
|
|
<p class="whs1">p3 = geompy.MakeVertex(200.,
|
|
|
|
200., 200.)</p>
|
|
|
|
|
|
|
|
<p class="whs1">p4 = geompy.MakeVertex(100.,
|
|
|
|
100., 0.)</p>
|
|
|
|
|
|
|
|
<p class="whs1">p5 = geompy.MakeVertex(0.
|
|
|
|
, 100.,
|
|
|
|
0.)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># create a vector from the given components</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">vector = geompy.MakeVectorDXDYDZ(100.,
|
|
|
|
100., 100.)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># create a vector from two points</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">vector_arc = geompy.MakeVector(p2,
|
|
|
|
p5)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># create an arc from three points</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">arc = geompy.MakeArc(p2,
|
|
|
|
p4, p5)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># create a wire</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">wire = geompy.MakeWire([vector_arc,
|
|
|
|
arc])</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># create a face</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">isPlanarWanted = 1</p>
|
|
|
|
|
|
|
|
<p class="whs1">face = geompy.MakeFace(wire,
|
|
|
|
isPlanarWanted)</p>
|
|
|
|
|
|
|
|
<p class="whs1">trimsize = 1000.</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># create a plane from a point, a vector and a trimsize</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">plane1 = geompy.MakePlane(p1,
|
|
|
|
vector, trimsize)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># create a plane from three points and a trimsize</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">plane2 = geompy.MakePlaneThreePnt(p1,
|
|
|
|
p2, p3, trimsize)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># create a plane from the given face</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">plane3 = geompy.MakePlaneFace(face,
|
|
|
|
trimsize)</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># add objects in the study</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">id_face =
|
|
|
|
geompy.addToStudy(face, "Face")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_plane1 = geompy.addToStudy(plane1,"Plane1")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_plane2 = geompy.addToStudy(plane2,"Plane2")</p>
|
|
|
|
|
|
|
|
<p class="whs1">id_plane3 = geompy.addToStudy(plane3,"Plane3")</p>
|
|
|
|
|
|
|
|
<p> </p>
|
|
|
|
|
2006-02-07 20:58:35 +05:00
|
|
|
<p># display the points and the vectors</p>
|
2005-11-24 20:34:00 +05:00
|
|
|
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_face)</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_plane1)</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_plane2)</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_plane3)</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_plane1,1)</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.setTransparency(id_plane1,0.5)</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_plane2,1)</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.setTransparency(id_plane2,0.5)</p>
|
|
|
|
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_plane3,1)</p>
|
|
|
|
|
|
|
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.setTransparency(id_plane3,0.5)</span>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<script type="text/javascript" language="javascript1.2">
|
|
|
|
<!--
|
|
|
|
if (window.writeIntopicBar)
|
|
|
|
writeIntopicBar(0);
|
|
|
|
//-->
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|