Salome HOME
PAL12557: SMESH Documentation for scripts is not up to date.
[modules/smesh.git] / doc / salome / gui / SMESH / viewing_meshes.htm
index a04fe708b641e85b5b8d4a08717ccf7c073b8849..27b788e3019edf427042eef00397d0d76b822adc 100755 (executable)
@@ -85,124 +85,56 @@ if (window.writeIntopicBar)
 \r
 <h3>Viewing Mesh Infos</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
+<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">import \r
+ geompy</span></p>\r
 \r
-<p class="whs1">import salome</p>\r
-\r
-<p class="whs1">import geompy</p>\r
-\r
-<p class="whs1">import SMESH</p>\r
-\r
-<p class="whs1">import StdMeshers</p>\r
+<p class="whs1">import smesh</p>\r
 \r
 <p class="whs1">&nbsp;</p>\r
 \r
-<p class="whs1">smesh = salome.lcc.FindOrLoadComponent(&quot;FactoryServer&quot;, \r
- &quot;SMESH&quot;)</p>\r
+<p class="whs2"># create a box</p>\r
 \r
-<p class="whs1">smesh.SetCurrentStudy(salome.myStudy)</p>\r
-\r
-<p class="whs1">&nbsp;</p>\r
+<p class="whs1">box = geompy.MakeBox(0., 0., 0., 20., \r
+ 20., 20.)</p>\r
 \r
-<p class="whs1">box &nbsp;&nbsp;= \r
- geompy.MakeBox(0., 0., 0., 20., 20., 20.)</p>\r
-\r
-<p class="whs1">idbox = geompy.addToStudy(box, &quot;box&quot;)</p>\r
+<p class="whs1">geompy.addToStudy(box, &quot;box&quot;)</p>\r
 \r
 <p class="whs1">&nbsp;</p>\r
 \r
-<p class="whs1">subShapeList = geompy.SubShapeAll(box, \r
- geompy.ShapeType[&quot;EDGE&quot;])</p>\r
-\r
-<p class="whs1">edge &nbsp;&nbsp;= \r
- subShapeList[0]</p>\r
+<p class="whs2"># create a mesh</p>\r
 \r
-<p class="whs1">name &nbsp;&nbsp;= \r
- geompy.SubShapeName(edge, box)</p>\r
-\r
-<p class="whs1">idedge = geompy.addToStudyInFather(box, \r
- edge, name)</p>\r
+<p class="whs1">tetra = smesh.Mesh(box, &quot;MeshBox&quot;)</p>\r
 \r
 <p class="whs1">&nbsp;</p>\r
 \r
-<p class="whs1">box &nbsp;= \r
- salome.IDToObject(idbox)</p>\r
+<p class="whs1">algo1D = tetra.Segment()</p>\r
 \r
-<p class="whs1">edge = salome.IDToObject(idedge)</p>\r
+<p class="whs1">algo1D.NumberOfSegments(3)</p>\r
 \r
 <p class="whs1">&nbsp;</p>\r
 \r
-<p class="whs1">hyp1 = smesh.CreateHypothesis(&quot;NumberOfSegments&quot;, \r
- &quot;libStdMeshersEngine.so&quot;)</p>\r
-\r
-<p class="whs1">hyp1.SetNumberOfSegments(3)</p>\r
+<p class="whs1">algo2D = tetra.Triangle()</p>\r
 \r
-<p class="whs1">hyp2 = smesh.CreateHypothesis(&quot;MaxElementArea&quot;, \r
- &quot;libStdMeshersEngine.so&quot;)</p>\r
-\r
-<p class="whs1">hyp2.SetMaxElementArea(10)</p>\r
-\r
-<p class="whs1">hyp3 = smesh.CreateHypothesis(&quot;Arithmetic1D&quot;, \r
- &quot;libStdMeshersEngine.so&quot;)</p>\r
-\r
-<p class="whs1">hyp3.SetLength(1,1)</p>\r
-\r
-<p class="whs1">hyp3.SetLength(6,0)</p>\r
-\r
-<p class="whs1">hyp4 = smesh.CreateHypothesis(&quot;Propagation&quot;, \r
- &quot;libStdMeshersEngine.so&quot;)</p>\r
+<p class="whs1">algo2D.MaxElementArea(10.)</p>\r
 \r
 <p class="whs1">&nbsp;</p>\r
 \r
-<p class="whs1">algo1 = smesh.CreateHypothesis(&quot;Regular_1D&quot;, \r
- &quot;libStdMeshersEngine.so&quot;)</p>\r
-\r
-<p class="whs1">algo2 = smesh.CreateHypothesis(&quot;MEFISTO_2D&quot;, \r
- &quot;libStdMeshersEngine.so&quot;)</p>\r
+<p class="whs1">algo3D = tetra.Tetrahedron(smesh.NETGEN)</p>\r
 \r
-<p class="whs1">mesh = smesh.CreateMesh(box)</p>\r
+<p class="whs1">algo3D.MaxElementVolume(900.)</p>\r
 \r
 <p class="whs1">&nbsp;</p>\r
 \r
-<p class="whs1">mesh.AddHypothesis(box,hyp1)</p>\r
-\r
-<p class="whs1">mesh.AddHypothesis(box,hyp2)</p>\r
-\r
-<p class="whs1">mesh.AddHypothesis(box,algo1)</p>\r
+<p class="whs2"># compute the mesh</p>\r
 \r
-<p class="whs1">mesh.AddHypothesis(box,algo2)</p>\r
-\r
-<p class="whs1">mesh.AddHypothesis(edge,hyp3)</p>\r
-\r
-<p class="whs1">mesh.AddHypothesis(edge,hyp4)</p>\r
-\r
-<p class="whs1">mesh.AddHypothesis(edge,algo1)</p>\r
-\r
-<p class="whs1">smesh.Compute(mesh,box)</p>\r
-\r
-<p class="whs1">salome.sg.updateObjBrowser(1)</p>\r
-\r
-<p class="whs1">&nbsp;</p>\r
-\r
-<p class="whs2"># remove one hypothesis</p>\r
-\r
-<p class="whs1">mesh.RemoveHypothesis(edge,hyp4)</p>\r
-\r
-<p class="whs1">smesh.Compute(mesh,box)</p>\r
-\r
-<p class="whs1">salome.sg.updateObjBrowser(1)</p>\r
+<p class="whs1">tetra.Compute()</p>\r
 \r
 <p class="whs1">&nbsp;</p>\r
 \r
-<p class="whs2"># change the value \r
- of the hypothesis</p>\r
-\r
-<p class="whs1">hyp2.SetMaxElementArea(2)</p>\r
+<p class="whs2"># print informations \r
+ about the mesh</p>\r
 \r
-<p class="whs1">mesh.AddHypothesis(box,hyp2)</p>\r
-\r
-<p class="whs1">smesh.Compute(mesh,box)</p>\r
+<p class="whs1">mesh = tetra.GetMesh()</p>\r
 \r
 <p class="whs1">print &quot;Information about mesh:&quot;</p>\r
 \r
@@ -215,36 +147,36 @@ if (window.writeIntopicBar)
 <p class="whs1">print &quot;Number of faces &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: \r
  &quot;, mesh.NbFaces()</p>\r
 \r
-<p class="whs1">print &quot;Number of triangles &nbsp;&nbsp;: \r
+<p class="whs1">print &quot; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;triangles \r
+ &nbsp;&nbsp;: \r
  &quot;, mesh.NbTriangles()</p>\r
 \r
-<p class="whs1">print &quot;Number of quadrangles : &quot;, \r
- mesh.NbQuadrangles()</p>\r
+<p class="whs1">print &quot; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;quadrangles \r
: &quot;, mesh.NbQuadrangles()</p>\r
 \r
-<p class="whs1">print &quot;Number of polygons &nbsp;&nbsp;&nbsp;: \r
+<p class="whs1">print &quot; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;polygons \r
+ &nbsp;&nbsp;&nbsp;: \r
  &quot;, mesh.NbPolygons()</p>\r
 \r
 <p class="whs1">print &quot;Number of volumes &nbsp;&nbsp;&nbsp;&nbsp;: \r
  &quot;, mesh.NbVolumes()</p>\r
 \r
-<p class="whs1">print &quot;Number of tetrahedrons: &quot;, \r
- mesh.NbTetras()</p>\r
+<p class="whs1">print &quot; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tetrahedrons: \r
&quot;, mesh.NbTetras()</p>\r
 \r
-<p class="whs1">print &quot;Number of hexahedrons : &quot;, \r
- mesh.NbHexas()</p>\r
+<p class="whs1">print &quot; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hexahedrons \r
: &quot;, mesh.NbHexas()</p>\r
 \r
-<p class="whs1">print &quot;Number of prisms &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: \r
+<p class="whs1">print &quot; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;prisms \r
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: \r
  &quot;, mesh.NbPrisms()</p>\r
 \r
-<p class="whs1">print &quot;Number of pyramids &nbsp;&nbsp;&nbsp;: \r
+<p class="whs1">print &quot; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pyramids \r
+ &nbsp;&nbsp;&nbsp;: \r
  &quot;, mesh.NbPyramids()</p>\r
 \r
-<p class="whs1">print &quot;Number of polyhedrons : &quot;, \r
- mesh.NbPolyhedrons()</p>\r
-\r
-<p class="whs1">salome.sg.updateObjBrowser(1) </p>\r
-\r
-<p class="whs1">&nbsp;</p>\r
+<p class="whs1">print &quot; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;polyhedrons \r
+ : &quot;, mesh.NbPolyhedrons() </p>\r
 \r
 <script type="text/javascript" language="javascript1.2">\r
 <!--\r