mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-15 10:08:35 +05:00
PAL12557: Documentation for scripts is not up to date.
This commit is contained in:
parent
50d053afee
commit
c6a0df686b
@ -15,6 +15,7 @@ if (navigator.appName !="Netscape")
|
|||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
<!--
|
<!--
|
||||||
p.whs1 { font-family:'Lucida Console' , monospace; }
|
p.whs1 { font-family:'Lucida Console' , monospace; }
|
||||||
|
p.whs2 { font-family:'Times New Roman' , serif; }
|
||||||
-->
|
-->
|
||||||
</style><script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">
|
</style><script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">
|
||||||
<!--
|
<!--
|
||||||
@ -79,15 +80,18 @@ if (window.writeIntopicBar)
|
|||||||
|
|
||||||
<h3><a name=bookmark4>Multi Transformation</a></h3>
|
<h3><a name=bookmark4>Multi Transformation</a></h3>
|
||||||
|
|
||||||
<p class="whs1">import geompy</p>
|
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">import
|
||||||
|
geompy</span></p>
|
||||||
|
|
||||||
<p class="whs1">import salome</p>
|
<p class="whs1">import salome</p>
|
||||||
|
|
||||||
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># create vertices</p>
|
<p class="whs2"># create vertices</p>
|
||||||
|
|
||||||
<p class="whs1">p_25_25_50 = geompy.MakeVertex(25.,
|
<p class="whs1">p_25_25_50 = geompy.MakeVertex(25.,
|
||||||
25., 50.)</p>
|
25., 50.)</p>
|
||||||
@ -98,9 +102,13 @@ if (window.writeIntopicBar)
|
|||||||
<p class="whs1">p_25_50_25 = geompy.MakeVertex(25.,
|
<p class="whs1">p_25_50_25 = geompy.MakeVertex(25.,
|
||||||
50., 25.)</p>
|
50., 25.)</p>
|
||||||
|
|
||||||
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p class="whs1">box = geompy.MakeBoxDXDYDZ(50,
|
<p class="whs1">box = geompy.MakeBoxDXDYDZ(50,
|
||||||
50, 50)</p>
|
50, 50)</p>
|
||||||
|
|
||||||
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p class="whs1">top_face = geompy.GetFaceNearPoint(box,
|
<p class="whs1">top_face = geompy.GetFaceNearPoint(box,
|
||||||
p_25_25_50)</p>
|
p_25_25_50)</p>
|
||||||
|
|
||||||
@ -110,18 +118,21 @@ if (window.writeIntopicBar)
|
|||||||
<p class="whs1">xz_face = geompy.GetFaceNearPoint(box,
|
<p class="whs1">xz_face = geompy.GetFaceNearPoint(box,
|
||||||
p_25_50_25)</p>
|
p_25_50_25)</p>
|
||||||
|
|
||||||
<p class="whs1">top_face_ind = geompy.LocalOp.GetSubShapeIndex(box,
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
|
<p class="whs1">top_face_ind = geompy.GetSubShapeID(box,
|
||||||
top_face)</p>
|
top_face)</p>
|
||||||
|
|
||||||
<p class="whs1">yz_face_ind = geompy.LocalOp.GetSubShapeIndex(box,
|
<p class="whs1">yz_face_ind = geompy.GetSubShapeID(box,
|
||||||
yz_face)</p>
|
yz_face)</p>
|
||||||
|
|
||||||
<p class="whs1">xz_face_ind = geompy.LocalOp.GetSubShapeIndex(box,
|
<p class="whs1">xz_face_ind = geompy.GetSubShapeID(box,
|
||||||
xz_face)</p>
|
xz_face)</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># Multi-transformate block and glue the result</p>
|
<p class="whs2"># Multi-transformate
|
||||||
|
block and glue the result</p>
|
||||||
|
|
||||||
<p class="whs1">box_tr1 = geompy.MakeMultiTransformation1D(box,
|
<p class="whs1">box_tr1 = geompy.MakeMultiTransformation1D(box,
|
||||||
yz_face_ind, top_face_ind, 3)</p>
|
yz_face_ind, top_face_ind, 3)</p>
|
||||||
@ -129,9 +140,10 @@ if (window.writeIntopicBar)
|
|||||||
<p class="whs1">box_tr2 = geompy.MakeMultiTransformation2D(box,
|
<p class="whs1">box_tr2 = geompy.MakeMultiTransformation2D(box,
|
||||||
xz_face_ind, yz_face_ind, 3, top_face_ind, 0, 2)</p>
|
xz_face_ind, yz_face_ind, 3, top_face_ind, 0, 2)</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># add objects in the study</p>
|
<p class="whs2"># add objects in the
|
||||||
|
study</p>
|
||||||
|
|
||||||
<p class="whs1">id_box = geompy.addToStudy(box,
|
<p class="whs1">id_box = geompy.addToStudy(box,
|
||||||
"Box")</p>
|
"Box")</p>
|
||||||
@ -142,9 +154,9 @@ if (window.writeIntopicBar)
|
|||||||
<p class="whs1">id_box_tr2 = geompy.addToStudy(box_tr2,
|
<p class="whs1">id_box_tr2 = geompy.addToStudy(box_tr2,
|
||||||
"Multi-transformed Block 2D")</p>
|
"Multi-transformed Block 2D")</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># display the results</p>
|
<p class="whs2"># display the results</p>
|
||||||
|
|
||||||
<p class="whs1">gg.createAndDisplayGO(id_box)</p>
|
<p class="whs1">gg.createAndDisplayGO(id_box)</p>
|
||||||
|
|
||||||
@ -152,10 +164,10 @@ if (window.writeIntopicBar)
|
|||||||
|
|
||||||
<p class="whs1">gg.createAndDisplayGO(id_box_tr1)</p>
|
<p class="whs1">gg.createAndDisplayGO(id_box_tr1)</p>
|
||||||
|
|
||||||
<p><span style="font-family: 'Lucida Console', monospace;">gg.createAndDisplayGO(id_box_tr2)</span>
|
<p class="whs1">gg.createAndDisplayGO(id_box_tr2)
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<h3><a name=bookmark5>Explode on Blocks</a></h3>
|
<h3><a name=bookmark5>Explode on Blocks</a></h3>
|
||||||
|
|
||||||
@ -163,11 +175,14 @@ if (window.writeIntopicBar)
|
|||||||
|
|
||||||
<p class="whs1">import salome</p>
|
<p class="whs1">import salome</p>
|
||||||
|
|
||||||
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># create a box and a sphere</p>
|
<p class="whs2"># create a box and a
|
||||||
|
sphere</p>
|
||||||
|
|
||||||
<p class="whs1">box = geompy.MakeBoxDXDYDZ(200,
|
<p class="whs1">box = geompy.MakeBoxDXDYDZ(200,
|
||||||
200, 200)</p>
|
200, 200)</p>
|
||||||
@ -176,31 +191,38 @@ if (window.writeIntopicBar)
|
|||||||
|
|
||||||
<p class="whs1"> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># make a compound</p>
|
<p class="whs2"># make a compound</p>
|
||||||
|
|
||||||
<p class="whs1">compound = geompy.MakeCompound([box,
|
<p class="whs1">compound = geompy.MakeCompound([box,
|
||||||
sphere])</p>
|
sphere])</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs2"> </p>
|
||||||
|
|
||||||
<p># get all the blocks, contained in the given compound</p>
|
<p class="whs2"># get all the blocks
|
||||||
|
of the given compound, by criteria: min_nb_faces <= nb. of faces <=
|
||||||
|
max_nb_faces</p>
|
||||||
|
|
||||||
|
<p class="whs1">min_nb_faces = 6</p>
|
||||||
|
|
||||||
|
<p class="whs1">max_nb_faces = 6</p>
|
||||||
|
|
||||||
<p class="whs1">make_block_explode
|
<p class="whs1">make_block_explode
|
||||||
= geompy.MakeBlockExplode(compound, 1, 1)</p>
|
= geompy.MakeBlockExplode(compound, min_nb_faces, max_nb_faces)</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># add objects in the study</p>
|
<p class="whs2"># add objects in the
|
||||||
|
study</p>
|
||||||
|
|
||||||
<p class="whs1">id_compound = geompy.addToStudy(compound,
|
<p class="whs1">id_compound = geompy.addToStudy(compound,
|
||||||
"Compound")</p>
|
"Compound")</p>
|
||||||
|
|
||||||
<p class="whs1">id_make_block_explode
|
<p class="whs1">id_make_block_explode
|
||||||
= geompy.addToStudy(make_block_explode[0], "MakeBlockExplode")</p>
|
= geompy.addToStudyInFather(compound, make_block_explode[0], "MakeBlockExplode")</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># display the results</p>
|
<p class="whs2"># display the results</p>
|
||||||
|
|
||||||
<p class="whs1">gg.createAndDisplayGO(id_compound)</p>
|
<p class="whs1">gg.createAndDisplayGO(id_compound)</p>
|
||||||
|
|
||||||
@ -217,42 +239,45 @@ if (window.writeIntopicBar)
|
|||||||
|
|
||||||
<p class="whs1">import salome</p>
|
<p class="whs1">import salome</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># create a box and a sphere</p>
|
<p class="whs2"># create a box</p>
|
||||||
|
|
||||||
<p class="whs1">box = geompy.MakeBoxDXDYDZ(200,
|
<p class="whs1">box = geompy.MakeBoxDXDYDZ(200,
|
||||||
200, 200)</p>
|
200, 200)</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># check and improve</p>
|
<p class="whs2"># build all possible
|
||||||
|
propagation groups</p>
|
||||||
<p class="whs1">check_box = geompy.CheckAndImprove(box)</p>
|
|
||||||
|
|
||||||
<p> </p>
|
|
||||||
|
|
||||||
<p># build all possible propagation groups</p>
|
|
||||||
|
|
||||||
<p class="whs1">listChains = geompy.Propagate(check_box)</p>
|
<p class="whs1">listChains = geompy.Propagate(check_box)</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># add objects in the study</p>
|
<p class="whs2"># add objects in the
|
||||||
|
study</p>
|
||||||
|
|
||||||
<p class="whs1">geompy.addToStudy(check_box,
|
<p class="whs1">geompy.addToStudy(check_box,
|
||||||
"Box")</p>
|
"Box")</p>
|
||||||
|
|
||||||
|
<p class="whs1">ii = 1</p>
|
||||||
|
|
||||||
<p class="whs1">for chain in listChains:</p>
|
<p class="whs1">for chain in listChains:</p>
|
||||||
|
|
||||||
<p class="whs1"> geompy.addToStudyInFather(check_box,
|
<p class="whs1"> geompy.addToStudyInFather(check_box,
|
||||||
chain, "propagation chain")</p>
|
chain, "propagation chain " + `ii`)</p>
|
||||||
|
|
||||||
|
<p class="whs1"> ii
|
||||||
|
= ii + 1</p>
|
||||||
|
|
||||||
|
<p class="whs1"> pass</p>
|
||||||
|
|
||||||
|
<p> </p>
|
||||||
|
|
||||||
<p><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
|
<p><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p> </p>
|
|
||||||
|
|
||||||
<script type="text/javascript" language="javascript1.2">
|
<script type="text/javascript" language="javascript1.2">
|
||||||
<!--
|
<!--
|
||||||
if (window.writeIntopicBar)
|
if (window.writeIntopicBar)
|
||||||
|
@ -15,6 +15,7 @@ if (navigator.appName !="Netscape")
|
|||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
<!--
|
<!--
|
||||||
p.whs1 { font-family:'Lucida Console' , monospace; }
|
p.whs1 { font-family:'Lucida Console' , monospace; }
|
||||||
|
p.whs2 { font-family:'Times New Roman' , serif; }
|
||||||
-->
|
-->
|
||||||
</style><script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">
|
</style><script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">
|
||||||
<!--
|
<!--
|
||||||
@ -200,8 +201,6 @@ if (window.writeIntopicBar)
|
|||||||
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_qface3,1)</span>
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_qface3,1)</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p> </p>
|
|
||||||
|
|
||||||
<h3>Hexagonal Solid</h3>
|
<h3>Hexagonal Solid</h3>
|
||||||
|
|
||||||
<p class="whs1">import geompy</p>
|
<p class="whs1">import geompy</p>
|
||||||
@ -210,120 +209,141 @@ if (window.writeIntopicBar)
|
|||||||
|
|
||||||
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># create vertices</p>
|
<p class="whs2"># create vertices</p>
|
||||||
|
|
||||||
<p class="whs1">p1 = geompy.MakeVertex(
|
<p class="whs1">p0 =
|
||||||
0., 0.,
|
geompy.MakeVertex( 0.,
|
||||||
|
0.,
|
||||||
0.)</p>
|
0.)</p>
|
||||||
|
|
||||||
<p class="whs1">p2 = geompy.MakeVertex(150.,
|
<p class="whs1">p1 =
|
||||||
30., 0.)</p>
|
geompy.MakeVertex( 0.,
|
||||||
|
0.,
|
||||||
|
40.)</p>
|
||||||
|
|
||||||
<p class="whs1">p3 = geompy.MakeVertex(
|
<p class="whs1">p2 =
|
||||||
0., 120.,
|
geompy.MakeVertex( 70., -15., 0.)</p>
|
||||||
50.)</p>
|
|
||||||
|
|
||||||
<p class="whs1">p4 = geompy.MakeVertex(
|
<p class="whs1">p3 =
|
||||||
0., 40.,
|
geompy.MakeVertex( 70., -15., 70.)</p>
|
||||||
|
|
||||||
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
|
<p class="whs1">p4 =
|
||||||
|
geompy.MakeVertex( 0.,
|
||||||
|
70., 0.)</p>
|
||||||
|
|
||||||
|
<p class="whs1">p5 =
|
||||||
|
geompy.MakeVertex( 0.,
|
||||||
|
70., 40.)</p>
|
||||||
|
|
||||||
|
<p class="whs1">p6 =
|
||||||
|
geompy.MakeVertex( 70., 70.,
|
||||||
|
0.)</p>
|
||||||
|
|
||||||
|
<p class="whs1">p7 =
|
||||||
|
geompy.MakeVertex( 70., 70.,
|
||||||
70.)</p>
|
70.)</p>
|
||||||
|
|
||||||
<p class="whs1">p5 = geompy.MakeVertex(100.,
|
<p class="whs1"> </p>
|
||||||
20., 45.)</p>
|
|
||||||
|
|
||||||
<p class="whs1">p6 = geompy.MakeVertex(
|
<p class="whs1">p8 =
|
||||||
0., 70.,
|
geompy.MakeVertex( 0.,
|
||||||
40.)</p>
|
-50., 0.)</p>
|
||||||
|
|
||||||
<p class="whs1">p7 = geompy.MakeVertex(
|
<p class="whs1">p9 =
|
||||||
70., 70., 70.)</p>
|
geompy.MakeVertex( 0.,
|
||||||
|
-50., 40.)</p>
|
||||||
<p class="whs1">p8 = geompy.MakeVertex(
|
|
||||||
70.,-15., 70.)</p>
|
|
||||||
|
|
||||||
<p class="whs1">p9 = geompy.MakeVertex(
|
|
||||||
0., 0.,
|
|
||||||
40.)</p>
|
|
||||||
|
|
||||||
<p class="whs1">p10 = geompy.MakeVertex(
|
<p class="whs1">p10 = geompy.MakeVertex(
|
||||||
0., 70.,
|
70., -35., 0.)</p>
|
||||||
0.)</p>
|
|
||||||
|
|
||||||
<p class="whs1">p11 = geompy.MakeVertex(
|
<p class="whs1">p11 = geompy.MakeVertex(
|
||||||
70., 70., 0.)</p>
|
70., -35., 70.)</p>
|
||||||
|
|
||||||
<p class="whs1">p12 = geompy.MakeVertex(
|
<p class="whs1"> </p>
|
||||||
70., -15., 0.)</p>
|
|
||||||
|
|
||||||
<p class="whs1">p13 = geompy.MakeVertex(
|
<p class="whs2"># create faces</p>
|
||||||
0., 0.,
|
|
||||||
0.)</p>
|
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1">qface1 = geompy.MakeQuad4Vertices(p0,
|
||||||
|
p1, p2, p3)</p>
|
||||||
|
|
||||||
<p># create faces</p>
|
<p class="whs1">qface2 = geompy.MakeQuad4Vertices(p4,
|
||||||
|
p5, p6, p7)</p>
|
||||||
|
|
||||||
<p class="whs1">qface1 = geompy.MakeQuad4Vertices(p1,
|
<p class="whs1">qface3 = geompy.MakeQuad4Vertices(p0,
|
||||||
p2, p3, p4)</p>
|
p1, p4, p5)</p>
|
||||||
|
|
||||||
<p class="whs1">qface2 = geompy.MakeQuad4Vertices(p1,
|
<p class="whs1">qface4 = geompy.MakeQuad4Vertices(p2,
|
||||||
p2, p5, p4)</p>
|
p3, p6, p7)</p>
|
||||||
|
|
||||||
<p class="whs1">qface3 = geompy.MakeQuad4Vertices(p13,
|
<p class="whs1">qface5 = geompy.MakeQuad4Vertices(p0,
|
||||||
p12, p11, p10)</p>
|
p2, p4, p6)</p>
|
||||||
|
|
||||||
<p class="whs1">qface4 = geompy.MakeQuad4Vertices(p9,
|
<p class="whs1">qface6 = geompy.MakeQuad4Vertices(p1,
|
||||||
p8, p7, p6)</p>
|
p3, p5, p7)</p>
|
||||||
|
|
||||||
<p class="whs1">qface5 = geompy.MakeQuad4Vertices(p13,
|
<p class="whs1"> </p>
|
||||||
p9, p6, p10)</p>
|
|
||||||
|
|
||||||
<p class="whs1">qface6 = geompy.MakeQuad4Vertices(p13,
|
<p class="whs1">qface7 = geompy.MakeQuad4Vertices(p8,
|
||||||
p9, p8, p12)</p>
|
p9, p10, p11)</p>
|
||||||
|
|
||||||
<p class="whs1">qface7 = geompy.MakeQuad4Vertices(p12,
|
<p class="whs1"> </p>
|
||||||
p8, p7, p11)</p>
|
|
||||||
|
|
||||||
<p class="whs1">qface8 = geompy.MakeQuad4Vertices(p11,
|
<p class="whs2"># create a hexahedral
|
||||||
p7, p6, p10)</p>
|
solid between two given faces</p>
|
||||||
|
|
||||||
<p> </p>
|
|
||||||
|
|
||||||
<p># create a hexahedral solid between two given faces</p>
|
|
||||||
|
|
||||||
<p class="whs1">solid1 = geompy.MakeHexa2Faces(qface1,
|
<p class="whs1">solid1 = geompy.MakeHexa2Faces(qface1,
|
||||||
qface2)</p>
|
qface7)</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># create a hexahedral solids, bounded by six given faces</p>
|
<p class="whs2"># create a hexahedral
|
||||||
|
solid, bounded by six given faces</p>
|
||||||
|
|
||||||
<p class="whs1">solid2 = geompy.MakeHexa(qface3,
|
<p class="whs1">solid2 = geompy.MakeHexa(qface1,
|
||||||
qface4, qface5, qface6, qface7, qface8)</p>
|
qface2, qface3, qface4, qface5, qface6)</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># add objects in the study</p>
|
<p class="whs2"># add objects in the
|
||||||
|
study</p>
|
||||||
|
|
||||||
|
<p class="whs1">geompy.addToStudy(qface1,"qface1")</p>
|
||||||
|
|
||||||
|
<p class="whs1">geompy.addToStudy(qface2,"qface2")</p>
|
||||||
|
|
||||||
|
<p class="whs1">geompy.addToStudy(qface3,"qface3")</p>
|
||||||
|
|
||||||
|
<p class="whs1">geompy.addToStudy(qface4,"qface4")</p>
|
||||||
|
|
||||||
|
<p class="whs1">geompy.addToStudy(qface5,"qface5")</p>
|
||||||
|
|
||||||
|
<p class="whs1">geompy.addToStudy(qface6,"qface6")</p>
|
||||||
|
|
||||||
|
<p class="whs1">geompy.addToStudy(qface7,"qface7")</p>
|
||||||
|
|
||||||
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p class="whs1">id_solid1 = geompy.addToStudy(solid1,"Solid1")</p>
|
<p class="whs1">id_solid1 = geompy.addToStudy(solid1,"Solid1")</p>
|
||||||
|
|
||||||
<p class="whs1">id_solid2 = geompy.addToStudy(solid2,"Solid2")</p>
|
<p class="whs1">id_solid2 = geompy.addToStudy(solid2,"Solid2")</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># display solids</p>
|
<p class="whs2"># display solids</p>
|
||||||
|
|
||||||
<p class="whs1">gg.createAndDisplayGO(id_solid1)</p>
|
<p class="whs1">gg.createAndDisplayGO(id_solid1)</p>
|
||||||
|
|
||||||
<p class="whs1">gg.setDisplayMode(id_solid1,1)</p>
|
<p class="whs1">gg.setDisplayMode(id_solid1,
|
||||||
|
1)</p>
|
||||||
|
|
||||||
<p class="whs1">gg.createAndDisplayGO(id_solid2)</p>
|
<p class="whs1">gg.createAndDisplayGO(id_solid2)</p>
|
||||||
|
|
||||||
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_solid2,1)</span>
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_solid2,
|
||||||
</p>
|
1)</span> </p>
|
||||||
|
|
||||||
<p> </p>
|
|
||||||
|
|
||||||
<script type="text/javascript" language="javascript1.2">
|
<script type="text/javascript" language="javascript1.2">
|
||||||
<!--
|
<!--
|
||||||
|
@ -491,88 +491,73 @@ if (window.writeIntopicBar)
|
|||||||
|
|
||||||
<h3><a name=bookmark4>Creation of a Compound</a></h3>
|
<h3><a name=bookmark4>Creation of a Compound</a></h3>
|
||||||
|
|
||||||
<p class="whs1">import geompy</p>
|
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">import
|
||||||
|
geompy</span></p>
|
||||||
|
|
||||||
<p class="whs1">import salome</p>
|
<p class="whs1">import salome</p>
|
||||||
|
|
||||||
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
||||||
|
|
||||||
<p class="whs1"> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p class="whs2">#create vertices</p>
|
<p class="whs2"># create a vertex and
|
||||||
|
a vector</p>
|
||||||
|
|
||||||
<p class="whs1">p0 = geompy.MakeVertex(
|
<p class="whs1">p1 = geompy.MakeVertex(
|
||||||
0., 0.,
|
-30., -30.,
|
||||||
0.)</p>
|
50.)</p>
|
||||||
|
|
||||||
<p class="whs1">pz = geompy.MakeVertex(
|
<p class="whs1">p2 = geompy.MakeVertex(
|
||||||
0., 0.,
|
-60., -60.,
|
||||||
40.)</p>
|
30.)</p>
|
||||||
|
|
||||||
|
<p class="whs1">p3 = geompy.MakeVertex(
|
||||||
|
-30., -30.,
|
||||||
|
10.)</p>
|
||||||
|
|
||||||
<p class="whs1"> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p class="whs2"># create sketchers</p>
|
<p class="whs2"># create an arc from
|
||||||
|
three points</p>
|
||||||
|
|
||||||
<p class="whs1">sketcher = geompy.MakeSketcher("Sketcher:F
|
<p class="whs1">arc = geompy.MakeArc(p1,
|
||||||
-50 -50:TT 100 -50:R 0:C 50 70:R 0:L 100:WW")</p>
|
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="whs1"> </p>
|
||||||
|
|
||||||
<p class="whs2"># create faces from two
|
<p class="whs2"># create a compund of
|
||||||
wires</p>
|
the given shapes</p>
|
||||||
|
|
||||||
<p class="whs1">face = geompy.MakeFace(sketcher,1)</p>
|
<p class="whs1">compound = geompy.MakeCompound(ShapeListCompound)</p>
|
||||||
|
|
||||||
<p class="whs1"> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p class="whs2"># create a prism</p>
|
<p class="whs2"># add object in the study</p>
|
||||||
|
|
||||||
<p class="whs1">prism = geompy.MakePrism(face,
|
<p class="whs1">id_compound = geompy.addToStudy(compound,"Compound")</p>
|
||||||
p0, pz)</p>
|
|
||||||
|
|
||||||
<p class="whs1"> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p class="whs2"># explode the prism into
|
<p class="whs2"># display the compound</p>
|
||||||
faces</p>
|
|
||||||
|
|
||||||
<p class="whs1">prism_faces = geompy.SubShapeAllSorted(prism,
|
<p class="whs1">gg.createAndDisplayGO(id_compound)
|
||||||
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>
|
||||||
|
|
||||||
<script type="text/javascript" language="javascript1.2">
|
<script type="text/javascript" language="javascript1.2">
|
||||||
|
@ -80,32 +80,52 @@ if (window.writeIntopicBar)
|
|||||||
|
|
||||||
<h3>Point Coordinates</h3>
|
<h3>Point Coordinates</h3>
|
||||||
|
|
||||||
|
<p class="whs1">import math</p>
|
||||||
|
|
||||||
<p class="whs1">import geompy</p>
|
<p class="whs1">import geompy</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># create a point</p>
|
<p class="whs2"># create a point</p>
|
||||||
|
|
||||||
<p class="whs1">point = geompy.MakeVertex(15,
|
<p class="whs1">point = geompy.MakeVertex(15.,
|
||||||
23, 80)</p>
|
23., 80.)</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># get the coordinates of the point and check its values</p>
|
<p class="whs2"># get the coordinates
|
||||||
|
of the point and check its values</p>
|
||||||
|
|
||||||
<p class="whs1">coords = geompy.PointCoordinates(point)</p>
|
<p class="whs1">coords = geompy.PointCoordinates(point)</p>
|
||||||
|
|
||||||
<p class="whs1">if coords[0] != 15
|
<p class="whs1"> </p>
|
||||||
or coords[1] != 23 or coords[2] != 80 :</p>
|
|
||||||
|
<p class="whs2"># check the obtained
|
||||||
|
coordinate values </p>
|
||||||
|
|
||||||
|
<p class="whs1">tolerance = 1.e-07</p>
|
||||||
|
|
||||||
|
<p class="whs1">def IsEqual(val1,
|
||||||
|
val2): return (math.fabs(val1 - val2) < tolerance)</p>
|
||||||
|
|
||||||
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
|
<p class="whs1">if IsEqual(coords[0],
|
||||||
|
15.) and IsEqual(coords[1], 23.) and IsEqual(coords[2], 80.):</p>
|
||||||
|
|
||||||
<p class="whs1"> print
|
<p class="whs1"> print
|
||||||
"Coordinates of point must be (15, 23, 80), but returned (",
|
"All values are OK."</p>
|
||||||
coords[0], ", ", coords[1], ", ", coords[2], ")"</p>
|
|
||||||
|
|
||||||
<p class="whs1">else :</p>
|
<p class="whs1">else :</p>
|
||||||
|
|
||||||
<p><span style="font-family: 'Lucida Console', monospace;"> print
|
<p class="whs1"> print
|
||||||
"All values are OK."</span> </p>
|
"Coordinates of point must be (15, 23, 80), but returned (",</p>
|
||||||
|
|
||||||
|
<p class="whs1"> print
|
||||||
|
coords[0], ", ", coords[1], ", ", coords[2], ")"</p>
|
||||||
|
|
||||||
|
<p><span style="font-family: 'Lucida Console', monospace;"> pass</span>
|
||||||
|
</p>
|
||||||
|
|
||||||
<h3>Basic Properties</h3>
|
<h3>Basic Properties</h3>
|
||||||
|
|
||||||
|
@ -143,50 +143,62 @@ if (window.writeIntopicBar)
|
|||||||
|
|
||||||
<p class="whs1">import salome</p>
|
<p class="whs1">import salome</p>
|
||||||
|
|
||||||
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># create a vertex and a vector</p>
|
<p># create a vertex and a vector</p>
|
||||||
|
|
||||||
<p class="whs1">p1 = geompy.MakeVertex(35,
|
<p class="whs1">p1 = geompy.MakeVertex(25,
|
||||||
35, 0)</p>
|
35, 45)</p>
|
||||||
|
|
||||||
<p class="whs1">p2 = geompy.MakeVertex(35,
|
<p class="whs1">p2 = geompy.MakeVertex(70,
|
||||||
35, 70)</p>
|
70, 70)</p>
|
||||||
|
|
||||||
<p class="whs1">v = geompy.MakeVector(p1,
|
<p class="whs1">v = geompy.MakeVector(p1,
|
||||||
p2)</p>
|
p2)</p>
|
||||||
|
|
||||||
<p> </p>
|
<p> </p>
|
||||||
|
|
||||||
<p># create cones</p>
|
<p># create cylinders</p>
|
||||||
|
|
||||||
<p class="whs1">cone1 = geompy.MakeCone(p1,
|
<p class="whs1">height = 40</p>
|
||||||
v, 17, 1, 20)</p>
|
|
||||||
|
|
||||||
<p class="whs1">cone2 = geompy.MakeConeR1R2H(30,
|
<p class="whs1"> </p>
|
||||||
10, 30)</p>
|
|
||||||
|
<p class="whs1">radius1 = 15</p>
|
||||||
|
|
||||||
|
<p class="whs1">cylinder1 = geompy.MakeCylinder(p1,
|
||||||
|
v, radius1, height)</p>
|
||||||
|
|
||||||
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
|
<p class="whs1">radius2 = 30</p>
|
||||||
|
|
||||||
|
<p class="whs1">cylinder2 = geompy.MakeCylinderRH(radius2,
|
||||||
|
height)</p>
|
||||||
|
|
||||||
<p class="whs1"> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># add objects in the study</p>
|
<p># add objects in the study</p>
|
||||||
|
|
||||||
<p class="whs1">id_cone1 = geompy.addToStudy(cone1,"Cone1")</p>
|
<p class="whs1">id_cylinder1 = geompy.addToStudy(cylinder1,"Cylinder1")</p>
|
||||||
|
|
||||||
<p class="whs1">id_cone2 = geompy.addToStudy(cone2,"Cone2")</p>
|
<p class="whs1">id_cylinder2 = geompy.addToStudy(cylinder2,"Cylinder2")</p>
|
||||||
|
|
||||||
<p> </p>
|
<p> </p>
|
||||||
|
|
||||||
<p># display cones</p>
|
<p># display the cylinders</p>
|
||||||
|
|
||||||
<p class="whs1">gg.createAndDisplayGO(id_cone1)</p>
|
<p class="whs1">gg.createAndDisplayGO(id_cylinder1)</p>
|
||||||
|
|
||||||
<p class="whs1">gg.setDisplayMode(id_cone1,1)</p>
|
<p class="whs1">gg.setDisplayMode(id_cylinder1,1)</p>
|
||||||
|
|
||||||
<p class="whs1">gg.createAndDisplayGO(id_cone2)</p>
|
<p class="whs1">gg.createAndDisplayGO(id_cylinder2)</p>
|
||||||
|
|
||||||
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_cone2,1)</span>
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_cylinder2,1)</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p> </p>
|
<p> </p>
|
||||||
|
@ -15,6 +15,7 @@ if (navigator.appName !="Netscape")
|
|||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
<!--
|
<!--
|
||||||
p.whs1 { font-family:'Lucida Console' , monospace; }
|
p.whs1 { font-family:'Lucida Console' , monospace; }
|
||||||
|
p.whs2 { font-family:'Times New Roman' , serif; }
|
||||||
-->
|
-->
|
||||||
</style><script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">
|
</style><script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">
|
||||||
<!--
|
<!--
|
||||||
@ -347,7 +348,7 @@ if (window.writeIntopicBar)
|
|||||||
|
|
||||||
<p> </p>
|
<p> </p>
|
||||||
|
|
||||||
<p># create an object, symmetrical to the given one relatively the given
|
<p># create an object, symmetrical to another object through the given
|
||||||
plane</p>
|
plane</p>
|
||||||
|
|
||||||
<p class="whs1">p1 = geompy.MakeVertex(
|
<p class="whs1">p1 = geompy.MakeVertex(
|
||||||
@ -367,7 +368,7 @@ if (window.writeIntopicBar)
|
|||||||
|
|
||||||
<p> </p>
|
<p> </p>
|
||||||
|
|
||||||
<p># create an object, symmetrical to the given one relatively the given
|
<p># create an object, symmetrical to another object through the given
|
||||||
axis</p>
|
axis</p>
|
||||||
|
|
||||||
<p class="whs1">p4 = geompy.MakeVertex(
|
<p class="whs1">p4 = geompy.MakeVertex(
|
||||||
@ -384,7 +385,7 @@ if (window.writeIntopicBar)
|
|||||||
|
|
||||||
<p> </p>
|
<p> </p>
|
||||||
|
|
||||||
<p># create an object, symmetrical to the given one relatively the given
|
<p># create an object, symmetrical to another object through the given
|
||||||
point</p>
|
point</p>
|
||||||
|
|
||||||
<p class="whs1">mirror3 = geompy.MakeMirrorByPoint(box,
|
<p class="whs1">mirror3 = geompy.MakeMirrorByPoint(box,
|
||||||
@ -450,18 +451,22 @@ if (window.writeIntopicBar)
|
|||||||
|
|
||||||
<p class="whs1">import salome</p>
|
<p class="whs1">import salome</p>
|
||||||
|
|
||||||
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
<p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># create a box and a sphere</p>
|
<p class="whs2"># create a box and a
|
||||||
|
sphere</p>
|
||||||
|
|
||||||
<p class="whs1">box = geompy.MakeBoxDXDYDZ(200,
|
<p class="whs1">box = geompy.MakeBoxDXDYDZ(200,
|
||||||
200, 200)</p>
|
200, 200)</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># scale the given object by the factor</p>
|
<p class="whs2"># scale the given object
|
||||||
|
by the factor</p>
|
||||||
|
|
||||||
<p class="whs1">p0 = geompy.MakeVertex(100,
|
<p class="whs1">p0 = geompy.MakeVertex(100,
|
||||||
100, 100)</p>
|
100, 100)</p>
|
||||||
@ -471,9 +476,10 @@ if (window.writeIntopicBar)
|
|||||||
<p class="whs1">scale = geompy.MakeScaleTransform(box,
|
<p class="whs1">scale = geompy.MakeScaleTransform(box,
|
||||||
p0, factor)</p>
|
p0, factor)</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># add objects in the study</p>
|
<p class="whs2"># add objects in the
|
||||||
|
study</p>
|
||||||
|
|
||||||
<p class="whs1">id_box = geompy.addToStudy(box,
|
<p class="whs1">id_box = geompy.addToStudy(box,
|
||||||
"Box")</p>
|
"Box")</p>
|
||||||
@ -481,14 +487,16 @@ if (window.writeIntopicBar)
|
|||||||
<p class="whs1">id_scale = geompy.addToStudy(scale,
|
<p class="whs1">id_scale = geompy.addToStudy(scale,
|
||||||
"Scale")</p>
|
"Scale")</p>
|
||||||
|
|
||||||
<p> </p>
|
<p class="whs1"> </p>
|
||||||
|
|
||||||
<p># display the results</p>
|
<p class="whs2"># display the results</p>
|
||||||
|
|
||||||
<p class="whs1">gg.createAndDisplayGO(id_box)</p>
|
<p class="whs1">gg.createAndDisplayGO(id_box)</p>
|
||||||
|
|
||||||
<p class="whs1">gg.setDisplayMode(id_box,1)</p>
|
<p class="whs1">gg.setDisplayMode(id_box,1)</p>
|
||||||
|
|
||||||
|
<p class="whs1">gg.setTransparency(id_box,0.5)</p>
|
||||||
|
|
||||||
<p class="whs1">gg.createAndDisplayGO(id_scale)</p>
|
<p class="whs1">gg.createAndDisplayGO(id_scale)</p>
|
||||||
|
|
||||||
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_scale,1)</span>
|
<p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_scale,1)</span>
|
||||||
|
Loading…
Reference in New Issue
Block a user