Salome HOME
PAL12557: SMESH Documentation for scripts is not up to date.
[modules/smesh.git] / doc / salome / gui / SMESH / constructing_meshes.htm
index d460c302f464e4a8658b49ddde3a67a8936f8645..e32e648fe9946e8a09eb0b5f2f50f1b84651ddf6 100755 (executable)
@@ -7,11 +7,13 @@
 <meta http-equiv="content-type" content="text/html; charset=windows-1252">\r
 <meta name="generator" content="RoboHelp by eHelp Corporation www.ehelp.com"><style type="text/css">\r
 <!--\r
-p.whs1 { margin-top:0pt; margin-bottom:0pt; font-family:'Lucida Console' , monospace; }\r
-p.whs2 { margin-top:0pt; margin-bottom:0pt; }\r
-p.whs3 { font-family:'Lucida Console' , monospace; margin-top:0px; margin-bottom:0px; }\r
-p.whs4 { margin-top:0px; margin-bottom:0px; }\r
+p.whs1 { margin-top:0pt; margin-bottom:0pt; }\r
+p.whs2 { margin-top:0pt; margin-bottom:0pt; font-family:'Lucida Console' , monospace; }\r
+p.whs3 { margin-top:0pt; margin-bottom:0pt; font-family:'Times New Roman' , serif; }\r
+p.whs4 { font-family:'Lucida Console' , monospace; margin-top:0px; margin-bottom:0px; }\r
 p.whs5 { margin-top:0px; margin-bottom:0px; font-family:'Times New Roman' , serif; }\r
+p.whs6 { margin-top:0px; margin-bottom:0px; }\r
+p.whs7 { margin-top:0px; margin-bottom:0px; font-family:'Lucida Console' , monospace; }\r
 -->\r
 </style><script type="text/javascript" language="JavaScript">\r
 <!--\r
@@ -23,6 +25,8 @@ if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))
   strNSS += "p.whs3 {margin-top:1pt;margin-bottom:1pt; }";\r
   strNSS += "p.whs4 {margin-top:1pt;margin-bottom:1pt; }";\r
   strNSS += "p.whs5 {margin-top:1pt;margin-bottom:1pt; }";\r
+  strNSS += "p.whs6 {margin-top:1pt;margin-bottom:1pt; }";\r
+  strNSS += "p.whs7 {margin-top:1pt;margin-bottom:1pt; }";\r
   strNSS +="</style>";\r
   document.write(strNSS);\r
 }\r
@@ -89,650 +93,350 @@ if (window.writeIntopicBar)
 </script>\r
 <h1>Creating Meshes</h1>\r
 \r
-<p>At first see <a href="smesh_py_introduction.htm">Example of 3d mesh generation</a>, using <b>smesh</b> package.\r
-<p>Other examples of python scripts will be also updated soon to use <b>smesh</b> package instead of direct usage of idl interface.\r
+<p class="whs1">First of all see <a href="smesh_py_introduction.htm">Example \r
+ of 3d mesh generation</a>, which is an example of good python script style \r
+ for Mesh module. </p>\r
 \r
-<h3><a name=bookmark>Construction of a Mesh</a></h3>\r
-\r
-<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
-<br>&nbsp;\r
-\r
-<p class="whs1">import salome</p>\r
-\r
-<p class="whs1">import geompy</p>\r
-\r
-<p class="whs1">import StdMeshers</p>\r
+<p class="whs1">Other examples of python \r
+ scripts will be also updated soon to use smesh package instead of direct \r
+ usage of idl interface. </p>\r
 \r
-<p class="whs1">smesh = salome.lcc.FindOrLoadComponent(&quot;FactoryServer&quot;, \r
- &quot;SMESH&quot;)</p>\r
+<h3><a name=bookmark>Construction of a Mesh</a></h3>\r
 \r
-<p class="whs1">smeshgui = salome.ImportComponentGUI(&quot;SMESH&quot;)</p>\r
+<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">import \r
+ geompy</span></p>\r
 \r
-<p class="whs1">smeshgui.Init(salome.myStudyId);</p>\r
+<p class="whs2">import smesh</p>\r
 \r
 <p class="whs2">&nbsp;</p>\r
 \r
-<p class="whs2"># create a box</p>\r
+<p class="whs3"># create a box</p>\r
 \r
-<p class="whs1">box = geompy.MakeBox(0., \r
+<p class="whs2">box = geompy.MakeBox(0., \r
  0., 0., 100., 200., 300.)</p>\r
 \r
-<p class="whs2">&nbsp;</p>\r
-\r
-<p class="whs2"># add box to the study</p>\r
-\r
-<p class="whs1">idbox = geompy.addToStudy(box, \r
+<p class="whs2">idbox = geompy.addToStudy(box, \r
  &quot;box&quot;)</p>\r
 \r
 <p class="whs2">&nbsp;</p>\r
 \r
-<p class="whs2"># create a hypothesis</p>\r
-\r
-<p class="whs1">print &quot;-------------------------- \r
- create Hypothesis&quot;</p>\r
-\r
-<p class="whs1">print &quot;-------------------------- \r
- NumberOfSegments&quot;</p>\r
-\r
-<p class="whs1">numberOfSegments \r
- = 7</p>\r
-\r
-<p class="whs1">hypNbSeg = smesh.CreateHypothesis(&quot;NumberOfSegments&quot;, \r
- &quot;libStdMeshersEngine.so&quot;)</p>\r
-\r
-<p class="whs1">hypNbSeg.SetNumberOfSegments(numberOfSegments)</p>\r
-\r
-<p class="whs1">print hypNbSeg.GetName()</p>\r
-\r
-<p class="whs1">print hypNbSeg.GetId()</p>\r
-\r
-<p class="whs1">print hypNbSeg.GetNumberOfSegments()</p>\r
-\r
-<p class="whs1">smeshgui.SetName(salome.ObjectToID(hypNbSeg), \r
- &quot;NumberOfSegments_10&quot;)</p>\r
-\r
-<p class="whs1">print &quot;-------------------------- \r
- MaxElementArea&quot;</p>\r
-\r
-<p class="whs1">maxElementArea = \r
- 800</p>\r
+<p class="whs3"># create a mesh</p>\r
 \r
-<p class="whs1">hypArea = smesh.CreateHypothesis(&quot;MaxElementArea&quot;, \r
- &quot;libStdMeshersEngine.so&quot;)</p>\r
-\r
-<p class="whs1">hypArea.SetMaxElementArea(maxElementArea)</p>\r
-\r
-<p class="whs1">print hypArea.GetName()</p>\r
-\r
-<p class="whs1">print hypArea.GetId()</p>\r
-\r
-<p class="whs1">print hypArea.GetMaxElementArea()</p>\r
-\r
-<p class="whs1">smeshgui.SetName(salome.ObjectToID(hypArea), \r
- &quot;MaxElementArea_500&quot;)</p>\r
-\r
-<p class="whs1">print &quot;-------------------------- \r
- MaxElementVolume&quot;</p>\r
-\r
-<p class="whs1">maxElementVolume \r
- = 900</p>\r
-\r
-<p class="whs1">hypVolume = smesh.CreateHypothesis(&quot;MaxElementVolume&quot;, \r
- &quot;libStdMeshersEngine.so&quot;)</p>\r
-\r
-<p class="whs1">hypVolume.SetMaxElementVolume(maxElementVolume)</p>\r
-\r
-<p class="whs1">print hypVolume.GetName()</p>\r
-\r
-<p class="whs1">print hypVolume.GetId()</p>\r
-\r
-<p class="whs1">print hypVolume.GetMaxElementVolume()</p>\r
-\r
-<p class="whs1">smeshgui.SetName(salome.ObjectToID(hypVolume), \r
- &quot;MaxElementVolume_500&quot;)</p>\r
+<p class="whs2">tetra = smesh.Mesh(box, \r
+ &quot;MeshBox&quot;)</p>\r
 \r
 <p class="whs2">&nbsp;</p>\r
 \r
-<p class="whs2"># create algorithms</p>\r
-\r
-<p class="whs1">print &quot;-------------------------- \r
- create Algorithms&quot;</p>\r
+<p class="whs2">algo1D = tetra.Segment()</p>\r
 \r
-<p class="whs1">print &quot;-------------------------- \r
- Regular_1D&quot;</p>\r
+<p class="whs2">algo1D.NumberOfSegments(7)</p>\r
 \r
-<p class="whs1">regular1D = smesh.CreateHypothesis(&quot;Regular_1D&quot;, \r
- &quot;libStdMeshersEngine.so&quot;)</p>\r
-\r
-<p class="whs1">smeshgui.SetName(salome.ObjectToID(regular1D), \r
- &quot;Wire Discretisation&quot;)</p>\r
-\r
-<p class="whs1">print &quot;-------------------------- \r
- MEFISTO_2D&quot;</p>\r
+<p class="whs2">&nbsp;</p>\r
 \r
-<p class="whs1">mefisto2D = smesh.CreateHypothesis(&quot;MEFISTO_2D&quot;, \r
- &quot;libStdMeshersEngine.so&quot;)</p>\r
+<p class="whs2">algo2D = tetra.Triangle()</p>\r
 \r
-<p class="whs1">smeshgui.SetName(salome.ObjectToID(mefisto2D), \r
- &quot;MEFISTO_2D&quot;)</p>\r
+<p class="whs2">algo2D.MaxElementArea(800.)</p>\r
 \r
 <p class="whs2">&nbsp;</p>\r
 \r
-<p class="whs2"># initialize a mesh with \r
- the box</p>\r
+<p class="whs2">algo3D = tetra.Tetrahedron(smesh.NETGEN)</p>\r
 \r
-<p class="whs1">mesh = smesh.CreateMesh(box)</p>\r
-\r
-<p class="whs1">smeshgui.SetName(salome.ObjectToID(mesh), \r
- &quot;MeshBox&quot;)</p>\r
+<p class="whs2">algo3D.MaxElementVolume(900.)</p>\r
 \r
 <p class="whs2">&nbsp;</p>\r
 \r
-<p class="whs2"># add the hypothesis to \r
- the box</p>\r
+<p class="whs3"># compute the mesh</p>\r
 \r
-<p class="whs1">print &quot;-------------------------- \r
- add hypothesis to the box&quot;</p>\r
+<p class="whs2">ret = tetra.Compute()</p>\r
 \r
-<p class="whs1">mesh.AddHypothesis(box,hypNbSeg)</p>\r
+<p class="whs2">if ret == 0:</p>\r
 \r
-<p class="whs1">mesh.AddHypothesis(box,hypArea)</p>\r
+<p class="whs2">&nbsp;&nbsp;&nbsp;&nbsp;print \r
+ &quot;problem when computing the mesh&quot;</p>\r
 \r
-<p class="whs1">mesh.AddHypothesis(box,hypVolume)</p>\r
+<p class="whs2">else:</p>\r
 \r
-<p class="whs1">mesh.AddHypothesis(box,regular1D)</p>\r
+<p class="whs2">&nbsp;&nbsp;&nbsp;&nbsp;print \r
+ &quot;mesh computed&quot;</p>\r
 \r
-<p class="whs1">mesh.AddHypothesis(box,mefisto2D)</p>\r
+<p class="whs2">&nbsp;&nbsp;&nbsp;&nbsp;pass \r
+ </p>\r
 \r
 <p class="whs2">&nbsp;</p>\r
 \r
-<p class="whs2"># compute the mesh</p>\r
-\r
-<p class="whs1">print &quot;-------------------------- \r
- compute the mesh of the box&quot;</p>\r
-\r
-<p class="whs1">ret = smesh.Compute(mesh,box)</p>\r
-\r
-<p class="whs1">print ret</p>\r
-\r
-<p class="whs1">if ret == 0:</p>\r
-\r
-<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print \r
- &quot;probleme when computing the mesh&quot;</p>\r
-\r
-<p class="whs1">salome.sg.updateObjBrowser(1)</p>\r
-\r
-<p class="whs1">&nbsp;</p>\r
+<p class="whs2">&nbsp;</p>\r
 \r
 <h3><a name=bookmark1>Construction of a Submesh</a></h3>\r
 \r
-<p class="whs3">&nbsp;</p>\r
-\r
-<p class="whs3"><span style="font-family: 'Lucida Console', monospace;">from \r
+<p class="whs4"><span style="font-family: 'Lucida Console', monospace;">from \r
  geompy import *</span></p>\r
 \r
-<p class="whs3">import smesh</p>\r
+<p class="whs4">import smesh</p>\r
 \r
 <p class="whs4">&nbsp;</p>\r
 \r
-<p class="whs4"># create vertices</p>\r
-\r
-<p class="whs3">Point111 = MakeVertex( 0, &nbsp;0, \r
- &nbsp;0)</p>\r
+<p class="whs5"># create a box</p>\r
 \r
-<p class="whs3">Point211 = MakeVertex(10, &nbsp;0, \r
- &nbsp;0)</p>\r
+<p class="whs4">box = MakeBoxDXDYDZ(10., 10., 10.)</p>\r
 \r
-<p class="whs3">Point121 = MakeVertex( 0, 10, &nbsp;0)</p>\r
-\r
-<p class="whs3">Point221 = MakeVertex(10, 10, &nbsp;0)</p>\r
-\r
-<p class="whs3">Point112 = MakeVertex( 0, &nbsp;0, \r
- 10)</p>\r
-\r
-<p class="whs3">Point212 = MakeVertex(10, &nbsp;0, \r
- 10)</p>\r
-\r
-<p class="whs3">Point122 = MakeVertex( 0, 10, 10)</p>\r
-\r
-<p class="whs3">Point222 = MakeVertex(10, 10, 10)</p>\r
+<p class="whs4">addToStudy(box, &quot;Box&quot;)</p>\r
 \r
 <p class="whs4">&nbsp;</p>\r
 \r
-<p class="whs4"># create edges</p>\r
-\r
-<p class="whs3">EdgeX111 = MakeEdge(Point111, Point211)</p>\r
-\r
-<p class="whs3">EdgeX121 = MakeEdge(Point121, Point221)</p>\r
-\r
-<p class="whs3">EdgeX112 = MakeEdge(Point112, Point212)</p>\r
-\r
-<p class="whs3">EdgeX122 = MakeEdge(Point122, Point222)</p>\r
-\r
-<p class="whs3">EdgeY11 = MakeEdge(Point111, Point121)</p>\r
+<p class="whs5"># select one edge of \r
+ the box for definition of a local hypothesis</p>\r
 \r
-<p class="whs3">EdgeY21 = MakeEdge(Point211, Point221)</p>\r
+<p class="whs4">p5 = MakeVertex(5., 0., 0.)</p>\r
 \r
-<p class="whs3">EdgeY12 = MakeEdge(Point112, Point122)</p>\r
+<p class="whs4">EdgeX = GetEdgeNearPoint(box, p5)</p>\r
 \r
-<p class="whs3">EdgeY22 = MakeEdge(Point212, Point222)</p>\r
-\r
-<p class="whs3">EdgeZ111 = MakeEdge(Point111, Point112)</p>\r
-\r
-<p class="whs3">EdgeZ211 = MakeEdge(Point211, Point212)</p>\r
-\r
-<p class="whs3">EdgeZ121 = MakeEdge(Point121, Point122)</p>\r
-\r
-<p class="whs3">EdgeZ221 = MakeEdge(Point221, Point222)</p>\r
+<p class="whs4">addToStudyInFather(box, EdgeX, &quot;Edge \r
+ [0,0,0 - 10,0,0]&quot;)</p>\r
 \r
 <p class="whs4">&nbsp;</p>\r
 \r
-<p class="whs4"># create faces</p>\r
-\r
-<p class="whs3">FaceX11 = MakeQuad(EdgeY11, EdgeZ111, \r
- EdgeY12, EdgeZ121)</p>\r
+<p class="whs5"># create a hexahedral \r
+ mesh on the box</p>\r
 \r
-<p class="whs3">FaceX21 = MakeQuad(EdgeY21, EdgeZ211, \r
- EdgeY22, EdgeZ221)</p>\r
-\r
-<p class="whs3">FaceY111 = MakeQuad(EdgeX111, EdgeZ111, \r
- EdgeX112, EdgeZ211)</p>\r
-\r
-<p class="whs3">FaceY121 = MakeQuad(EdgeX121, EdgeZ121, \r
- EdgeX122, EdgeZ221)</p>\r
-\r
-<p class="whs3">FaceZ11 = MakeQuad(EdgeX111, EdgeY11, \r
- EdgeX121, EdgeY21)</p>\r
-\r
-<p class="whs3">FaceZ12 = MakeQuad(EdgeX112, EdgeY12, \r
- EdgeX122, EdgeY22)</p>\r
+<p class="whs4">quadra = smesh.Mesh(box, &quot;Box : quadrangle \r
+ 2D mesh&quot;)</p>\r
 \r
 <p class="whs4">&nbsp;</p>\r
 \r
-<p class="whs4"># create a solid</p>\r
+<p class="whs5"># create a regular \r
+ 1D algorithm for the faces</p>\r
 \r
-<p class="whs3">Block = MakeHexa(FaceX11, FaceX21, FaceY111, \r
- FaceY121, FaceZ11, FaceZ12)</p>\r
+<p class="whs4">algo1D = quadra.Segment()</p>\r
 \r
 <p class="whs4">&nbsp;</p>\r
 \r
-<p class="whs4"># create a compound</p>\r
+<p class="whs5"># define &quot;NumberOfSegments&quot; \r
+ hypothesis to cut</p>\r
 \r
-<p class="whs3">box = MakeCompound([Block])</p>\r
+<p class="whs5"># all the edges in \r
+ a fixed number of segments</p>\r
 \r
-<p class="whs4">&nbsp;</p>\r
-\r
-<p class="whs4"># add in the study</p>\r
-\r
-<p class="whs3">box_id = addToStudy(box, &quot;Box compound&quot;)</p>\r
+<p class="whs4">algo1D.NumberOfSegments(4)</p>\r
 \r
 <p class="whs4">&nbsp;</p>\r
 \r
-<p class="whs4"># create hexahedral mesh \r
- on the box</p>\r
-\r
-<p class="whs3">hexa = smesh.Mesh(box, &quot;Box compound \r
- : hexahedrical mesh&quot;)</p>\r
+<p class="whs5"># create a quadrangle \r
+ 2D algorithm for the faces</p>\r
 \r
-<p class="whs3">algo = hexa.Segment()</p>\r
+<p class="whs4">quadra.Quadrangle()</p>\r
 \r
 <p class="whs4">&nbsp;</p>\r
 \r
-<p class="whs4"># define &quot;NumberOfSegments&quot; \r
hypothesis to cut the edge in a fixed number of segments</p>\r
+<p class="whs5"># construct a submesh \r
on the edge with a local hypothesis</p>\r
 \r
-<p class="whs3">algo.NumberOfSegments(4)</p>\r
+<p class="whs4">algo_local = quadra.Segment(EdgeX)</p>\r
 \r
 <p class="whs4">&nbsp;</p>\r
 \r
-<p class="whs4"># creates a quadrangle \r
- 2D algorithm for the faces</p>\r
+<p class="whs5"># define &quot;Arithmetic1D&quot; \r
+ hypothesis to cut the edge<span style="margin-top: 0px;\r
+                                                                               margin-bottom: 0px;\r
+                                                                               font-family: 'Times New Roman', serif;"> \r
+ in several segments with increasing arithmetic length</span></p>\r
 \r
-<p class="whs3">hexa.Quadrangle()</p>\r
+<p class="whs4">algo_local.Arithmetic1D(1, 4)</p>\r
 \r
 <p class="whs4">&nbsp;</p>\r
 \r
-<p class="whs4"># construct a submesh with \r
a local hypothesis</p>\r
+<p class="whs5"># define &quot;Propagation&quot; \r
hypothesis that propagates all other hypotheses</p>\r
 \r
-<p class="whs3">algo = hexa.Segment(EdgeX111)</p>\r
+<p class="whs5"># on all edges of the \r
+ opposite side in case of quadrangular faces</p>\r
 \r
-<p class="whs4">&nbsp;</p>\r
-\r
-<p class="whs4"># define &quot;Arithmetic1D&quot; \r
- hypothesis to cut an edge in several segments with increasing arithmetic \r
- length </p>\r
-\r
-<p class="whs3">algo.Arithmetic1D(1, 4)</p>\r
+<p class="whs4">algo_local.Propagation()</p>\r
 \r
 <p class="whs4">&nbsp;</p>\r
 \r
-<p class="whs4"># define &quot;Propagation&quot; \r
- hypothesis that propagates all other hypothesis on all edges on the opposite \r
- side in case of quadrangular faces</p>\r
+<p class="whs5"># compute the mesh</p>\r
 \r
-<p class="whs3">algo.Propagation()</p>\r
+<p class="whs4">quadra.Compute() </p>\r
 \r
 <p class="whs4">&nbsp;</p>\r
 \r
-<p class="whs4"># compute the mesh</p>\r
-\r
-<p class="whs3">hexa.Compute() </p>\r
-\r
-<p class="whs3">&nbsp;</p>\r
-\r
 <h3><a name=bookmark2>Editing of a mesh</a></h3>\r
 \r
-<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
-<br>&nbsp;\r
-\r
-<p class="whs3">&nbsp;</p>\r
-\r
-<p class="whs3"><span style="font-family: 'Lucida Console', monospace;">import \r
- salome</span></p>\r
-\r
-<p class="whs3">import geompy</p>\r
+<p class="whs4"><span style="font-family: 'Lucida Console', monospace;">import \r
+ geompy</span></p>\r
 \r
-<p class="whs3">import SMESH</p>\r
+<p class="whs4">import smesh</p>\r
 \r
-<p class="whs3">import StdMeshers</p>\r
-\r
-<p class="whs3">&nbsp;</p>\r
+<p class="whs4">&nbsp;</p>\r
 \r
-<p class="whs3">smesh = salome.lcc.FindOrLoadComponent(&quot;FactoryServer&quot;, \r
- &quot;SMESH&quot;)</p>\r
+<p class="whs4">def PrintMeshInfo(theMesh):</p>\r
 \r
-<p class="whs3">smesh.SetCurrentStudy(salome.myStudy)</p>\r
+<p class="whs4">&nbsp;&nbsp;&nbsp;&nbsp;aMesh \r
+ = theMesh.GetMesh()</p>\r
 \r
-<p class="whs3">&nbsp;</p>\r
+<p class="whs4">&nbsp;&nbsp;&nbsp;&nbsp;print \r
+ &quot;Information about mesh:&quot;</p>\r
 \r
-<p class="whs3">box &nbsp;&nbsp;= \r
- geompy.MakeBox(0., 0., 0., 20., 20., 20.)</p>\r
+<p class="whs4">&nbsp;&nbsp;&nbsp;&nbsp;print \r
+ &quot;Number of nodes &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: \r
+ &quot;, aMesh.NbNodes()</p>\r
 \r
-<p class="whs3">idbox = geompy.addToStudy(box, &quot;box&quot;)</p>\r
+<p class="whs4">&nbsp;&nbsp;&nbsp;&nbsp;print \r
+ &quot;Number of edges &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: \r
+ &quot;, aMesh.NbEdges()</p>\r
 \r
-<p class="whs3">&nbsp;</p>\r
+<p class="whs4">&nbsp;&nbsp;&nbsp;&nbsp;print \r
+ &quot;Number of faces &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: \r
+ &quot;, aMesh.NbFaces()</p>\r
 \r
-<p class="whs3">subShapeList = geompy.SubShapeAll(box, \r
- geompy.ShapeType[&quot;EDGE&quot;])</p>\r
+<p class="whs4">&nbsp;&nbsp;&nbsp;&nbsp;print \r
+ &quot;Number of volumes &nbsp;&nbsp;&nbsp;&nbsp;: \r
+ &quot;, aMesh.NbVolumes()</p>\r
 \r
-<p class="whs3">edge &nbsp;&nbsp;= \r
- subShapeList[0]</p>\r
+<p class="whs4">&nbsp;&nbsp;&nbsp;&nbsp;pass</p>\r
 \r
-<p class="whs3">name &nbsp;&nbsp;= \r
- geompy.SubShapeName(edge, box)</p>\r
-\r
-<p class="whs3">idedge = geompy.addToStudyInFather(box, \r
- edge, name)</p>\r
+<p class="whs4">&nbsp;</p>\r
 \r
-<p class="whs3">&nbsp;</p>\r
+<p class="whs5"># create a box</p>\r
 \r
-<p class="whs3">box &nbsp;= \r
salome.IDToObject(idbox)</p>\r
+<p class="whs4">box = geompy.MakeBox(0., 0., 0., 20., \r
20., 20.)</p>\r
 \r
-<p class="whs3">edge = salome.IDToObject(idedge)</p>\r
+<p class="whs4">geompy.addToStudy(box, &quot;box&quot;)</p>\r
 \r
-<p class="whs3">&nbsp;</p>\r
+<p class="whs4">&nbsp;</p>\r
 \r
-<p class="whs3">hyp1 = smesh.CreateHypothesis(&quot;NumberOfSegments&quot;, \r
&quot;libStdMeshersEngine.so&quot;)</p>\r
+<p class="whs5"># select one edge of \r
the box for definition of a local hypothesis</p>\r
 \r
-<p class="whs3">hyp1.SetNumberOfSegments(3)</p>\r
+<p class="whs4">subShapeList = geompy.SubShapeAll(box, \r
+ geompy.ShapeType[&quot;EDGE&quot;])</p>\r
 \r
-<p class="whs3">hyp2 = smesh.CreateHypothesis(&quot;MaxElementArea&quot;, \r
- &quot;libStdMeshersEngine.so&quot;)</p>\r
+<p class="whs4">edge = subShapeList[0]</p>\r
 \r
-<p class="whs3">hyp2.SetMaxElementArea(10)</p>\r
+<p class="whs4">name = geompy.SubShapeName(edge, box)</p>\r
 \r
-<p class="whs3">hyp3 = smesh.CreateHypothesis(&quot;Arithmetic1D&quot;, \r
- &quot;libStdMeshersEngine.so&quot;)</p>\r
+<p class="whs4">geompy.addToStudyInFather(box, edge, name)</p>\r
 \r
-<p class="whs3">hyp3.SetLength(1,1)</p>\r
+<p class="whs4">&nbsp;</p>\r
 \r
-<p class="whs3">hyp3.SetLength(6,0)</p>\r
+<p class="whs5"># create a mesh</p>\r
 \r
-<p class="whs3">hyp4 = smesh.CreateHypothesis(&quot;Propagation&quot;, \r
- &quot;libStdMeshersEngine.so&quot;)</p>\r
+<p class="whs4">tria = smesh.Mesh(box, &quot;Mesh 2D&quot;)</p>\r
 \r
-<p class="whs3">&nbsp;</p>\r
+<p class="whs4">algo1D = tria.Segment()</p>\r
 \r
-<p class="whs3">algo1 = smesh.CreateHypothesis(&quot;Regular_1D&quot;, \r
- &quot;libStdMeshersEngine.so&quot;)</p>\r
+<p class="whs4">hyp1 = algo1D.NumberOfSegments(3)</p>\r
 \r
-<p class="whs3">algo2 = smesh.CreateHypothesis(&quot;MEFISTO_2D&quot;, \r
- &quot;libStdMeshersEngine.so&quot;)</p>\r
+<p class="whs4">algo2D = tria.Triangle()</p>\r
 \r
-<p class="whs3">&nbsp;</p>\r
+<p class="whs4">hyp2 = algo2D.MaxElementArea(10.)</p>\r
 \r
-<p class="whs3">mesh = smesh.CreateMesh(box)</p>\r
+<p class="whs4">&nbsp;</p>\r
 \r
-<p class="whs3">mesh.AddHypothesis(box,hyp1)</p>\r
+<p class="whs5"># create a sub-mesh</p>\r
 \r
-<p class="whs3">mesh.AddHypothesis(box,hyp2)</p>\r
+<p class="whs4">algo_local = tria.Segment(edge)</p>\r
 \r
-<p class="whs3">mesh.AddHypothesis(box,algo1)</p>\r
+<p class="whs4">hyp3 = algo_local.Arithmetic1D(1, 6)</p>\r
 \r
-<p class="whs3">mesh.AddHypothesis(box,algo2)</p>\r
+<p class="whs4">hyp4 = algo_local.Propagation()</p>\r
 \r
-<p class="whs3">mesh.AddHypothesis(edge,hyp3)</p>\r
+<p class="whs4">&nbsp;</p>\r
 \r
-<p class="whs3">mesh.AddHypothesis(edge,hyp4)</p>\r
+<p class="whs5"># compute the mesh</p>\r
 \r
-<p class="whs3">mesh.AddHypothesis(edge,algo1)</p>\r
+<p class="whs4">tria.Compute()</p>\r
 \r
-<p class="whs3">&nbsp;</p>\r
+<p class="whs4">PrintMeshInfo(tria)</p>\r
 \r
-<p class="whs3">smesh.Compute(mesh,box)</p>\r
+<p class="whs4">&nbsp;</p>\r
 \r
-<p class="whs3">salome.sg.updateObjBrowser(1)</p>\r
+<p class="whs5"># remove a local hypothesis</p>\r
 \r
-<p class="whs3">&nbsp;</p>\r
+<p class="whs4">mesh = tria.GetMesh()</p>\r
 \r
-<p class="whs5"># remove a hypothesis</p>\r
+<p class="whs4">mesh.RemoveHypothesis(edge, hyp4)</p>\r
 \r
-<p class="whs3">mesh.RemoveHypothesis(edge,hyp4)</p>\r
+<p class="whs4">&nbsp;</p>\r
 \r
-<p class="whs3">&nbsp;</p>\r
+<p class="whs5"># compute the mesh</p>\r
 \r
-<p class="whs3">smesh.Compute(mesh,box)</p>\r
+<p class="whs4">tria.Compute()</p>\r
 \r
-<p class="whs3">salome.sg.updateObjBrowser(1)</p>\r
+<p class="whs4">PrintMeshInfo(tria)</p>\r
 \r
-<p class="whs3">&nbsp;</p>\r
+<p class="whs4">&nbsp;</p>\r
 \r
 <p class="whs5"># change the value \r
- of the hypothesis</p>\r
-\r
-<p class="whs3">hyp2.SetMaxElementArea(2)</p>\r
-\r
-<p class="whs3">mesh.AddHypothesis(box,hyp2)</p>\r
+ of the 2D hypothesis</p>\r
 \r
-<p class="whs3">&nbsp;</p>\r
-\r
-<p class="whs3">smesh.Compute(mesh,box)</p>\r
-\r
-<p class="whs3">salome.sg.updateObjBrowser(1) </p>\r
+<p class="whs4">hyp2.SetMaxElementArea(2.)</p>\r
 \r
 <p class="whs4">&nbsp;</p>\r
 \r
-<h3><a name=bookmark3>Export of a Mesh</a></h3>\r
-\r
-<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.\r
-<br>&nbsp;\r
-\r
-<p class="whs4">&nbsp;</p>\r
+<p class="whs5"># compute the mesh</p>\r
 \r
-<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">import \r
- salome</span></p>\r
+<p class="whs4">tria.Compute()</p>\r
 \r
-<p class="whs1">import geompy</p>\r
+<p class="whs4">PrintMeshInfo(tria) </p>\r
 \r
-<p class="whs1">import StdMeshers</p>\r
+<p class="whs6">&nbsp;</p>\r
 \r
-<p class="whs1">smesh = salome.lcc.FindOrLoadComponent(&quot;FactoryServer&quot;, \r
- &quot;SMESH&quot;)</p>\r
+<h3><a name=bookmark3>Export of a Mesh</a></h3>\r
 \r
-<p class="whs1">smeshgui = salome.ImportComponentGUI(&quot;SMESH&quot;)</p>\r
+<p class="whs7">import geompy</p>\r
 \r
-<p class="whs1">smeshgui.Init(salome.myStudyId);</p>\r
+<p class="whs7">import smesh</p>\r
 \r
-<p class="whs2">&nbsp;</p>\r
+<p class="whs6">&nbsp;</p>\r
 \r
-<p class="whs2"># create a box</p>\r
+<p class="whs6"># create a box</p>\r
 \r
-<p class="whs1">box = geompy.MakeBox(0., \r
+<p class="whs7">box = geompy.MakeBox(0., \r
  0., 0., 100., 200., 300.)</p>\r
 \r
-<p class="whs2">&nbsp;</p>\r
-\r
-<p class="whs2"># add the box to the study</p>\r
-\r
-<p class="whs1">idbox = geompy.addToStudy(box, \r
+<p class="whs7">idbox = geompy.addToStudy(box, \r
  &quot;box&quot;)</p>\r
 \r
-<p class="whs2">&nbsp;</p>\r
-\r
-<p class="whs2"># create a hypothesis</p>\r
-\r
-<p class="whs1">print &quot;-------------------------- \r
- create Hypothesis&quot;</p>\r
-\r
-<p class="whs1">print &quot;-------------------------- \r
- NumberOfSegments&quot;</p>\r
-\r
-<p class="whs1">numberOfSegments \r
- = 7</p>\r
-\r
-<p class="whs1">hypNbSeg = smesh.CreateHypothesis(&quot;NumberOfSegments&quot;, \r
- &quot;libStdMeshersEngine.so&quot;)</p>\r
-\r
-<p class="whs1">hypNbSeg.SetNumberOfSegments(numberOfSegments)</p>\r
-\r
-<p class="whs1">print hypNbSeg.GetName()</p>\r
+<p class="whs6">&nbsp;</p>\r
 \r
-<p class="whs1">print hypNbSeg.GetId()</p>\r
+<p class="whs6"># create a mesh</p>\r
 \r
-<p class="whs1">print hypNbSeg.GetNumberOfSegments()</p>\r
-\r
-<p class="whs1">smeshgui.SetName(salome.ObjectToID(hypNbSeg), \r
- &quot;NumberOfSegments_10&quot;)</p>\r
-\r
-<p class="whs1">print &quot;-------------------------- \r
- MaxElementArea&quot;</p>\r
-\r
-<p class="whs1">maxElementArea = \r
- 800</p>\r
-\r
-<p class="whs1">hypArea = smesh.CreateHypothesis(&quot;MaxElementArea&quot;, \r
- &quot;libStdMeshersEngine.so&quot;)</p>\r
-\r
-<p class="whs1">hypArea.SetMaxElementArea(maxElementArea)</p>\r
-\r
-<p class="whs1">print hypArea.GetName()</p>\r
-\r
-<p class="whs1">print hypArea.GetId()</p>\r
-\r
-<p class="whs1">print hypArea.GetMaxElementArea()</p>\r
-\r
-<p class="whs1">smeshgui.SetName(salome.ObjectToID(hypArea), \r
- &quot;MaxElementArea_500&quot;)</p>\r
-\r
-<p class="whs1">print &quot;-------------------------- \r
- MaxElementVolume&quot;</p>\r
-\r
-<p class="whs1">maxElementVolume \r
- = 900</p>\r
-\r
-<p class="whs1">hypVolume = smesh.CreateHypothesis(&quot;MaxElementVolume&quot;, \r
- &quot;libStdMeshersEngine.so&quot;)</p>\r
-\r
-<p class="whs1">hypVolume.SetMaxElementVolume(maxElementVolume)</p>\r
-\r
-<p class="whs1">print hypVolume.GetName()</p>\r
-\r
-<p class="whs1">print hypVolume.GetId()</p>\r
-\r
-<p class="whs1">print hypVolume.GetMaxElementVolume()</p>\r
-\r
-<p class="whs1">smeshgui.SetName(salome.ObjectToID(hypVolume), \r
- &quot;MaxElementVolume_500&quot;)</p>\r
-\r
-<p class="whs2">&nbsp;</p>\r
-\r
-<p class="whs2"># create algorithms</p>\r
-\r
-<p class="whs1">print &quot;-------------------------- \r
- create Algorithms&quot;</p>\r
-\r
-<p class="whs1">print &quot;-------------------------- \r
- Regular_1D&quot;</p>\r
-\r
-<p class="whs1">regular1D = smesh.CreateHypothesis(&quot;Regular_1D&quot;, \r
- &quot;libStdMeshersEngine.so&quot;)</p>\r
-\r
-<p class="whs1">smeshgui.SetName(salome.ObjectToID(regular1D), \r
- &quot;Wire Discretisation&quot;)</p>\r
-\r
-<p class="whs1">print &quot;-------------------------- \r
- MEFISTO_2D&quot;</p>\r
-\r
-<p class="whs1">mefisto2D = smesh.CreateHypothesis(&quot;MEFISTO_2D&quot;, \r
- &quot;libStdMeshersEngine.so&quot;)</p>\r
-\r
-<p class="whs1">smeshgui.SetName(salome.ObjectToID(mefisto2D), \r
- &quot;MEFISTO_2D&quot;)</p>\r
-\r
-<p class="whs2">&nbsp;</p>\r
-\r
-<p class="whs2"># initialize a mesh with \r
- the box</p>\r
-\r
-<p class="whs1">mesh = smesh.CreateMesh(box)</p>\r
-\r
-<p class="whs1">smeshgui.SetName(salome.ObjectToID(mesh), \r
+<p class="whs7">tetra = smesh.Mesh(box, \r
  &quot;MeshBox&quot;)</p>\r
 \r
-<p class="whs1">&nbsp;</p>\r
-\r
-<p class="whs2"># add the hypothesis to \r
- the box</p>\r
+<p class="whs6">&nbsp;</p>\r
 \r
-<p class="whs1">print &quot;-------------------------- \r
- add hypothesis to the box&quot;</p>\r
+<p class="whs7">algo1D = tetra.Segment()</p>\r
 \r
-<p class="whs1">mesh.AddHypothesis(box,hypNbSeg)</p>\r
+<p class="whs7">algo1D.NumberOfSegments(7)</p>\r
 \r
-<p class="whs1">mesh.AddHypothesis(box,hypArea)</p>\r
+<p class="whs7">&nbsp;</p>\r
 \r
-<p class="whs1">mesh.AddHypothesis(box,hypVolume)</p>\r
+<p class="whs7">algo2D = tetra.Triangle()</p>\r
 \r
-<p class="whs1">mesh.AddHypothesis(box,regular1D)</p>\r
+<p class="whs7">algo2D.MaxElementArea(800.)</p>\r
 \r
-<p class="whs1">mesh.AddHypothesis(box,mefisto2D)</p>\r
-\r
-<p class="whs2">&nbsp;</p>\r
+<p class="whs7">&nbsp;</p>\r
 \r
-<p class="whs2"># compute the mesh</p>\r
+<p class="whs7">algo3D = tetra.Tetrahedron(smesh.NETGEN)</p>\r
 \r
-<p class="whs1">print &quot;-------------------------- \r
- compute the mesh of the box&quot;</p>\r
+<p class="whs7">algo3D.MaxElementVolume(900.)</p>\r
 \r
-<p class="whs1">ret = smesh.Compute(mesh,box)</p>\r
+<p class="whs6">&nbsp;</p>\r
 \r
-<p class="whs1">print ret</p>\r
+<p class="whs6"># compute the mesh</p>\r
 \r
-<p class="whs1">if ret == 0:</p>\r
+<p class="whs7">tetra.Compute()</p>\r
 \r
-<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print \r
- &quot;probleme when computing the mesh&quot;</p>\r
+<p class="whs6">&nbsp;</p>\r
 \r
-<p class="whs1">salome.sg.updateObjBrowser(1)</p>\r
+<p class="whs6"># export the mesh in a \r
+ MED file</p>\r
 \r
-<p class="whs1">mesh.ExportMED(&quot;/tmp/meshMED.med&quot;,0)</p>\r
-\r
-<p class="whs2">&nbsp;</p>\r
-\r
-<p class="whs4">&nbsp;</p>\r
+<p class="whs7">tetra.ExportMED(&quot;/tmp/meshMED.med&quot;, \r
+ 0) </p>\r
 \r
 <script type="text/javascript" language="javascript1.2">\r
 <!--\r