mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-12 00:29:18 +05:00
490 lines
11 KiB
HTML
Executable File
490 lines
11 KiB
HTML
Executable File
<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
|
|
|
|
<html>
|
|
|
|
<head>
|
|
<title>Complex 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; }
|
|
p.WebHelpNavBar { text-align:right; }
|
|
-->
|
|
</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>
|
|
<script type="text/javascript" language="javascript1.2">
|
|
<!--
|
|
if (window.gbWhTopic)
|
|
{
|
|
if (window.setRelStartPage)
|
|
{
|
|
addTocInfo("Geometry module\nTUI Scripts\nCreating Geometric Objects\nComplex Objects");
|
|
addButton("show",BTN_IMG,"Show","","","","",0,0,"whd_show0.gif","whd_show2.gif","whd_show1.gif");
|
|
addButton("hide",BTN_IMG,"Hide","","","","",0,0,"whd_hide0.gif","whd_hide2.gif","whd_hide1.gif");
|
|
|
|
}
|
|
|
|
|
|
if (window.setRelStartPage)
|
|
{
|
|
setRelStartPage("index.htm");
|
|
|
|
autoSync(1);
|
|
sendSyncInfo();
|
|
sendAveInfoOut();
|
|
}
|
|
|
|
}
|
|
else
|
|
if (window.gbIE4)
|
|
document.location.reload();
|
|
//-->
|
|
</script>
|
|
</head>
|
|
<body><script type="text/javascript" language="javascript1.2">
|
|
<!--
|
|
if (window.writeIntopicBar)
|
|
writeIntopicBar(4);
|
|
//-->
|
|
</script>
|
|
<h1>Complex Objects</h1>
|
|
|
|
<h3><a name=bookmark>Creation of a Prism</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 a vertex and a vector</p>
|
|
|
|
<p class="whs1">p1 = geompy.MakeVertex(
|
|
0.,
|
|
0.,
|
|
0.)</p>
|
|
|
|
<p class="whs1">p2 = geompy.MakeVertex(
|
|
100., 0.,
|
|
0.)</p>
|
|
|
|
<p class="whs1">p3 = geompy.MakeVertex(
|
|
100., 100., 0.)</p>
|
|
|
|
<p class="whs1">p4 = geompy.MakeVertex(
|
|
0.,
|
|
100., 0.)</p>
|
|
|
|
<p class="whs1">p5 = geompy.MakeVertex(
|
|
0.,
|
|
0.,
|
|
60.)</p>
|
|
|
|
<p class="whs1">p6 = geompy.MakeVertex(-100.,
|
|
0.,
|
|
0.)</p>
|
|
|
|
<p class="whs1">p7 = geompy.MakeVertex(-100.,-100.,
|
|
0.)</p>
|
|
|
|
<p class="whs1">p8 = geompy.MakeVertex(
|
|
0.,-100.,
|
|
0.)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a vector from the given components</p>
|
|
|
|
<p class="whs1">vector = geompy.MakeVectorDXDYDZ(50.,
|
|
50., 50.)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p>#create vectors from two points</p>
|
|
|
|
<p class="whs1">vector1_arc1 = geompy.MakeVector(p1,
|
|
p2)</p>
|
|
|
|
<p class="whs1">vector2_arc1 = geompy.MakeVector(p1,
|
|
p4)</p>
|
|
|
|
<p class="whs1">vector1_arc2 = geompy.MakeVector(p1,
|
|
p6)</p>
|
|
|
|
<p class="whs1">vector2_arc2 = geompy.MakeVector(p1,
|
|
p8)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create arcs from three points</p>
|
|
|
|
<p class="whs1">arc1 = geompy.MakeArc(p2,
|
|
p3, p4)</p>
|
|
|
|
<p class="whs1">arc2 = geompy.MakeArc(p6,
|
|
p7, p8)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create wires</p>
|
|
|
|
<p class="whs1">wire1 = geompy.MakeWire([vector1_arc1,
|
|
arc1, vector2_arc1])</p>
|
|
|
|
<p class="whs1">wire2 = geompy.MakeWire([vector1_arc2,
|
|
arc2, vector2_arc2])</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create faces</p>
|
|
|
|
<p class="whs1">isPlanarWanted = 1</p>
|
|
|
|
<p class="whs1">face1 = geompy.MakeFace(wire1,
|
|
isPlanarWanted)</p>
|
|
|
|
<p class="whs1">face2 = geompy.MakeFace(wire2,
|
|
isPlanarWanted)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create prisms</p>
|
|
|
|
<p class="whs1">prism1 = geompy.MakePrism(face2,
|
|
p1, p5)</p>
|
|
|
|
<p class="whs1">prism2 = geompy.MakePrismVecH(face1,
|
|
vector, 50)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># add objects in the study</p>
|
|
|
|
<p class="whs1">id_face1 =
|
|
geompy.addToStudy(face1,"Face1")</p>
|
|
|
|
<p class="whs1">id_face2 =
|
|
geompy.addToStudy(face2,"Face2")</p>
|
|
|
|
<p class="whs1">id_prism1 = geompy.addToStudy(prism1,"Prism1")</p>
|
|
|
|
<p class="whs1">id_prism2 = geompy.addToStudy(prism2,"Prism2")</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># display cylinders</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_face1)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_face1,1)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_face2)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_face2,1)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_prism1)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_prism1,1)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_prism2)</p>
|
|
|
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_prism2,1)</span>
|
|
</p>
|
|
|
|
<h3><a name=bookmark1>Creation of a Revolution</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 a vertex and a vector</p>
|
|
|
|
<p class="whs1">p1 = geompy.MakeVertex(
|
|
10., 10.,
|
|
10.)</p>
|
|
|
|
<p class="whs1">p2 = geompy.MakeVertex(
|
|
15., 15.,
|
|
50.)</p>
|
|
|
|
<p class="whs1">p3 = geompy.MakeVertex(
|
|
40., 40.,
|
|
0.)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p>#create vectors from two points</p>
|
|
|
|
<p class="whs1">vector1 = geompy.MakeVector(p1,
|
|
p2)</p>
|
|
|
|
<p class="whs1">vector2 = geompy.MakeVector(p1,
|
|
p3)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a vector from the given components</p>
|
|
|
|
<p class="whs1">vector3 = geompy.MakeVectorDXDYDZ(-20.,
|
|
-20., 100.)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a wire</p>
|
|
|
|
<p class="whs1">wire = geompy.MakeWire([vector1,
|
|
vector2])</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a revolution</p>
|
|
|
|
<p class="whs1">revolution = geompy.MakeRevolution(wire,
|
|
vector3, 2.3)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># add objects in the study</p>
|
|
|
|
<p class="whs1">id_vector3 =
|
|
geompy.addToStudy(vector3,"Axis")</p>
|
|
|
|
<p class="whs1">id_wire =
|
|
geompy.addToStudy(wire,"Wire")</p>
|
|
|
|
<p class="whs1">id_revolution = geompy.addToStudy(revolution,"Revolution")</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># display the vector, the wire and the revolution</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_vector3)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_wire)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_revolution)</p>
|
|
|
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_revolution,1)</span>
|
|
</p>
|
|
|
|
<h3><a name=bookmark2>Creation of a Filling</a></h3>
|
|
|
|
<p class="whs1">import geompy</p>
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
<p class="whs1">mindeg = 2</p>
|
|
|
|
<p class="whs1">maxdeg = 5</p>
|
|
|
|
<p class="whs1">tol3d =
|
|
0.0001</p>
|
|
|
|
<p class="whs1">tol2d =
|
|
0.0001</p>
|
|
|
|
<p class="whs1">nbiter = 5</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a vertex and a vector</p>
|
|
|
|
<p class="whs1">p1 = geompy.MakeVertex(
|
|
-30., -30.,
|
|
50.)</p>
|
|
|
|
<p class="whs1">p2 = geompy.MakeVertex(
|
|
-60., -60.,
|
|
30.)</p>
|
|
|
|
<p class="whs1">p3 = geompy.MakeVertex(
|
|
-30., -30.,
|
|
10.)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create an arc from three points</p>
|
|
|
|
<p class="whs1">arc = geompy.MakeArc(p1,
|
|
p2, p3)</p>
|
|
|
|
<p class="whs1">ShapeListCompound
|
|
= []</p>
|
|
|
|
<p class="whs1">i = 0</p>
|
|
|
|
<p class="whs1">while i <= 3 :</p>
|
|
|
|
<p class="whs1"> S
|
|
= geompy.MakeTranslation(arc, i * 50., 0., 0.)</p>
|
|
|
|
<p class="whs1"> ShapeListCompound.append(S)</p>
|
|
|
|
<p class="whs1"> i
|
|
= i + 1</p>
|
|
|
|
<p class="whs1">compound = geompy.MakeCompound(ShapeListCompound)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a filling</p>
|
|
|
|
<p class="whs1">filling = geompy.MakeFilling(compound,
|
|
mindeg, maxdeg, tol3d, tol2d, nbiter)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># add objects in the study</p>
|
|
|
|
<p class="whs1">id_compound = geompy.addToStudy(compound,"Compound")</p>
|
|
|
|
<p class="whs1">id_filling = geompy.addToStudy(filling,"Filling")</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># display the compound and the filling</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_compound)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_filling)</p>
|
|
|
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_filling,1)</span>
|
|
</p>
|
|
|
|
<p> </p>
|
|
|
|
<h3><a name=bookmark3>Creation of a Pipe</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 class="whs1">pxyz = geompy.MakeVertex(100.,
|
|
100., 100.)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a vector from two points</p>
|
|
|
|
<p class="whs1">vxy = geompy.MakeVector(px,
|
|
py)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create an arc from three points</p>
|
|
|
|
<p class="whs1">arc = geompy.MakeArc(py,
|
|
pz, px)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a wire</p>
|
|
|
|
<p class="whs1">wire = geompy.MakeWire([vxy,
|
|
arc])</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create an edge</p>
|
|
|
|
<p class="whs1">edge = geompy.MakeEdge(p0,
|
|
pxyz)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create a pipe</p>
|
|
|
|
<p class="whs1">pipe = geompy.MakePipe(wire,
|
|
edge)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># add objects in the study</p>
|
|
|
|
<p class="whs1">id_wire = geompy.addToStudy(wire,"Wire")</p>
|
|
|
|
<p class="whs1">id_edge = geompy.addToStudy(edge,"Edge")</p>
|
|
|
|
<p class="whs1">id_pipe = geompy.addToStudy(pipe,"Pipe")</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># display the wire, the edge (path) and the pipe</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_wire)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_edge)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_pipe)</p>
|
|
|
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_pipe,1)</span>
|
|
</p>
|
|
|
|
<script type="text/javascript" language="javascript1.2">
|
|
<!--
|
|
if (window.writeIntopicBar)
|
|
writeIntopicBar(0);
|
|
//-->
|
|
</script>
|
|
</body>
|
|
</html>
|