mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-16 10:38:34 +05:00
571 lines
14 KiB
HTML
Executable File
571 lines
14 KiB
HTML
Executable File
<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
|
|
|
|
<html>
|
|
|
|
<head>
|
|
<title>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; }
|
|
p.whs2 { font-family:'Times New Roman' , serif; }
|
|
-->
|
|
</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\nAdvanced Geometrical 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>Advanced Geometrical Objects</h1>
|
|
|
|
<h3><a name=bookmark>Creation of an Edge</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">pxyz = geompy.MakeVertex(100.,
|
|
100., 100.)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># create an edge</p>
|
|
|
|
<p class="whs1">edge = geompy.MakeEdge(p0,
|
|
pxyz)</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># add object in the study</p>
|
|
|
|
<p class="whs1">id_edge = geompy.addToStudy(edge,"Edge")</p>
|
|
|
|
<p> </p>
|
|
|
|
<p># display an edge</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_edge)
|
|
</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<h3><a name=Creation>Creation of a Wire</a></h3>
|
|
|
|
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">import
|
|
geompy</span></p>
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
<p class="whs2"># create vertices</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="whs2"> </p>
|
|
|
|
<p class="whs2"># create a vector from
|
|
two points</p>
|
|
|
|
<p class="whs1">vxy = geompy.MakeVector(px,
|
|
py)</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># create an arc from
|
|
three points</p>
|
|
|
|
<p class="whs1">arc = geompy.MakeArc(py,
|
|
pz, px)</p>
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
<p class="whs2"># create a wire</p>
|
|
|
|
<p class="whs1">wire = geompy.MakeWire([vxy,
|
|
arc])</p>
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
<p class="whs2"># add an object in the
|
|
study</p>
|
|
|
|
<p class="whs1">id_wire = geompy.addToStudy(wire,"Wire")</p>
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
<p class="whs2"># display the wire</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_wire)
|
|
</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<h3><a name=bookmark1>Creation of a Face</a></h3>
|
|
|
|
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">import
|
|
geompy</span></p>
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># 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 class="whs1"> </p>
|
|
|
|
<p class="whs2"># create a vector from
|
|
two points</p>
|
|
|
|
<p class="whs1">vxy = geompy.MakeVector(px,
|
|
py)</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># create an arc from
|
|
three points</p>
|
|
|
|
<p class="whs1">arc = geompy.MakeArc(py,
|
|
pz, px)</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># create a wire</p>
|
|
|
|
<p class="whs1">wire = geompy.MakeWire([vxy,
|
|
arc])</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># create sketchers</p>
|
|
|
|
<p class="whs1">sketcher1 = geompy.MakeSketcher("Sketcher:F
|
|
-100 -100:TT 250 -100:R 0:C 100 150:R 0:L 300:WW",</p>
|
|
|
|
<p class="whs1"> [100,0,0,
|
|
1,1,1, -1,1,0])</p>
|
|
|
|
<p class="whs1">sketcher2 = geompy.MakeSketcher("Sketcher:F
|
|
0 0:TT 70 0:TT 70 70:TT 0 70:WW")</p>
|
|
|
|
<p class="whs1">sketcher3 = geompy.MakeSketcher("Sketcher:F
|
|
20 20:TT 50 20:TT 50 50:TT 20 50:WW")</p>
|
|
|
|
<p class="whs1">isPlanarFace = 1</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># create a face from
|
|
the wire</p>
|
|
|
|
<p class="whs1">face1 = geompy.MakeFace(wire,
|
|
isPlanarFace)</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># create faces from two
|
|
wires</p>
|
|
|
|
<p class="whs1">face2 = geompy.MakeFaceWires([wire,
|
|
sketcher1],isPlanarFace)</p>
|
|
|
|
<p class="whs1">face3 = geompy.MakeFaces([sketcher2,
|
|
sketcher3],isPlanarFace)</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># 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_face3 = geompy.addToStudy(face3,"Face3")</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># display the faces</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_face1)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_face1,1)</p>
|
|
|
|
<p class="whs1">gg.setTransparency(id_face1,0.2)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_face2)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_face2,1)</p>
|
|
|
|
<p class="whs1">gg.setTransparency(id_face2,0.2)</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_face3)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_face3,1)</p>
|
|
|
|
<p class="whs1">gg.setTransparency(id_face3,0.2)
|
|
</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<h3><a name=bookmark2>Creation of a Shell</a></h3>
|
|
|
|
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">import
|
|
geompy</span></p>
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2">#create vertices</p>
|
|
|
|
<p class="whs1">p0 =
|
|
geompy.MakeVertex( 0., 0.,
|
|
0.)</p>
|
|
|
|
<p class="whs1">pxyz = geompy.MakeVertex(
|
|
5., 5.,
|
|
40.)</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># create sketchers</p>
|
|
|
|
<p class="whs1">sketcher1 = geompy.MakeSketcher("Sketcher:F
|
|
0 0:TT 70 0:TT 70 70:TT 0 70:WW")</p>
|
|
|
|
<p class="whs1">sketcher2 = geompy.MakeSketcher("Sketcher:F
|
|
20 20:TT 50 20:TT 50 50:TT 20 50:WW")</p>
|
|
|
|
<p class="whs1">isPlanarFace = 1</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># create a face from
|
|
two wires</p>
|
|
|
|
<p class="whs1">face = geompy.MakeFaces([sketcher1,
|
|
sketcher2],isPlanarFace)</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># create a prism</p>
|
|
|
|
<p class="whs1">prism = geompy.MakePrism(face,
|
|
p0, pxyz)</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># explode the prism into
|
|
faces</p>
|
|
|
|
<p class="whs1">prism_faces = geompy.SubShapeAllSorted(prism,
|
|
geompy.ShapeType["FACE"])</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># create a shell from
|
|
a set of faces</p>
|
|
|
|
<p class="whs1">shell = geompy.MakeShell([prism_faces[0],
|
|
prism_faces[2], prism_faces[3],</p>
|
|
|
|
<p class="whs1"> prism_faces[7],
|
|
prism_faces[9]])</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># add objects in the
|
|
study</p>
|
|
|
|
<p class="whs1">id_shell = geompy.addToStudy(shell,"Shell")</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># display the shell</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_shell)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_shell,1)
|
|
</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<h3><a name=bookmark3>Creation of a Solid</a></h3>
|
|
|
|
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">import
|
|
geompy</span></p>
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2">#create vertices</p>
|
|
|
|
<p class="whs1">p0 = geompy.MakeVertex(
|
|
0., 0.,
|
|
0.)</p>
|
|
|
|
<p class="whs1">pz = geompy.MakeVertex(
|
|
0., 0.,
|
|
40.)</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># create sketchers</p>
|
|
|
|
<p class="whs1">sketcher = geompy.MakeSketcher("Sketcher:F
|
|
-50 -50:TT 100 -50:R 0:C 50 70:R 0:L 100:WW")</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># create faces from two
|
|
wires</p>
|
|
|
|
<p class="whs1">face = geompy.MakeFace(sketcher,1)</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># create a prism</p>
|
|
|
|
<p class="whs1">prism = geompy.MakePrism(face,
|
|
p0, pz)</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># explode the prism into
|
|
faces</p>
|
|
|
|
<p class="whs1">prism_faces = geompy.SubShapeAllSorted(prism,
|
|
geompy.ShapeType["FACE"])</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># create a shell from
|
|
a set of faces</p>
|
|
|
|
<p class="whs1">shell = geompy.MakeShell([prism_faces[0],
|
|
prism_faces[1],</p>
|
|
|
|
<p class="whs1"> prism_faces[3],
|
|
prism_faces[4],</p>
|
|
|
|
<p class="whs1"> prism_faces[5],
|
|
prism_faces[2]])</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># create a solid, bounded
|
|
by the given shells</p>
|
|
|
|
<p class="whs1">solid = geompy.MakeSolid([shell])</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># add objects in the
|
|
study</p>
|
|
|
|
<p class="whs1">id_solid = geompy.addToStudy(solid,"Solid")</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># display the solid</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_solid)</p>
|
|
|
|
<p class="whs1">gg.setDisplayMode(id_solid,1)
|
|
</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<h3><a name=bookmark4>Creation of a Compound</a></h3>
|
|
|
|
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">import
|
|
geompy</span></p>
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># 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 class="whs1"> </p>
|
|
|
|
<p class="whs2"># 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"> </p>
|
|
|
|
<p class="whs2"># create a compund of
|
|
the given shapes</p>
|
|
|
|
<p class="whs1">compound = geompy.MakeCompound(ShapeListCompound)</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># add object in the study</p>
|
|
|
|
<p class="whs1">id_compound = geompy.addToStudy(compound,"Compound")</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># display the compound</p>
|
|
|
|
<p class="whs1">gg.createAndDisplayGO(id_compound)
|
|
</p>
|
|
|
|
<script type="text/javascript" language="javascript1.2">
|
|
<!--
|
|
if (window.writeIntopicBar)
|
|
writeIntopicBar(0);
|
|
//-->
|
|
</script>
|
|
</body>
|
|
</html>
|