<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
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
</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> \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("FactoryServer", \r
- "SMESH")</p>\r
+<h3><a name=bookmark>Construction of a Mesh</a></h3>\r
\r
-<p class="whs1">smeshgui = salome.ImportComponentGUI("SMESH")</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"> </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"> </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
"box")</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs2"># create a hypothesis</p>\r
-\r
-<p class="whs1">print "-------------------------- \r
- create Hypothesis"</p>\r
-\r
-<p class="whs1">print "-------------------------- \r
- NumberOfSegments"</p>\r
-\r
-<p class="whs1">numberOfSegments \r
- = 7</p>\r
-\r
-<p class="whs1">hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", \r
- "libStdMeshersEngine.so")</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
- "NumberOfSegments_10")</p>\r
-\r
-<p class="whs1">print "-------------------------- \r
- MaxElementArea"</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("MaxElementArea", \r
- "libStdMeshersEngine.so")</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
- "MaxElementArea_500")</p>\r
-\r
-<p class="whs1">print "-------------------------- \r
- MaxElementVolume"</p>\r
-\r
-<p class="whs1">maxElementVolume \r
- = 900</p>\r
-\r
-<p class="whs1">hypVolume = smesh.CreateHypothesis("MaxElementVolume", \r
- "libStdMeshersEngine.so")</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
- "MaxElementVolume_500")</p>\r
+<p class="whs2">tetra = smesh.Mesh(box, \r
+ "MeshBox")</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs2"># create algorithms</p>\r
-\r
-<p class="whs1">print "-------------------------- \r
- create Algorithms"</p>\r
+<p class="whs2">algo1D = tetra.Segment()</p>\r
\r
-<p class="whs1">print "-------------------------- \r
- Regular_1D"</p>\r
+<p class="whs2">algo1D.NumberOfSegments(7)</p>\r
\r
-<p class="whs1">regular1D = smesh.CreateHypothesis("Regular_1D", \r
- "libStdMeshersEngine.so")</p>\r
-\r
-<p class="whs1">smeshgui.SetName(salome.ObjectToID(regular1D), \r
- "Wire Discretisation")</p>\r
-\r
-<p class="whs1">print "-------------------------- \r
- MEFISTO_2D"</p>\r
+<p class="whs2"> </p>\r
\r
-<p class="whs1">mefisto2D = smesh.CreateHypothesis("MEFISTO_2D", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs2">algo2D = tetra.Triangle()</p>\r
\r
-<p class="whs1">smeshgui.SetName(salome.ObjectToID(mefisto2D), \r
- "MEFISTO_2D")</p>\r
+<p class="whs2">algo2D.MaxElementArea(800.)</p>\r
\r
<p class="whs2"> </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
- "MeshBox")</p>\r
+<p class="whs2">algo3D.MaxElementVolume(900.)</p>\r
\r
<p class="whs2"> </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 "-------------------------- \r
- add hypothesis to the box"</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"> print \r
+ "problem when computing the mesh"</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"> print \r
+ "mesh computed"</p>\r
\r
-<p class="whs1">mesh.AddHypothesis(box,mefisto2D)</p>\r
+<p class="whs2"> pass \r
+ </p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs2"># compute the mesh</p>\r
-\r
-<p class="whs1">print "-------------------------- \r
- compute the mesh of the box"</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"> print \r
- "probleme when computing the mesh"</p>\r
-\r
-<p class="whs1">salome.sg.updateObjBrowser(1)</p>\r
-\r
-<p class="whs1"> </p>\r
+<p class="whs2"> </p>\r
\r
<h3><a name=bookmark1>Construction of a Submesh</a></h3>\r
\r
-<p class="whs3"> </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"> </p>\r
\r
-<p class="whs4"># create vertices</p>\r
-\r
-<p class="whs3">Point111 = MakeVertex( 0, 0, \r
- 0)</p>\r
+<p class="whs5"># create a box</p>\r
\r
-<p class="whs3">Point211 = MakeVertex(10, 0, \r
- 0)</p>\r
+<p class="whs4">box = MakeBoxDXDYDZ(10., 10., 10.)</p>\r
\r
-<p class="whs3">Point121 = MakeVertex( 0, 10, 0)</p>\r
-\r
-<p class="whs3">Point221 = MakeVertex(10, 10, 0)</p>\r
-\r
-<p class="whs3">Point112 = MakeVertex( 0, 0, \r
- 10)</p>\r
-\r
-<p class="whs3">Point212 = MakeVertex(10, 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, "Box")</p>\r
\r
<p class="whs4"> </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, "Edge \r
+ [0,0,0 - 10,0,0]")</p>\r
\r
<p class="whs4"> </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, "Box : quadrangle \r
+ 2D mesh")</p>\r
\r
<p class="whs4"> </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"> </p>\r
\r
-<p class="whs4"># create a compound</p>\r
+<p class="whs5"># define "NumberOfSegments" \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"> </p>\r
-\r
-<p class="whs4"># add in the study</p>\r
-\r
-<p class="whs3">box_id = addToStudy(box, "Box compound")</p>\r
+<p class="whs4">algo1D.NumberOfSegments(4)</p>\r
\r
<p class="whs4"> </p>\r
\r
-<p class="whs4"># create hexahedral mesh \r
- on the box</p>\r
-\r
-<p class="whs3">hexa = smesh.Mesh(box, "Box compound \r
- : hexahedrical mesh")</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"> </p>\r
\r
-<p class="whs4"># define "NumberOfSegments" \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"> </p>\r
\r
-<p class="whs4"># creates a quadrangle \r
- 2D algorithm for the faces</p>\r
+<p class="whs5"># define "Arithmetic1D" \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"> </p>\r
\r
-<p class="whs4"># construct a submesh with \r
- a local hypothesis</p>\r
+<p class="whs5"># define "Propagation" \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"> </p>\r
-\r
-<p class="whs4"># define "Arithmetic1D" \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"> </p>\r
\r
-<p class="whs4"># define "Propagation" \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"> </p>\r
\r
-<p class="whs4"># compute the mesh</p>\r
-\r
-<p class="whs3">hexa.Compute() </p>\r
-\r
-<p class="whs3"> </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> \r
-\r
-<p class="whs3"> </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"> </p>\r
+<p class="whs4"> </p>\r
\r
-<p class="whs3">smesh = salome.lcc.FindOrLoadComponent("FactoryServer", \r
- "SMESH")</p>\r
+<p class="whs4">def PrintMeshInfo(theMesh):</p>\r
\r
-<p class="whs3">smesh.SetCurrentStudy(salome.myStudy)</p>\r
+<p class="whs4"> aMesh \r
+ = theMesh.GetMesh()</p>\r
\r
-<p class="whs3"> </p>\r
+<p class="whs4"> print \r
+ "Information about mesh:"</p>\r
\r
-<p class="whs3">box = \r
- geompy.MakeBox(0., 0., 0., 20., 20., 20.)</p>\r
+<p class="whs4"> print \r
+ "Number of nodes : \r
+ ", aMesh.NbNodes()</p>\r
\r
-<p class="whs3">idbox = geompy.addToStudy(box, "box")</p>\r
+<p class="whs4"> print \r
+ "Number of edges : \r
+ ", aMesh.NbEdges()</p>\r
\r
-<p class="whs3"> </p>\r
+<p class="whs4"> print \r
+ "Number of faces : \r
+ ", aMesh.NbFaces()</p>\r
\r
-<p class="whs3">subShapeList = geompy.SubShapeAll(box, \r
- geompy.ShapeType["EDGE"])</p>\r
+<p class="whs4"> print \r
+ "Number of volumes : \r
+ ", aMesh.NbVolumes()</p>\r
\r
-<p class="whs3">edge = \r
- subShapeList[0]</p>\r
+<p class="whs4"> pass</p>\r
\r
-<p class="whs3">name = \r
- geompy.SubShapeName(edge, box)</p>\r
-\r
-<p class="whs3">idedge = geompy.addToStudyInFather(box, \r
- edge, name)</p>\r
+<p class="whs4"> </p>\r
\r
-<p class="whs3"> </p>\r
+<p class="whs5"># create a box</p>\r
\r
-<p class="whs3">box = \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, "box")</p>\r
\r
-<p class="whs3"> </p>\r
+<p class="whs4"> </p>\r
\r
-<p class="whs3">hyp1 = smesh.CreateHypothesis("NumberOfSegments", \r
- "libStdMeshersEngine.so")</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["EDGE"])</p>\r
\r
-<p class="whs3">hyp2 = smesh.CreateHypothesis("MaxElementArea", \r
- "libStdMeshersEngine.so")</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("Arithmetic1D", \r
- "libStdMeshersEngine.so")</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"> </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("Propagation", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs4">tria = smesh.Mesh(box, "Mesh 2D")</p>\r
\r
-<p class="whs3"> </p>\r
+<p class="whs4">algo1D = tria.Segment()</p>\r
\r
-<p class="whs3">algo1 = smesh.CreateHypothesis("Regular_1D", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs4">hyp1 = algo1D.NumberOfSegments(3)</p>\r
\r
-<p class="whs3">algo2 = smesh.CreateHypothesis("MEFISTO_2D", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs4">algo2D = tria.Triangle()</p>\r
\r
-<p class="whs3"> </p>\r
+<p class="whs4">hyp2 = algo2D.MaxElementArea(10.)</p>\r
\r
-<p class="whs3">mesh = smesh.CreateMesh(box)</p>\r
+<p class="whs4"> </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"> </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"> </p>\r
+<p class="whs4">PrintMeshInfo(tria)</p>\r
\r
-<p class="whs3">smesh.Compute(mesh,box)</p>\r
+<p class="whs4"> </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"> </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"> </p>\r
\r
-<p class="whs3"> </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"> </p>\r
+<p class="whs4"> </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"> </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"> </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> \r
-\r
-<p class="whs4"> </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"> </p>\r
\r
-<p class="whs1">smesh = salome.lcc.FindOrLoadComponent("FactoryServer", \r
- "SMESH")</p>\r
+<h3><a name=bookmark3>Export of a Mesh</a></h3>\r
\r
-<p class="whs1">smeshgui = salome.ImportComponentGUI("SMESH")</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"> </p>\r
+<p class="whs6"> </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"> </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
"box")</p>\r
\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs2"># create a hypothesis</p>\r
-\r
-<p class="whs1">print "-------------------------- \r
- create Hypothesis"</p>\r
-\r
-<p class="whs1">print "-------------------------- \r
- NumberOfSegments"</p>\r
-\r
-<p class="whs1">numberOfSegments \r
- = 7</p>\r
-\r
-<p class="whs1">hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", \r
- "libStdMeshersEngine.so")</p>\r
-\r
-<p class="whs1">hypNbSeg.SetNumberOfSegments(numberOfSegments)</p>\r
-\r
-<p class="whs1">print hypNbSeg.GetName()</p>\r
+<p class="whs6"> </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
- "NumberOfSegments_10")</p>\r
-\r
-<p class="whs1">print "-------------------------- \r
- MaxElementArea"</p>\r
-\r
-<p class="whs1">maxElementArea = \r
- 800</p>\r
-\r
-<p class="whs1">hypArea = smesh.CreateHypothesis("MaxElementArea", \r
- "libStdMeshersEngine.so")</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
- "MaxElementArea_500")</p>\r
-\r
-<p class="whs1">print "-------------------------- \r
- MaxElementVolume"</p>\r
-\r
-<p class="whs1">maxElementVolume \r
- = 900</p>\r
-\r
-<p class="whs1">hypVolume = smesh.CreateHypothesis("MaxElementVolume", \r
- "libStdMeshersEngine.so")</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
- "MaxElementVolume_500")</p>\r
-\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs2"># create algorithms</p>\r
-\r
-<p class="whs1">print "-------------------------- \r
- create Algorithms"</p>\r
-\r
-<p class="whs1">print "-------------------------- \r
- Regular_1D"</p>\r
-\r
-<p class="whs1">regular1D = smesh.CreateHypothesis("Regular_1D", \r
- "libStdMeshersEngine.so")</p>\r
-\r
-<p class="whs1">smeshgui.SetName(salome.ObjectToID(regular1D), \r
- "Wire Discretisation")</p>\r
-\r
-<p class="whs1">print "-------------------------- \r
- MEFISTO_2D"</p>\r
-\r
-<p class="whs1">mefisto2D = smesh.CreateHypothesis("MEFISTO_2D", \r
- "libStdMeshersEngine.so")</p>\r
-\r
-<p class="whs1">smeshgui.SetName(salome.ObjectToID(mefisto2D), \r
- "MEFISTO_2D")</p>\r
-\r
-<p class="whs2"> </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
"MeshBox")</p>\r
\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs2"># add the hypothesis to \r
- the box</p>\r
+<p class="whs6"> </p>\r
\r
-<p class="whs1">print "-------------------------- \r
- add hypothesis to the box"</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"> </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"> </p>\r
+<p class="whs7"> </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 "-------------------------- \r
- compute the mesh of the box"</p>\r
+<p class="whs7">algo3D.MaxElementVolume(900.)</p>\r
\r
-<p class="whs1">ret = smesh.Compute(mesh,box)</p>\r
+<p class="whs6"> </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"> print \r
- "probleme when computing the mesh"</p>\r
+<p class="whs6"> </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("/tmp/meshMED.med",0)</p>\r
-\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs4"> </p>\r
+<p class="whs7">tetra.ExportMED("/tmp/meshMED.med", \r
+ 0) </p>\r
\r
<script type="text/javascript" language="javascript1.2">\r
<!--\r
\r
<p> </p>\r
\r
-<p class="whs2">from geompy import \r
- *</p>\r
+<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">import \r
+ geompy</span></p>\r
\r
<p class="whs2">import smesh</p>\r
\r
-<p> </p>\r
-\r
-<p># create vertices</p>\r
-\r
-<p class="whs2">Point111 = MakeVertex( \r
- 0, 0, 0)</p>\r
-\r
-<p class="whs2">Point211 = MakeVertex(10, \r
- 0, 0)</p>\r
-\r
-<p class="whs2">Point121 = MakeVertex( \r
- 0, 10, 0)</p>\r
-\r
-<p class="whs2">Point221 = MakeVertex(10, \r
- 10, 0)</p>\r
-\r
-<p class="whs2">Point112 = MakeVertex( \r
- 0, 0, 10)</p>\r
-\r
-<p class="whs2">Point212 = MakeVertex(10, \r
- 0, 10)</p>\r
-\r
-<p class="whs2">Point122 = MakeVertex( \r
- 0, 10, 10)</p>\r
-\r
-<p class="whs2">Point222 = MakeVertex(10, \r
- 10, 10)</p>\r
-\r
-<p> </p>\r
-\r
-<p># create edges</p>\r
-\r
-<p class="whs2">EdgeX111 = MakeEdge(Point111, \r
- Point211)</p>\r
-\r
-<p class="whs2">EdgeX121 = MakeEdge(Point121, \r
- Point221)</p>\r
-\r
-<p class="whs2">EdgeX112 = MakeEdge(Point112, \r
- Point212)</p>\r
-\r
-<p class="whs2">EdgeX122 = MakeEdge(Point122, \r
- Point222)</p>\r
-\r
-<p class="whs2">EdgeY11 = MakeEdge(Point111, \r
- Point121)</p>\r
-\r
-<p class="whs2">EdgeY21 = MakeEdge(Point211, \r
- Point221)</p>\r
-\r
-<p class="whs2">EdgeY12 = MakeEdge(Point112, \r
- Point122)</p>\r
-\r
-<p class="whs2">EdgeY22 = MakeEdge(Point212, \r
- Point222)</p>\r
-\r
-<p class="whs2">EdgeZ111 = MakeEdge(Point111, \r
- Point112)</p>\r
-\r
-<p class="whs2">EdgeZ211 = MakeEdge(Point211, \r
- Point212)</p>\r
-\r
-<p class="whs2">EdgeZ121 = MakeEdge(Point121, \r
- Point122)</p>\r
-\r
-<p class="whs2">EdgeZ221 = MakeEdge(Point221, \r
- Point222)</p>\r
-\r
-<p> </p>\r
-\r
-<p># create faces</p>\r
-\r
-<p class="whs2">FaceX11 = MakeQuad(EdgeY11, \r
- EdgeZ111, EdgeY12, EdgeZ121)</p>\r
-\r
-<p class="whs2">FaceX21 = MakeQuad(EdgeY21, \r
- EdgeZ211, EdgeY22, EdgeZ221)</p>\r
-\r
-<p class="whs2">FaceY111 = MakeQuad(EdgeX111, \r
- EdgeZ111, EdgeX112, EdgeZ211)</p>\r
-\r
-<p class="whs2">FaceY121 = MakeQuad(EdgeX121, \r
- EdgeZ121, EdgeX122, EdgeZ221)</p>\r
-\r
-<p class="whs2">FaceZ11 = MakeQuad(EdgeX111, \r
- EdgeY11, EdgeX121, EdgeY21)</p>\r
-\r
-<p class="whs2">FaceZ12 = MakeQuad(EdgeX112, \r
- EdgeY12, EdgeX122, EdgeY22)</p>\r
-\r
-<p> </p>\r
-\r
-<p># create a solid</p>\r
-\r
-<p class="whs2">Block = MakeHexa(FaceX11, \r
- FaceX21, FaceY111, FaceY121, FaceZ11, FaceZ12)</p>\r
-\r
-<p> </p>\r
+<p class="whs2"> </p>\r
\r
-<p># create a compound</p>\r
+<p class="whs3"># create a box</p>\r
\r
-<p class="whs2">box = MakeCompound([Block])</p>\r
+<p class="whs2">box = geompy.MakeBoxDXDYDZ(10., \r
+ 10., 10.)</p>\r
\r
-<p> </p>\r
+<p class="whs2">geompy.addToStudy(box, \r
+ "Box")</p>\r
\r
-<p># add in the study</p>\r
+<p class="whs2"> </p>\r
\r
-<p class="whs2">box_id = addToStudy(box, \r
- "Box compound")</p>\r
+<p class="whs3"># create a hexahedral \r
+ mesh on the box</p>\r
\r
-<p> </p>\r
+<p class="whs2">hexa = smesh.Mesh(box, \r
+ "Box : hexahedrical mesh")</p>\r
\r
-<p># create a hexahedral mesh on the box</p>\r
+<p class="whs2"> </p>\r
\r
-<p class="whs2">hexa = smesh.Mesh(box, \r
- "Box compound : hexahedrical mesh")</p>\r
+<p class="whs3"># create a Regular 1D \r
+ algorithm for edges</p>\r
\r
-<p class="whs2">algo = hexa.Segment()</p>\r
+<p class="whs2">algo1D = hexa.Segment()</p>\r
\r
-<p> </p>\r
+<p class="whs2"> </p>\r
\r
-<p># define "NumberOfSegments" hypothesis to cut an edge in a \r
- fixed number of segments</p>\r
+<p class="whs3"># define "Arithmetic1D" \r
+ hypothesis to cut all edges in several segments with increasing arithmetic \r
+ length </p>\r
\r
-<p class="whs2">algo.NumberOfSegments(4)</p>\r
+<p class="whs2">algo1D.Arithmetic1D(1, \r
+ 4)</p>\r
\r
-<p> </p>\r
+<p class="whs2"> </p>\r
\r
-<p># create a quadrangle 2D algorithm for faces</p>\r
+<p class="whs3"># create a quadrangle \r
+ 2D algorithm for faces</p>\r
\r
<p class="whs2">hexa.Quadrangle()</p>\r
\r
-<p> </p>\r
+<p class="whs2"> </p>\r
\r
-<p># create a hexahedron 3D algorithm for solids</p>\r
+<p class="whs3"># create a hexahedron \r
+ 3D algorithm for solids</p>\r
\r
<p class="whs2">hexa.Hexahedron()</p>\r
\r
-<p> </p>\r
-\r
-<p># create a local hypothesis</p>\r
-\r
-<p class="whs2">algo = hexa.Segment(EdgeX111)</p>\r
-\r
-<p> </p>\r
-\r
-<p># define "Arithmetic1D" hypothesis to cut an edge in several \r
- segments with arithmetic length increasing</p>\r
-\r
-<p class="whs2">algo.Arithmetic1D(1, \r
- 4)</p>\r
-\r
-<p> </p>\r
-\r
-<p># define "Propagation" hypothesis that propagates all other \r
- hypothesis on all edges on the opposite side in case of quadrangular faces</p>\r
-\r
-<p class="whs2">algo.Propagation()</p>\r
-\r
-<p> </p>\r
+<p class="whs2"> </p>\r
\r
-<p># compute the mesh</p>\r
+<p class="whs3"># compute the mesh</p>\r
\r
<p class="whs2">hexa.Compute() </p>\r
\r
\r
<h4><a name=bookmark9>Deflection 1D and Number of Segments</a></h4>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">import \r
+ geompy</span></p>\r
\r
<p class="whs2">import smesh</p>\r
\r
-<p class="whs2">import geompy</p>\r
-\r
-<p class="whs2">import salome</p>\r
-\r
-<p class="whs2">gg = salome.ImportComponentGUI("GEOM")</p>\r
-\r
<p class="whs2"> </p>\r
\r
-<p class="whs3"># create vertices</p>\r
+<p class="whs3"># create a face from \r
+ arc and straight segment</p>\r
+\r
+<p class="whs2">px = geompy.MakeVertex(100., \r
+ 0. , 0. \r
+ )</p>\r
\r
-<p class="whs2">px = \r
- geompy.MakeVertex(100., 0. , \r
+<p class="whs2">py = geompy.MakeVertex(0. \r
+ , 100., \r
0. )</p>\r
\r
-<p class="whs2">py = \r
- geompy.MakeVertex(0. , \r
- 100., 0. )</p>\r
-\r
-<p class="whs2">pz = \r
- geompy.MakeVertex(0. , \r
- 0. , 100.)</p>\r
+<p class="whs2">pz = geompy.MakeVertex(0. \r
+ , 0. , \r
+ 100.)</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs3"># create a vector from \r
- two points</p>\r
-\r
-<p class="whs2">vxy = geompy.MakeVector(px, \r
+<p class="whs2">exy = geompy.MakeEdge(px, \r
py)</p>\r
\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs3"># create an arc from \r
- three points</p>\r
-\r
<p class="whs2">arc = geompy.MakeArc(py, \r
pz, px)</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs3"># create a wire</p>\r
-\r
-<p class="whs2">wire = geompy.MakeWire([vxy, \r
+<p class="whs2">wire = geompy.MakeWire([exy, \r
arc])</p>\r
\r
-<p class="whs2">isPlanarFace = 1</p>\r
-\r
<p class="whs2"> </p>\r
\r
-<p class="whs3"># create a face from \r
- the wire</p>\r
+<p class="whs2">isPlanarFace = 1</p>\r
\r
<p class="whs2">face1 = geompy.MakeFace(wire, \r
isPlanarFace)</p>\r
\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs3"><span style="font-family: 'Times New Roman', serif;"># \r
- get edges from the face</span></p>\r
-\r
-<p class="whs2">vxy,arc = geompy.SubShapeAll(face1,geompy.ShapeType["EDGE"])</p>\r
-\r
-<p class="whs3"> </p>\r
-\r
-<p class="whs3"># add objects in the \r
- study</p>\r
-\r
-<p class="whs2">id_face1 = geompy.addToStudy(face1,"Face1")</p>\r
-\r
-<p class="whs2">id_arc = geompy.addToStudyInFather(face1,arc,"Arc \r
- Edge")</p>\r
+<p class="whs2">geompy.addToStudy(face1,"Face1")</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs3"># display faces</p>\r
+<p class="whs3"># get edges from the \r
+ face</p>\r
\r
-<p class="whs2">gg.createAndDisplayGO(id_face1)</p>\r
+<p class="whs2">e_straight,e_arc = \r
+ geompy.SubShapeAll(face1, geompy.ShapeType["EDGE"])</p>\r
\r
-<p class="whs2">gg.setDisplayMode(id_face1,1)</p>\r
-\r
-<p class="whs2">gg.setTransparency(id_face1,0.2)</p>\r
+<p class="whs2">geompy.addToStudyInFather(face1, \r
+ e_arc, "Arc Edge")</p>\r
\r
<p class="whs2"> </p>\r
\r
<p class="whs3"># create hexahedral mesh</p>\r
\r
<p class="whs2">hexa = smesh.Mesh(face1, \r
- "Face compound : hexahedrical mesh")</p>\r
-\r
-<p class="whs2">algo = hexa.Triangle()</p>\r
+ "Face : triangle mesh")</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs3"># define "MaxElementArea" \r
- hypothesis</p>\r
-\r
-<p class="whs2">algo.MaxElementArea(30)</p>\r
-\r
-<p class="whs2"> </p>\r
+<p class="whs3"># define "NumberOfSegments" \r
+ hypothesis to cut a straight edge in a fixed number of segments</p>\r
\r
-<p class="whs3"># create a local hypothesis \r
- on the wire</p>\r
+<p class="whs2">algo1D = hexa.Segment()</p>\r
\r
-<p class="whs2">algo = hexa.Segment(wire)</p>\r
+<p class="whs2">algo1D.NumberOfSegments(6)</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs3"># define "NumberOfSegments" \r
- hypothesis to cut a straight edge in a fixed number of segments</p>\r
+<p class="whs3"># define "MaxElementArea" \r
+ hypothesis</p>\r
+\r
+<p class="whs2">algo2D = hexa.Triangle()</p>\r
\r
-<p class="whs2">algo.NumberOfSegments(6)</p>\r
+<p class="whs2">algo2D.MaxElementArea(70.0)</p>\r
\r
<p class="whs2"> </p>\r
\r
<p class="whs3"># define a local "Deflection1D" \r
hypothesis on the arc</p>\r
\r
-<p class="whs2">algo = hexa.Segment(arc)</p>\r
+<p class="whs2">algo_local = hexa.Segment(e_arc)</p>\r
\r
-<p class="whs2">algo.Deflection1D(1)</p>\r
-\r
-<p class="whs2"> </p>\r
+<p class="whs2">algo_local.Deflection1D(1.0)</p>\r
\r
<p class="whs2"> </p>\r
\r
\r
<p class="whs2">hexa.Compute() </p>\r
\r
-<p> </p>\r
-\r
<h4><a name=bookmark2>Start and End Length</a></h4>\r
\r
-<p class="whs2">from geompy import \r
- *</p>\r
+<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">from \r
+ geompy import *</span></p>\r
\r
<p class="whs2">import smesh</p>\r
\r
-<p> </p>\r
-\r
-<p># create vertices</p>\r
-\r
-<p class="whs2">Point111 = MakeVertex( \r
- 0, 0, 0)</p>\r
-\r
-<p class="whs2">Point211 = MakeVertex(10, \r
- 0, 0)</p>\r
-\r
-<p class="whs2">Point121 = MakeVertex( \r
- 0, 10, 0)</p>\r
-\r
-<p class="whs2">Point221 = MakeVertex(10, \r
- 10, 0)</p>\r
-\r
-<p class="whs2">Point112 = MakeVertex( \r
- 0, 0, 10)</p>\r
-\r
-<p class="whs2">Point212 = MakeVertex(10, \r
- 0, 10)</p>\r
-\r
-<p class="whs2">Point122 = MakeVertex( \r
- 0, 10, 10)</p>\r
-\r
-<p class="whs2">Point222 = MakeVertex(10, \r
- 10, 10)</p>\r
-\r
-<p> </p>\r
-\r
-<p># create edges</p>\r
-\r
-<p class="whs2">EdgeX111 = MakeEdge(Point111, \r
- Point211)</p>\r
-\r
-<p class="whs2">EdgeX121 = MakeEdge(Point121, \r
- Point221)</p>\r
-\r
-<p class="whs2">EdgeX112 = MakeEdge(Point112, \r
- Point212)</p>\r
-\r
-<p class="whs2">EdgeX122 = MakeEdge(Point122, \r
- Point222)</p>\r
-\r
-<p class="whs2">EdgeY11 = MakeEdge(Point111, \r
- Point121)</p>\r
-\r
-<p class="whs2">EdgeY21 = MakeEdge(Point211, \r
- Point221)</p>\r
-\r
-<p class="whs2">EdgeY12 = MakeEdge(Point112, \r
- Point122)</p>\r
-\r
-<p class="whs2">EdgeY22 = MakeEdge(Point212, \r
- Point222)</p>\r
-\r
-<p class="whs2">EdgeZ111 = MakeEdge(Point111, \r
- Point112)</p>\r
-\r
-<p class="whs2">EdgeZ211 = MakeEdge(Point211, \r
- Point212)</p>\r
-\r
-<p class="whs2">EdgeZ121 = MakeEdge(Point121, \r
- Point122)</p>\r
-\r
-<p class="whs2">EdgeZ221 = MakeEdge(Point221, \r
- Point222)</p>\r
-\r
-<p> </p>\r
-\r
-<p># create faces</p>\r
-\r
-<p class="whs2">FaceX11 = MakeQuad(EdgeY11, \r
- EdgeZ111, EdgeY12, EdgeZ121)</p>\r
-\r
-<p class="whs2">FaceX21 = MakeQuad(EdgeY21, \r
- EdgeZ211, EdgeY22, EdgeZ221)</p>\r
-\r
-<p class="whs2">FaceY111 = MakeQuad(EdgeX111, \r
- EdgeZ111, EdgeX112, EdgeZ211)</p>\r
-\r
-<p class="whs2">FaceY121 = MakeQuad(EdgeX121, \r
- EdgeZ121, EdgeX122, EdgeZ221)</p>\r
-\r
-<p class="whs2">FaceZ11 = MakeQuad(EdgeX111, \r
- EdgeY11, EdgeX121, EdgeY21)</p>\r
-\r
-<p class="whs2">FaceZ12 = MakeQuad(EdgeX112, \r
- EdgeY12, EdgeX122, EdgeY22)</p>\r
-\r
-<p> </p>\r
+<p class="whs2"> </p>\r
\r
-<p># create a solid</p>\r
+<p class="whs3"># create a box</p>\r
\r
-<p class="whs2">Block = MakeHexa(FaceX11, \r
- FaceX21, FaceY111, FaceY121, FaceZ11, FaceZ12)</p>\r
+<p class="whs2">box = MakeBoxDXDYDZ(10., \r
+ 10., 10.)</p>\r
\r
-<p> </p>\r
+<p class="whs2">addToStudy(box, "Box")</p>\r
\r
-<p># create a compound</p>\r
+<p class="whs2"> </p>\r
\r
-<p class="whs2">box = MakeCompound([Block])</p>\r
+<p class="whs3"># get one edge of the \r
+ box to put local hypothesis on</p>\r
\r
-<p> </p>\r
+<p class="whs2">p5 = MakeVertex(5., \r
+ 0., 0.)</p>\r
\r
-<p># add in the study</p>\r
+<p class="whs2">EdgeX = GetEdgeNearPoint(box, \r
+ p5)</p>\r
\r
-<p class="whs2">box_id = addToStudy(box, \r
- "Box compound")</p>\r
+<p class="whs2">addToStudyInFather(box, \r
+ EdgeX, "Edge [0,0,0 - 10,0,0]")</p>\r
\r
-<p> </p>\r
+<p class="whs2"> </p>\r
\r
-<p># create a hexahedral mesh on the box</p>\r
+<p class="whs3"># create a hexahedral \r
+ mesh on the box</p>\r
\r
<p class="whs2">hexa = smesh.Mesh(box, \r
- "Box compound : hexahedrical mesh")</p>\r
-\r
-<p class="whs2">algo = hexa.Segment()</p>\r
-\r
-<p> </p>\r
-\r
-<p># define "NumberOfSegments" hypothesis to cut an edge in a \r
- fixed number of segments</p>\r
+ "Box : hexahedrical mesh")</p>\r
\r
-<p class="whs2">algo.NumberOfSegments(4)</p>\r
+<p class="whs2"> </p>\r
\r
-<p> </p>\r
+<p class="whs3"># set algorithms</p>\r
\r
-<p># create a quadrangle 2D algorithm for faces</p>\r
+<p class="whs2">algo1D = hexa.Segment()</p>\r
\r
<p class="whs2">hexa.Quadrangle()</p>\r
\r
-<p> </p>\r
-\r
-<p># create a hexahedron 3D algorithm for solids</p>\r
-\r
<p class="whs2">hexa.Hexahedron()</p>\r
\r
-<p> </p>\r
-\r
-<p># create a local hypothesis</p>\r
-\r
-<p class="whs2">algo = hexa.Segment(EdgeX111)</p>\r
-\r
-<p> </p>\r
-\r
-<p># define "StartEndLength" hypothesis to cut an edge in several \r
- segments with increasing geometric length </p>\r
-\r
-<p class="whs2">algo.StartEndLength(1, \r
- 6)</p>\r
-\r
-<p> </p>\r
-\r
-<p># define "Propagation" hypothesis that propagates all other \r
- hypothesis on all edges on the opposite side in case of quadrangular faces</p>\r
-\r
-<p class="whs2">algo.Propagation()</p>\r
-\r
-<p> </p>\r
-\r
-<p># compute the mesh</p>\r
-\r
-<p class="whs2">hexa.Compute() </p>\r
-\r
<p class="whs2"> </p>\r
\r
-<h4><a name=bookmark3>Average Length</a></h4>\r
-\r
-<p class="whs2">from geompy import \r
- *</p>\r
+<p class="whs3"># define "NumberOfSegments" \r
+ hypothesis to cut an edge in a fixed number of segments</p>\r
\r
-<p class="whs2">import smesh</p>\r
+<p class="whs2">algo1D.NumberOfSegments(4)</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs3"># create vertices</p>\r
-\r
-<p class="whs2">Point111 = MakeVertex( \r
- 0, 0, 0)</p>\r
-\r
-<p class="whs2">Point211 = MakeVertex(10, \r
- 0, 0)</p>\r
-\r
-<p class="whs2">Point121 = MakeVertex( \r
- 0, 10, 0)</p>\r
-\r
-<p class="whs2">Point221 = MakeVertex(10, \r
- 10, 0)</p>\r
-\r
-<p class="whs2">Point112 = MakeVertex( \r
- 0, 0, 10)</p>\r
-\r
-<p class="whs2">Point212 = MakeVertex(10, \r
- 0, 10)</p>\r
-\r
-<p class="whs2">Point122 = MakeVertex( \r
- 0, 10, 10)</p>\r
+<p class="whs3"># create a local hypothesis</p>\r
\r
-<p class="whs2">Point222 = MakeVertex(10, \r
- 10, 10)</p>\r
+<p class="whs2">algo_local = hexa.Segment(EdgeX)</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs3"># create edges</p>\r
-\r
-<p class="whs2">EdgeX111 = MakeEdge(Point111, \r
- Point211)</p>\r
+<p class="whs3"># define "StartEndLength" \r
+ hypothesis to cut an edge in several segments with increasing geometric \r
+ length</p>\r
\r
-<p class="whs2">EdgeX121 = MakeEdge(Point121, \r
- Point221)</p>\r
-\r
-<p class="whs2">EdgeX112 = MakeEdge(Point112, \r
- Point212)</p>\r
-\r
-<p class="whs2">EdgeX122 = MakeEdge(Point122, \r
- Point222)</p>\r
-\r
-<p class="whs2">EdgeY11 = MakeEdge(Point111, \r
- Point121)</p>\r
-\r
-<p class="whs2">EdgeY21 = MakeEdge(Point211, \r
- Point221)</p>\r
-\r
-<p class="whs2">EdgeY12 = MakeEdge(Point112, \r
- Point122)</p>\r
-\r
-<p class="whs2">EdgeY22 = MakeEdge(Point212, \r
- Point222)</p>\r
+<p class="whs2">algo_local.StartEndLength(1, \r
+ 6)</p>\r
\r
-<p class="whs2">EdgeZ111 = MakeEdge(Point111, \r
- Point112)</p>\r
+<p class="whs2"> </p>\r
\r
-<p class="whs2">EdgeZ211 = MakeEdge(Point211, \r
- Point212)</p>\r
+<p class="whs3"># define "Propagation" \r
+ hypothesis that propagates all other hypothesis</p>\r
\r
-<p class="whs2">EdgeZ121 = MakeEdge(Point121, \r
- Point122)</p>\r
+<p class="whs3"># on all edges on the \r
+ opposite side in case of quadrangular faces</p>\r
\r
-<p class="whs2">EdgeZ221 = MakeEdge(Point221, \r
- Point222)</p>\r
+<p class="whs2">algo_local.Propagation()</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs3"># create faces</p>\r
-\r
-<p class="whs2">FaceX11 = MakeQuad(EdgeY11, \r
- EdgeZ111, EdgeY12, EdgeZ121)</p>\r
-\r
-<p class="whs2">FaceX21 = MakeQuad(EdgeY21, \r
- EdgeZ211, EdgeY22, EdgeZ221)</p>\r
+<p class="whs3"># compute the mesh</p>\r
\r
-<p class="whs2">FaceY111 = MakeQuad(EdgeX111, \r
- EdgeZ111, EdgeX112, EdgeZ211)</p>\r
+<p class="whs2">hexa.Compute() </p>\r
\r
-<p class="whs2">FaceY121 = MakeQuad(EdgeX121, \r
- EdgeZ121, EdgeX122, EdgeZ221)</p>\r
+<h4><a name=bookmark3>Average Length</a></h4>\r
\r
-<p class="whs2">FaceZ11 = MakeQuad(EdgeX111, \r
- EdgeY11, EdgeX121, EdgeY21)</p>\r
+<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">from \r
+ geompy import *</span></p>\r
\r
-<p class="whs2">FaceZ12 = MakeQuad(EdgeX112, \r
- EdgeY12, EdgeX122, EdgeY22)</p>\r
+<p class="whs2">import smesh</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs3"># create a solid</p>\r
+<p class="whs3"># create a box</p>\r
\r
-<p class="whs2">Block = MakeHexa(FaceX11, \r
- FaceX21, FaceY111, FaceY121, FaceZ11, FaceZ12)</p>\r
+<p class="whs2">box = MakeBoxDXDYDZ(10., \r
+ 10., 10.)</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs2">addToStudy(box, "Box")</p>\r
\r
-<p class="whs3"># create a compound</p>\r
+<p class="whs2"> </p>\r
\r
-<p class="whs2">box = MakeCompound([Block])</p>\r
+<p class="whs3"># get one edge of the \r
+ box to put local hypothesis on</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs2">p5 = MakeVertex(5., \r
+ 0., 0.)</p>\r
\r
-<p class="whs3"># add in the study</p>\r
+<p class="whs2">EdgeX = GetEdgeNearPoint(box, \r
+ p5)</p>\r
\r
-<p class="whs2">box_id = addToStudy(box, \r
- "Box compound")</p>\r
+<p class="whs2">addToStudyInFather(box, \r
+ EdgeX, "Edge [0,0,0 - 10,0,0]")</p>\r
\r
<p class="whs2"> </p>\r
\r
mesh on the box</p>\r
\r
<p class="whs2">hexa = smesh.Mesh(box, \r
- "Box compound : hexahedrical mesh")</p>\r
-\r
-<p class="whs2">algo = hexa.Segment()</p>\r
+ "Box : hexahedrical mesh")</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs3"># define "NumberOfSegments" \r
- hypothesis to cut an edge in a fixed number of segments</p>\r
-\r
-<p class="whs2">algo.NumberOfSegments(4)</p>\r
-\r
-<p class="whs2"> </p>\r
+<p class="whs3"># set algorithms</p>\r
\r
-<p class="whs3"># create a quadrangle \r
- 2D algorithm for faces</p>\r
+<p class="whs2">algo1D = hexa.Segment()</p>\r
\r
<p class="whs2">hexa.Quadrangle()</p>\r
\r
+<p class="whs2">hexa.Hexahedron()</p>\r
+\r
<p class="whs2"> </p>\r
\r
-<p class="whs3"># create a hexahedron \r
- 3D algorithm for solids</p>\r
+<p class="whs3"># define "NumberOfSegments" \r
+ hypothesis to cut all edges in a fixed number of segments</p>\r
\r
-<p class="whs2">hexa.Hexahedron()</p>\r
+<p class="whs2">algo1D.NumberOfSegments(4)</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs3"># create a local hypothesis</p>\r
+<p class="whs3"># create a sub-mesh</p>\r
\r
-<p class="whs2">algo = hexa.Segment(EdgeX111)</p>\r
+<p class="whs2">algo_local = hexa.Segment(EdgeX)</p>\r
\r
<p class="whs2"> </p>\r
\r
<p class="whs3"># define "LocalLength" \r
hypothesis to cut an edge in several segments with the same length</p>\r
\r
-<p class="whs2">algo.LocalLength(2)</p>\r
+<p class="whs2">algo_local.LocalLength(2.)</p>\r
\r
<p class="whs2"> </p>\r
\r
<p class="whs3"># define "Propagation" \r
- hypothesis that propagates all other hypothesis on all edges on<span style="font-family: 'Times New Roman', serif;"> \r
- the opposite side in case of quadrangular faces</span></p>\r
+ hypothesis that propagates all other hypothesis</p>\r
\r
-<p class="whs2">algo.Propagation()</p>\r
+<p class="whs3"># on all edges on the \r
+ opposite side in case of quadrangular faces</p>\r
+\r
+<p class="whs2">algo_local.Propagation()</p>\r
\r
<p class="whs2"> </p>\r
\r
\r
<p class="whs2">hexa.Compute() </p>\r
\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs2"> </p>\r
-\r
<h3>Defining 2D and 3D hypotheses</h3>\r
\r
<h4><a name=bookmark4>Maximum Element Area</a></h4>\r
<p class="whs4"><span style="font-family: 'Lucida Console', monospace;">import \r
smesh</span></p>\r
\r
-<p class="whs4">import geompy</p>\r
-\r
<p class="whs4">import salome</p>\r
\r
<p class="whs4"> </p>\r
\r
<h4><a name=bookmark5>Maximum Element Volume</a></h4>\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> \r
-\r
<p class="whs4"><span style="font-family: 'Lucida Console', monospace;">import \r
- salome</span></p>\r
-\r
-<p class="whs4">import geompy</p>\r
-\r
-<p class="whs4">import StdMeshers</p>\r
+ geompy</span></p>\r
\r
-<p class="whs4">import NETGENPlugin</p>\r
+<p class="whs4">import smesh</p>\r
\r
<p class="whs4"> </p>\r
\r
-<p class="whs4">smesh = salome.lcc.FindOrLoadComponent("FactoryServer", \r
- "SMESH")</p>\r
+<p class="whs5"># create a cylinder</p>\r
\r
-<p class="whs4">smeshgui = salome.ImportComponentGUI("SMESH")</p>\r
+<p class="whs4">cyl = geompy.MakeCylinderRH(30., \r
+ 50.)</p>\r
\r
-<p class="whs4">smeshgui.Init(salome.myStudyId);</p>\r
+<p class="whs4">geompy.addToStudy(cyl, \r
+ "cyl")</p>\r
\r
<p class="whs4"> </p>\r
\r
-<p class="whs5"># create a box</p>\r
+<p class="whs5"># create a mesh on \r
+ the cylinder</p>\r
\r
-<p class="whs4">box = geompy.MakeCylinderRH(30, \r
- 50) #MakeBox(0., 0., 0., </p>\r
-\r
-<p class="whs4">100., 200., 300.)</p>\r
+<p class="whs4">tetra = smesh.Mesh(cyl, \r
+ "Cylinder : tetrahedrical mesh")</p>\r
\r
<p class="whs4"> </p>\r
\r
-<p class="whs5"># add the box in the \r
- study</p>\r
-\r
-<p class="whs4">idbox = geompy.addToStudy(box, \r
- "box")</p>\r
-\r
-<p class="whs4"> </p>\r
-\r
-<p class="whs5"># create a set of hypotheses</p>\r
-\r
-<p class="whs5"> </p>\r
-\r
-<p class="whs5"># Number of Segments</p>\r
-\r
-<p class="whs4">numberOfSegments \r
- = 7</p>\r
-\r
-<p class="whs4">hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs5"># assign algorithms</p>\r
\r
-<p class="whs4">hypNbSeg.SetNumberOfSegments(numberOfSegments)</p>\r
+<p class="whs4">algo1D = tetra.Segment()</p>\r
\r
-<p class="whs4">print hypNbSeg.GetName()</p>\r
+<p class="whs4">algo2D = tetra.Triangle()</p>\r
\r
-<p class="whs4">print hypNbSeg.GetNumberOfSegments()</p>\r
-\r
-<p class="whs4">smeshgui.SetName(salome.ObjectToID(hypNbSeg), \r
- "NumberOfSegments_7")</p>\r
+<p class="whs4">algo3D = tetra.Tetrahedron(smesh.NETGEN)</p>\r
\r
<p class="whs4"> </p>\r
\r
-<p class="whs5"># Max Element Area</p>\r
-\r
-<p class="whs4">maxElementArea = \r
- 800</p>\r
-\r
-<p class="whs4">hypArea = smesh.CreateHypothesis("MaxElementArea", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs5"># assign 1D and 2D \r
+ hypotheses</p>\r
\r
-<p class="whs4">hypArea.SetMaxElementArea(maxElementArea)</p>\r
+<p class="whs4">algo1D.NumberOfSegments(7)</p>\r
\r
-<p class="whs4">print hypArea.GetName()</p>\r
-\r
-<p class="whs4">print hypArea.GetMaxElementArea()</p>\r
-\r
-<p class="whs4">smeshgui.SetName(salome.ObjectToID(hypArea), \r
- "MaxElementArea_800")</p>\r
+<p class="whs4">algo2D.MaxElementArea(150.)</p>\r
\r
<p class="whs4"> </p>\r
\r
-<p class="whs5"># Max Element Volume</p>\r
-\r
-<p class="whs4">maxElementVolume \r
- = 900</p>\r
-\r
-<p class="whs4">hypVolume = smesh.CreateHypothesis("MaxElementVolume", \r
- "libStdMeshersEngine.so")</p>\r
-\r
-<p class="whs4">hypVolume.SetMaxElementVolume(maxElementVolume)</p>\r
-\r
-<p class="whs4">print hypVolume.GetName()</p>\r
-\r
-<p class="whs4">print hypVolume.GetMaxElementVolume()</p>\r
-\r
-<p class="whs4">smeshgui.SetName(salome.ObjectToID(hypVolume), \r
- "MaxElementVolume_900")</p>\r
-\r
-<p class="whs4"> </p>\r
-\r
-<p class="whs5"># create a set of algorithms</p>\r
-\r
-<p class="whs5"> </p>\r
-\r
-<p class="whs5"># Regular_1D</p>\r
-\r
-<p class="whs4">regular1D = smesh.CreateHypothesis("Regular_1D", \r
- "libStdMeshersEngine.so")</p>\r
-\r
-<p class="whs4">smeshgui.SetName(salome.ObjectToID(regular1D), \r
- "Wire Discretisation")</p>\r
-\r
-<p class="whs4"> </p>\r
-\r
-<p class="whs5"># MEFISTO_2D</p>\r
-\r
-<p class="whs4">mefisto2D = smesh.CreateHypothesis("MEFISTO_2D", \r
- "libStdMeshersEngine.so")</p>\r
-\r
-<p class="whs4">smeshgui.SetName(salome.ObjectToID(mefisto2D), \r
- "MEFISTO_2D")</p>\r
-\r
-<p class="whs4"> </p>\r
-\r
-<p class="whs5"># NETGEN_3D (Tetrahedron \r
- meshing algorithm)</p>\r
-\r
-<p class="whs4">tetra3D = smesh.CreateHypothesis("NETGEN_3D", \r
- "libNETGENEngine.so")</p>\r
-\r
-<p class="whs4">smeshgui.SetName(salome.ObjectToID(tetra3D), \r
- "NETGEN_3D")</p>\r
-\r
-<p class="whs4"> </p>\r
-\r
-<p class="whs5"># initialize a mesh \r
- with the box</p>\r
-\r
-<p class="whs4">mesh = smesh.CreateMesh(box)</p>\r
-\r
-<p class="whs4">smeshgui.SetName(salome.ObjectToID(mesh), \r
- "MeshBox")</p>\r
-\r
-<p class="whs4"> </p>\r
-\r
-<p class="whs5"># add hypotheses and \r
- algorithms to the box</p>\r
-\r
-<p class="whs4">mesh.AddHypothesis(box,hypNbSeg)</p>\r
-\r
-<p class="whs4">mesh.AddHypothesis(box,hypArea)</p>\r
-\r
-<p class="whs4">mesh.AddHypothesis(box,hypVolume)</p>\r
-\r
-<p class="whs4">mesh.AddHypothesis(box,regular1D)</p>\r
-\r
-<p class="whs4">mesh.AddHypothesis(box,mefisto2D)</p>\r
+<p class="whs5"># assign Max Element \r
+ Volume hypothesis</p>\r
\r
-<p class="whs4">mesh.AddHypothesis(box,tetra3D)</p>\r
+<p class="whs4">algo3D.MaxElementVolume(200.)</p>\r
\r
<p class="whs4"> </p>\r
\r
<p class="whs5"># compute the mesh</p>\r
\r
-<p class="whs4">ret = smesh.Compute(mesh,box)</p>\r
+<p class="whs4">ret = tetra.Compute()</p>\r
\r
<p class="whs4">if ret == 0:</p>\r
\r
<p class="whs4">else:</p>\r
\r
<p class="whs4"> print \r
- "Computation succeded"</p>\r
-\r
-<p class="whs4">salome.sg.updateObjBrowser(1) \r
- </p>\r
-\r
-<p class="whs4"> </p>\r
+ "Computation succeded" </p>\r
\r
<h4><a name=bookmark6>Length from Edges</a></h4>\r
\r
<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">import \r
- salome</span></p>\r
-\r
-<p class="whs2">import geompy</p>\r
+ geompy</span></p>\r
\r
<p class="whs2">import smesh</p>\r
\r
<p class="whs2">sketcher2 = geompy.MakeSketcher("Sketcher:F \r
20 20:TT 50 20:TT 50 50:TT 20 50:WW")</p>\r
\r
-<p class="whs2">isPlanarFace = 1</p>\r
-\r
<p class="whs2"> </p>\r
\r
<p class="whs3"># create a face from \r
two wires</p>\r
\r
-<p class="whs2">face1 = geompy.MakeFaces([sketcher1, \r
- sketcher2],isPlanarFace)</p>\r
-\r
-<p class="whs2"> </p>\r
+<p class="whs2">isPlanarFace = 1</p>\r
\r
-<p class="whs3"># add object in the study</p>\r
+<p class="whs2">face1 = geompy.MakeFaces([sketcher1, \r
+ sketcher2], isPlanarFace)</p>\r
\r
-<p class="whs2">id_face1 = geompy.addToStudy(face1,"Face1")</p>\r
+<p class="whs2">geompy.addToStudy(face1, \r
+ "Face1")</p>\r
\r
<p class="whs2"> </p>\r
\r
\r
<p class="whs3"># Define 1D meshing</p>\r
\r
-<p class="whs2">algo = tria.Segment()</p>\r
+<p class="whs2">algo1D = tria.Segment()</p>\r
\r
-<p class="whs2">algo.NumberOfSegments(2)</p>\r
+<p class="whs2">algo1D.NumberOfSegments(2)</p>\r
\r
<p class="whs2"> </p>\r
\r
<p class="whs3"># create and assign the \r
algorithm for 2D meshing with triangles</p>\r
\r
-<p class="whs2">algo = tria.Triangle()</p>\r
+<p class="whs2">algo2D = tria.Triangle()</p>\r
\r
<p class="whs2"> </p>\r
\r
<p class="whs3"># create and assign "LengthFromEdges" \r
- hypothesis to build triangles </p>\r
-\r
-<p class="whs3"># based on the length \r
- of the edges taken from the wire</p>\r
+ hypothesis to build triangles<span style="font-family: 'Times New Roman', serif;"> \r
+ based on the length of the edges taken from the wire</span></p>\r
\r
-<p class="whs2">algo.LengthFromEdges()</p>\r
+<p class="whs2">algo2D.LengthFromEdges()</p>\r
\r
<p class="whs2"> </p>\r
\r
\r
<h4><a name=bookmark7>Propagation</a></h4>\r
\r
-<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">from \r
- geompy import *</span></p>\r
+<p class="whs2">from geompy import \r
+ *</p>\r
\r
<p class="whs2">import smesh</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs3"># create vertices</p>\r
-\r
-<p class="whs2">Point111 = MakeVertex( \r
- 0, 0, 0)</p>\r
+<p class="whs3"># create a box</p>\r
\r
-<p class="whs2">Point211 = MakeVertex(10, \r
- 0, 0)</p>\r
+<p class="whs2">box = MakeBoxDXDYDZ(10., \r
+ 10., 10.)</p>\r
\r
-<p class="whs2">Point121 = MakeVertex( \r
- 0, 10, 0)</p>\r
+<p class="whs2">addToStudy(box, "Box")</p>\r
\r
-<p class="whs2">Point221 = MakeVertex(10, \r
- 10, 0)</p>\r
+<p class="whs2"> </p>\r
\r
-<p class="whs2">Point112 = MakeVertex( \r
- 0, 0, 10)</p>\r
+<p class="whs3"># get one edge of the \r
+ box to put local hypothesis on</p>\r
\r
-<p class="whs2">Point212 = MakeVertex(10, \r
- 0, 10)</p>\r
+<p class="whs2">p5 = MakeVertex(5., \r
+ 0., 0.)</p>\r
\r
-<p class="whs2">Point122 = MakeVertex( \r
- 0, 10, 10)</p>\r
+<p class="whs2">EdgeX = GetEdgeNearPoint(box, \r
+ p5)</p>\r
\r
-<p class="whs2">Point222 = MakeVertex(10, \r
- 10, 10)</p>\r
+<p class="whs2">addToStudyInFather(box, \r
+ EdgeX, "Edge [0,0,0 - 10,0,0]")</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs3"># create edges</p>\r
+<p class="whs3"># create a hexahedral \r
+ mesh on the box</p>\r
\r
-<p class="whs2">EdgeX111 = MakeEdge(Point111, \r
- Point211)</p>\r
+<p class="whs2">hexa = smesh.Mesh(box, \r
+ "Box : hexahedrical mesh")</p>\r
+\r
+<p class="whs2"> </p>\r
\r
-<p class="whs2">EdgeX121 = MakeEdge(Point121, \r
- Point221)</p>\r
+<p class="whs3"># set global algorithms \r
+ and hypotheses</p>\r
\r
-<p class="whs2">EdgeX112 = MakeEdge(Point112, \r
- Point212)</p>\r
+<p class="whs2">algo1D = hexa.Segment()</p>\r
\r
-<p class="whs2">EdgeX122 = MakeEdge(Point122, \r
- Point222)</p>\r
+<p class="whs2">hexa.Quadrangle()</p>\r
\r
-<p class="whs2">EdgeY11 = MakeEdge(Point111, \r
- Point121)</p>\r
+<p class="whs2">hexa.Hexahedron()</p>\r
\r
-<p class="whs2">EdgeY21 = MakeEdge(Point211, \r
- Point221)</p>\r
+<p class="whs2">algo1D.NumberOfSegments(4)</p>\r
\r
-<p class="whs2">EdgeY12 = MakeEdge(Point112, \r
- Point122)</p>\r
+<p class="whs2"> </p>\r
\r
-<p class="whs2">EdgeY22 = MakeEdge(Point212, \r
- Point222)</p>\r
+<p class="whs3"># create a sub-mesh with \r
+ local 1D hypothesis and propagation</p>\r
\r
-<p class="whs2">EdgeZ111 = MakeEdge(Point111, \r
- Point112)</p>\r
+<p class="whs2">algo_local = hexa.Segment(EdgeX)</p>\r
\r
-<p class="whs2">EdgeZ211 = MakeEdge(Point211, \r
- Point212)</p>\r
+<p class="whs2"> </p>\r
\r
-<p class="whs2">EdgeZ121 = MakeEdge(Point121, \r
- Point122)</p>\r
+<p class="whs3"># define "Arithmetic1D" \r
+ hypothesis to cut an edge in several segments with increasing length</p>\r
\r
-<p class="whs2">EdgeZ221 = MakeEdge(Point221, \r
- Point222)</p>\r
+<p class="whs2">algo_local.Arithmetic1D(1, \r
+ 4)</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs3"># create faces</p>\r
+<p class="whs3"># define "Propagation" \r
+ hypothesis that propagates all other 1D hypotheses</p>\r
\r
-<p class="whs2">FaceX11 = MakeQuad(EdgeY11, \r
- EdgeZ111, EdgeY12, EdgeZ121)</p>\r
+<p class="whs3"># from all edges on the \r
+ opposite side of a face in case of quadrangular faces</p>\r
\r
-<p class="whs2">FaceX21 = MakeQuad(EdgeY21, \r
- EdgeZ211, EdgeY22, EdgeZ221)</p>\r
+<p class="whs2">algo_local.Propagation()</p>\r
\r
-<p class="whs2">FaceY111 = MakeQuad(EdgeX111, \r
- EdgeZ111, EdgeX112, EdgeZ211)</p>\r
+<p class="whs2"> </p>\r
\r
-<p class="whs2">FaceY121 = MakeQuad(EdgeX121, \r
- EdgeZ121, EdgeX122, EdgeZ221)</p>\r
+<p class="whs3"># compute the mesh</p>\r
\r
-<p class="whs2">FaceZ11 = MakeQuad(EdgeX111, \r
- EdgeY11, EdgeX121, EdgeY21)</p>\r
+<p><span style="font-family: 'Lucida Console', monospace;">hexa.Compute()</span> \r
+ </p>\r
\r
-<p class="whs2">FaceZ12 = MakeQuad(EdgeX112, \r
- EdgeY12, EdgeX122, EdgeY22)</p>\r
+<h3><a name=bookmark8>Defining Meshing Algorithms</a></h3>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs4">import geompy</p>\r
\r
-<p class="whs3"># create a solid</p>\r
+<p class="whs4">import smesh</p>\r
\r
-<p class="whs2">box = MakeHexa(FaceX11, \r
- FaceX21, FaceY111, FaceY121, FaceZ11, FaceZ12)</p>\r
+<p class="whs6"> </p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs6"># create a box</p>\r
\r
-<p class="whs3"># add in the study</p>\r
+<p class="whs4">box = geompy.MakeBoxDXDYDZ(10., \r
+ 10., 10.)</p>\r
\r
-<p class="whs2">box_id = addToStudy(box, \r
+<p class="whs4">geompy.addToStudy(box, \r
"Box")</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs4"> </p>\r
\r
-<p class="whs3"># create a hexahedral \r
+<p class="whs6"># 1. Create a hexahedral \r
mesh on the box</p>\r
\r
-<p class="whs2">hexa = smesh.Mesh(box, \r
+<p class="whs4">hexa = smesh.Mesh(box, \r
"Box : hexahedrical mesh")</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs6"> </p>\r
\r
-<p class="whs3"># create an 1D algorithm \r
+<p class="whs6"># create a Regular 1D algorithm \r
for edges</p>\r
\r
-<p class="whs2">algo = hexa.Segment()</p>\r
-\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs3"># define "NumberOfSegments" \r
- hypothesis to cut an edge in a fixed number of segments</p>\r
+<p class="whs4">algo1D = hexa.Segment()</p>\r
\r
-<p class="whs2">algo.NumberOfSegments(4)</p>\r
-\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs3"># create a quadrangle \r
- 2D algorithm for faces</p>\r
-\r
-<p class="whs2">hexa.Quadrangle()</p>\r
+<p class="whs6"> </p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs6"># create a quadrangle 2D \r
+ algorithm for faces</p>\r
\r
-<p class="whs3"># create a hexahedron \r
- 3D algorithm for solids</p>\r
+<p class="whs4">algo2D = hexa.Quadrangle()</p>\r
\r
-<p class="whs2">hexa.Hexahedron()</p>\r
-\r
-<p class="whs2"> </p>\r
+<p class="whs6"> </p>\r
\r
-<p class="whs3"># create a local hypothesis</p>\r
+<p class="whs6"># create a hexahedron 3D \r
+ algorithm for solids</p>\r
\r
-<p class="whs2">algo = hexa.Segment(EdgeX111)</p>\r
+<p class="whs4">algo3D = hexa.Hexahedron()</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs6"> </p>\r
\r
-<p class="whs3"># define "Arithmetic1D" \r
- hypothesis to cut an edge<span style="font-family: 'Times New Roman', serif;"> \r
- in several segments with increasing length</span></p>\r
+<p class="whs6"># define hypotheses</p>\r
\r
-<p class="whs2">algo.Arithmetic1D(1, \r
+<p class="whs4">algo1D.Arithmetic1D(1, \r
4)</p>\r
\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs3"># define "Propagation" \r
- hypothesis that propagates all other 1D hypotheses</p>\r
-\r
-<p class="whs3"># from all edges on the \r
- opposite side of a face in case of quadrangular faces</p>\r
-\r
-<p class="whs2">algo.Propagation()</p>\r
+<p class="whs6"> </p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs6"># compute the mesh</p>\r
\r
-<p class="whs3"># compute the mesh</p>\r
+<p class="whs4">hexa.Compute()</p>\r
\r
-<p class="whs2">hexa.Compute() </p>\r
+<p class="whs6"> </p>\r
\r
-<h3><a name=bookmark8>Defining Meshing Algorithms</a></h3>\r
+<p class="whs6"># 2. Create a tetrahedral \r
+ mesh on the box</p>\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> \r
+<p class="whs4">tetra = smesh.Mesh(box, \r
+ "Box : tetrahedrical mesh")</p>\r
\r
-<p class="whs4"><span style="font-family: 'Lucida Console', monospace;">import \r
- salome</span></p>\r
-\r
-<p class="whs4">import StdMeshers</p>\r
+<p class="whs6"> </p>\r
\r
-<p class="whs4">import NETGENPlugin</p>\r
+<p class="whs6"># create a Regular 1D algorithm \r
+ for edges</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs4">algo1D = tetra.Segment()</p>\r
\r
-<p class="whs4">smesh = salome.lcc.FindOrLoadComponent("FactoryServer", \r
- "SMESH")</p>\r
+<p class="whs6"> </p>\r
\r
-<p class="whs4">smeshgui = salome.ImportComponentGUI("SMESH")</p>\r
+<p class="whs6"># create a Mefisto 2D algorithm \r
+ for faces</p>\r
\r
-<p class="whs4">smeshgui.Init(salome.myStudyId);</p>\r
+<p class="whs4">algo2D = tetra.Triangle()</p>\r
\r
<p class="whs6"> </p>\r
\r
-<p class="whs6"># create algorithms</p>\r
-\r
-<p class="whs4">print "-------------------------- \r
- create Algorithms"</p>\r
+<p class="whs6"># create a Netgen 3D algorithm \r
+ for solids</p>\r
\r
-<p class="whs4">print "-------------------------- \r
- Regular_1D (Wire discretisation)"</p>\r
+<p class="whs4">algo3D = tetra.Tetrahedron(smesh.NETGEN)</p>\r
\r
-<p class="whs4">regular1D = smesh.CreateHypothesis("Regular_1D", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs6"> </p>\r
\r
-<p class="whs4">smeshgui.SetName(salome.ObjectToID(regular1D), \r
- "Wire Discretisation")</p>\r
+<p class="whs6"># define hypotheses</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs4">algo1D.Arithmetic1D(1, \r
+ 4)</p>\r
\r
-<p class="whs4">print "-------------------------- \r
- MEFISTO_2D (Triangle meshing algorithm)"</p>\r
+<p class="whs4">algo2D.LengthFromEdges()</p>\r
\r
-<p class="whs4">mefisto2D = smesh.CreateHypothesis("MEFISTO_2D", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs6"> </p>\r
\r
-<p class="whs4">smeshgui.SetName(salome.ObjectToID(mefisto2D), \r
- "MEFISTO_2D")</p>\r
+<p class="whs6"># compute the mesh</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs4">tetra.Compute()</p>\r
\r
-<p class="whs4">print "-------------------------- \r
- Quadrangle_2D (Quadrangle meshing algorithm)"</p>\r
+<p class="whs6"> </p>\r
\r
-<p class="whs4">quad2D = smesh.CreateHypothesis( \r
- "Quadrangle_2D", "libStdMeshersEngine.so" )</p>\r
+<p class="whs6"># 3. Create a tetrahedral \r
+ mesh on the box with NETGEN_2D3D algorithm</p>\r
\r
-<p class="whs4">smeshgui.SetName(salome.ObjectToID(quad2D), \r
- "Quadrangle_2D")</p>\r
+<p class="whs4">tetraN = smesh.Mesh(box, \r
+ "Box : tetrahedrical mesh by NETGEN_2D3D")</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs6"> </p>\r
\r
-<p class="whs4">print "-------------------------- \r
- Hexa_3D (Hexahedron meshing algorithm)"</p>\r
+<p class="whs6"># create a Netgen_2D3D \r
+ algorithm for solids</p>\r
\r
-<p class="whs4">hexa3D = smesh.CreateHypothesis("Hexa_3D", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs4">is3D = 1</p>\r
\r
-<p class="whs4">smeshgui.SetName(salome.ObjectToID(hexa3D), \r
- "HEXA_3D")</p>\r
+<p class="whs4">algo3D = tetraN.Netgen(is3D)</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs6"> </p>\r
\r
-<p class="whs4">print "-------------------------- \r
- NETGEN_3D (Tetrahedron meshing algorithm)"</p>\r
+<p class="whs6"># define hypotheses</p>\r
\r
-<p class="whs4">netgen3D = smesh.CreateHypothesis("NETGEN_3D", \r
- "libNETGENEngine.so")</p>\r
+<p class="whs4">n23_params = algo3D.Parameters()</p>\r
\r
-<p class="whs4">smeshgui.SetName(salome.ObjectToID(netgen3D), \r
- "NETGEN_3D")</p>\r
+<p class="whs6"> </p>\r
\r
-<p class="whs4">salome.sg.updateObjBrowser(1)</p>\r
+<p class="whs6"># compute the mesh</p>\r
\r
-<p class="whs6"> </p>\r
+<p class="whs4">tetraN.Compute() \r
+ </p>\r
\r
<script type="text/javascript" language="javascript1.2">\r
<!--\r
<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.whs1 { margin-top:0pt; margin-bottom:0pt; font-weight:bold; color:#ff0000; }\r
p.whs2 { margin-top:0pt; margin-bottom:0pt; }\r
-img_whs3 { border:none; width:430px; height:391px; float:none; border-style:none; }\r
-img_whs4 { border:none; float:none; width:463px; height:417px; border-style:none; }\r
-img_whs5 { border:none; width:541px; height:417px; float:none; border-style:none; }\r
-img_whs6 { border:none; width:394px; height:425px; float:none; border-style:none; }\r
-img_whs7 { border:none; float:none; width:368px; height:379px; border-style:none; }\r
-img_whs8 { border:none; float:none; width:344px; height:381px; border-style:none; }\r
-img_whs9 { border:none; width:314px; height:351px; float:none; border-style:none; }\r
-img_whs10 { border:none; float:none; width:319px; height:351px; border-style:none; }\r
-img_whs11 { border:none; float:none; width:304px; height:352px; border-style:none; }\r
-img_whs12 { border:none; width:318px; height:355px; float:none; border-style:none; }\r
-img_whs13 { border:none; float:none; width:318px; height:355px; border-style:none; }\r
-img_whs14 { border:none; float:none; width:320px; height:354px; border-style:none; }\r
+p.whs3 { margin-top:0pt; margin-bottom:0pt; font-family:'Lucida Console' , monospace; }\r
+p.whs4 { margin-top:0pt; margin-bottom:0pt; font-family:'Times New Roman' , serif; }\r
+img_whs5 { border:none; width:430px; height:391px; float:none; border-style:none; }\r
+p.whs6 { margin-top:0pt; margin-bottom:0pt; color:#ff0000; font-weight:bold; }\r
+img_whs7 { border:none; float:none; width:463px; height:417px; border-style:none; }\r
+img_whs8 { border:none; width:541px; height:417px; float:none; border-style:none; }\r
+img_whs9 { border:none; width:394px; height:425px; float:none; border-style:none; }\r
+img_whs10 { border:none; float:none; width:368px; height:379px; border-style:none; }\r
+img_whs11 { border:none; float:none; width:344px; height:381px; border-style:none; }\r
+img_whs12 { border:none; width:314px; height:351px; float:none; border-style:none; }\r
+img_whs13 { border:none; float:none; width:319px; height:351px; border-style:none; }\r
+img_whs14 { border:none; float:none; width:304px; height:352px; border-style:none; }\r
+img_whs15 { border:none; width:318px; height:355px; float:none; border-style:none; }\r
+img_whs16 { border:none; float:none; width:318px; height:355px; border-style:none; }\r
+img_whs17 { border:none; float:none; width:320px; height:354px; border-style:none; }\r
-->\r
</style><script type="text/javascript" language="JavaScript">\r
<!--\r
var strNSS = "<style type='text/css'>";\r
strNSS += "p.whs1 {margin-top:1pt;margin-bottom:1pt; }";\r
strNSS += "p.whs2 {margin-top:1pt;margin-bottom:1pt; }";\r
+ strNSS += "p.whs3 {margin-top:1pt;margin-bottom:1pt; }";\r
+ strNSS += "p.whs4 {margin-top:1pt;margin-bottom:1pt; }";\r
+ strNSS += "p.whs6 {margin-top:1pt;margin-bottom:1pt; }";\r
strNSS +="</style>";\r
document.write(strNSS);\r
}\r
\r
<h3><a name=bookmark>Create a Standalone Group</a></h3>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs1"># Attention! This script has been written \r
+ using the old approach basing on direct usage of SMESH idl interface.</p>\r
\r
-<p class="whs1">import SMESH</p>\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to create a standalone group. </p>\r
\r
-<p class="whs1">import SMESH_mechanic</p>\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs2"> </p>\r
+\r
+<p class="whs3">import SMESH</p>\r
+\r
+<p class="whs3">import SMESH_mechanic</p>\r
\r
-<p class="whs1">smesh = \r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">smesh = \r
SMESH_mechanic.smesh</p>\r
\r
-<p class="whs1">mesh = \r
+<p class="whs3">mesh = \r
SMESH_mechanic.mesh</p>\r
\r
-<p class="whs1">salome = SMESH_mechanic.salome</p>\r
-\r
-<p class="whs1"> </p>\r
+<p class="whs3">salome = SMESH_mechanic.salome</p>\r
\r
-<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs4"># Get ids of all faces \r
+ with area > 100 </p>\r
\r
-<p class="whs2"># Criterion : AREA > \r
- 100</p>\r
+<p class="whs3">aFilterMgr = smesh.CreateFilterManager()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aFunctor = aFilterMgr.CreateArea()</p>\r
\r
-<p class="whs1">aFunctor = aFilterMgr.CreateArea()</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
+<p class="whs3">aPredicate.SetNumFunctor( \r
aFunctor )</p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
+<p class="whs3">aPredicate.SetMargin( \r
100 )</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
+<p class="whs3">aFilter.SetPredicate( \r
aPredicate )</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
+<p class="whs3">anIds = aFilter.GetElementsId( \r
mesh )</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs2"># print the result</p>\r
-\r
-<p class="whs1">print "Criterion: \r
- Area > 100 Nb = ", len( anIds )</p>\r
-\r
-<p class="whs1">for i in range( \r
- len( anIds ) ):</p>\r
-\r
-<p class="whs1"> print \r
- anIds[ i ]</p>\r
-\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
<p class="whs2"># create a group consisting \r
of faces with area > 100</p>\r
\r
-<p class="whs1">aGroup = mesh.CreateGroup( \r
+<p class="whs3">aGroup = mesh.CreateGroup( \r
SMESH.FACE, "Area > 100" )</p>\r
\r
-<p class="whs1">aGroup.Add( anIds \r
+<p class="whs3">aGroup.Add( anIds \r
)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs2"><img src="pics/create_group.png" x-maintain-ratio="TRUE" width="430px" height="391px" border="0" class="img_whs3"></p>\r
+<p class="whs2"><img src="pics/create_group.png" x-maintain-ratio="TRUE" width="430px" height="391px" border="0" class="img_whs5"></p>\r
\r
<h3><a name=bookmark5>Create a Group on Geometry</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> \r
+<p class="whs3">import salome</p>\r
\r
-<p class="whs1">import salome</p>\r
+<p class="whs3">import geompy</p>\r
\r
-<p class="whs1">import geompy</p>\r
+<p class="whs3">import smesh</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">import SMESH</p>\r
+<p class="whs4"># create a box</p>\r
\r
-<p class="whs1">import StdMeshers</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">smesh = salome.lcc.FindOrLoadComponent("FactoryServer", \r
- "SMESH")</p>\r
-\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs2"># create a box</p>\r
-\r
-<p class="whs1">box = geompy.MakeBox(0., \r
+<p class="whs3">box = geompy.MakeBox(0., \r
0., 0., 100., 100., 100.)</p>\r
\r
-<p class="whs2"> </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="whs3">geompy.addToStudy(box, \r
"box")</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"># add the first face of \r
- the box to the study</p>\r
+<p class="whs4"># add the first face \r
+ of the box to the study</p>\r
\r
-<p class="whs1">subShapeList = geompy.SubShapeAll(box, \r
+<p class="whs3">subShapeList = geompy.SubShapeAll(box, \r
geompy.ShapeType["FACE"])</p>\r
\r
-<p class="whs1">face = subShapeList[0]</p>\r
-\r
-<p class="whs1">name = geompy.SubShapeName(face, \r
- box)</p>\r
-\r
-<p class="whs1">idface = geompy.addToStudyInFather(box, \r
- face, name)</p>\r
-\r
-<p class="whs2"> </p>\r
+<p class="whs3">face = subShapeList[0]</p>\r
\r
-<p class="whs2"># create a hypothesis</p>\r
+<p class="whs3">geompy.addToStudyInFather(box, \r
+ face, "face 1")</p>\r
\r
-<p class="whs1">numberOfSegments \r
- = 7</p>\r
-\r
-<p class="whs1">hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", \r
- "libStdMeshersEngine.so")</p>\r
-\r
-<p class="whs1">hypNbSeg.SetNumberOfSegments(numberOfSegments)</p>\r
-\r
-<p class="whs2"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"># create algorithms</p>\r
-\r
-<p class="whs1">regular1D = smesh.CreateHypothesis("Regular_1D", \r
- "libStdMeshersEngine.so")</p>\r
-\r
-<p class="whs1">quad2D = smesh.CreateHypothesis("Quadrangle_2D", \r
- "libStdMeshersEngine.so")</p>\r
-\r
-<p class="whs2"> </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="whs2"> </p>\r
-\r
-<p class="whs2"># add hypotheses and algorithms \r
- to the box</p>\r
-\r
-<p class="whs1">mesh.AddHypothesis(box,hypNbSeg)</p>\r
-\r
-<p class="whs1">mesh.AddHypothesis(box,regular1D)</p>\r
+<p class="whs4"># create group of edges \r
+ on the face</p>\r
\r
-<p class="whs1">mesh.AddHypothesis(box,quad2D)</p>\r
+<p class="whs3">aGeomGroupE = geompy.CreateGroup(face, \r
+ geompy.ShapeType["EDGE"])</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">geompy.AddObject(aGeomGroupE, \r
+ 3)</p>\r
\r
-<p class="whs2"># compute the mesh</p>\r
+<p class="whs3">geompy.AddObject(aGeomGroupE, \r
+ 6)</p>\r
\r
-<p class="whs1">ret = smesh.Compute(mesh,box)</p>\r
+<p class="whs3">geompy.AddObject(aGeomGroupE, \r
+ 8)</p>\r
\r
-<p class="whs1">if ret == 0:</p>\r
+<p class="whs3">geompy.AddObject(aGeomGroupE, \r
+ 10)</p>\r
\r
-<p class="whs1"> print \r
- "probleme when computing the mesh"</p>\r
+<p class="whs3">geompy.addToStudyInFather(face, \r
+ aGeomGroupE, "Group of Edges")</p>\r
\r
-<p class="whs1">else:</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> print \r
- "Computation succeded"</p>\r
+<p class="whs4"># create quadrangle \r
+ 2D mesh on the box</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">quadra = smesh.Mesh(box, \r
+ "Box : quadrangle 2D mesh")</p>\r
\r
-<p class="whs2"># create geometry groups \r
- on the face</p>\r
+<p class="whs3">algo1D = quadra.Segment()</p>\r
\r
-<p class="whs1">aGeomGroup1 = geompy.CreateGroup(face, \r
- geompy.ShapeType["FACE"])</p>\r
+<p class="whs3">quadra.Quadrangle()</p>\r
\r
-<p class="whs1">geompy.AddObject(aGeomGroup1, \r
- 1)</p>\r
+<p class="whs3">algo1D.NumberOfSegments(7)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aGeomGroup2 = geompy.CreateGroup(face, \r
- geompy.ShapeType["EDGE"])</p>\r
+<p class="whs4"># compute the mesh</p>\r
\r
-<p class="whs1">geompy.AddObject(aGeomGroup2, \r
- 3)</p>\r
+<p class="whs3">quadra.Compute()</p>\r
\r
-<p class="whs1">geompy.AddObject(aGeomGroup2, \r
- 6)</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">geompy.AddObject(aGeomGroup2, \r
- 8)</p>\r
+<p class="whs4"># create SMESH group \r
+ on the face with name "SMESHGroup1"</p>\r
\r
-<p class="whs1">geompy.AddObject(aGeomGroup2, \r
- 10)</p>\r
+<p class="whs3">aSmeshGroup1 = quadra.Group(face, \r
+ "SMESHGroup1")</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">geompy.addToStudy(aGeomGroup1, \r
- "Group on Faces")</p>\r
+<p class="whs4"># create SMESH group \r
+ on <aGeomGroupE> with default name</p>\r
\r
-<p class="whs1">geompy.addToStudy(aGeomGroup2, \r
- "Group on Edges")</p>\r
+<p class="whs3">aSmeshGroup2 = quadra.Group(aGeomGroupE)</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs2"># create SMESH groups</p>\r
-\r
-<p class="whs1">aSmeshGroup1 = mesh.CreateGroupFromGEOM(SMESH.FACE, \r
- "SMESHGroup1",</p>\r
-\r
-<p class="whs1">aGeomGroup1)</p>\r
+<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
+ </p>\r
\r
-<p class="whs1">aSmeshGroup2 = mesh.CreateGroupFromGEOM(SMESH.EDGE, \r
- "SMESHGroup2", aGeomGroup2)</p>\r
+<h3><a name=bookmark1>Edit a Group</a></h3>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs6"># Attention! This script has been written \r
+ using the old approach basing on direct usage of SMESH idl interface.</p>\r
\r
-<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
- </p>\r
+<p class="whs6"># For the moment smesh package doesn't \r
+ provide methods to edit a group. </p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs6"># In the next SALOME version the scripts \r
+ will be updated to use only the commands from smesh package.</p>\r
\r
-<h3><a name=bookmark1>Edit a Group</a></h3>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">import SMESH</p>\r
+<p class="whs3">import SMESH</p>\r
\r
-<p class="whs1">import SMESH_mechanic</p>\r
+<p class="whs3">import SMESH_mechanic</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">smesh = \r
+<p class="whs3">smesh = \r
SMESH_mechanic.smesh</p>\r
\r
-<p class="whs1">mesh = \r
+<p class="whs3">mesh = \r
SMESH_mechanic.mesh</p>\r
\r
-<p class="whs1">salome = SMESH_mechanic.salome</p>\r
+<p class="whs3">salome = SMESH_mechanic.salome</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>\r
+<p class="whs4"># Get ids of all faces \r
+ with area > 35</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aFilterMgr = smesh.CreateFilterManager()</p>\r
\r
-<p class="whs2"># Criterion : AREA > \r
- 20</p>\r
+<p class="whs3">aFunctor = aFilterMgr.CreateArea()</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFunctor = aFilterMgr.CreateArea()</p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
+<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>\r
\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
- aFunctor )</p>\r
+<p class="whs3">aPredicate.SetMargin(35.)</p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
- 30 )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">print "Criterion: \r
+ Area > 35, Nb = ", len(anIds)</p>\r
\r
-<p class="whs2"># create a group by adding \r
- elements with area > 20</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aGroup = mesh.CreateGroup( \r
- SMESH.FACE, "Area > 20" )</p>\r
+<p class="whs4"># create a group by \r
+ adding elements with area > 35</p>\r
\r
-<p class="whs1">aGroup.Add( anIds \r
- )</p>\r
+<p class="whs3">aGroup = mesh.CreateGroup(SMESH.FACE, \r
+ "Area > 35")</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aGroup.Add(anIds)</p>\r
\r
-<p class="whs1">print "Criterion: \r
- Area > 20 Nb = ", len( anIds )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">for i in range( \r
- len( anIds ) ):</p>\r
+<p class="whs4"># Get ids of all faces \r
+ with area > 40</p>\r
\r
-<p class="whs1"> print \r
- anIds[ i ]</p>\r
+<p class="whs3">aFunctor = aFilterMgr.CreateArea()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
\r
-<p class="whs2"># Criterion : AREA > \r
- 60</p>\r
+<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">aPredicate.SetMargin(40.)</p>\r
\r
-<p class="whs1">aFunctor = aFilterMgr.CreateArea()</p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
- aFunctor )</p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
- 60 )</p>\r
+<p class="whs3">print "Criterion: \r
+ Area > 40, Nb = ", len(anIds)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs4"># create a group of \r
+ elements with area [35; 40] by removing elements with area > 40 from \r
+ group aGroup</p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs3">aGroup.Remove(anIds)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs4"># print the result</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">aGroupElemIDs = \r
+ aGroup.GetListOfID()</p>\r
\r
-<p class="whs2"># create a group of elements \r
- with area [20; 60] by removing elements with area > 60 from group \r
- aGroup </p>\r
+<p class="whs3">print "Criterion: \r
+ 35 < Area < 40, Nb = ", len(aGroupElemIDs)</p>\r
\r
-<p class="whs1">aGroup.Remove(anIds)</p>\r
+<p class="whs3">j = 1</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">for i in range(len(aGroupElemIDs)):</p>\r
\r
-<p class="whs2"># print the result</p>\r
+<p class="whs3"> if \r
+ j > 20: j = 1; print ""</p>\r
\r
-<p class="whs1">aGroupElemIDs = \r
- aGroup.GetListOfID()</p>\r
+<p class="whs3"> print \r
+ aGroupElemIDs[i],</p>\r
\r
-<p class="whs1">print "Criterion: \r
- 20 < Area < 60 = ", len( aGroupElemIDs )</p>\r
+<p class="whs3"> j \r
+ = j + 1</p>\r
\r
-<p class="whs1">for i in range( \r
- len( aGroupElemIDs ) ):</p>\r
+<p class="whs3"> pass</p>\r
\r
-<p class="whs1"> print \r
- aGroupElemIDs[ i ]</p>\r
+<p class="whs3">print ""</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
+<p class="whs3">salome.sg.updateObjBrowser(1) \r
</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs2"><img src="pics/editing_groups1.png" x-maintain-ratio="TRUE" width="463px" height="417px" border="0" class="img_whs4"> <img src="pics/editing_groups2.png" x-maintain-ratio="TRUE" width="541px" height="417px" border="0" class="img_whs5"></p>\r
+<p class="whs2"><img src="pics/editing_groups1.png" x-maintain-ratio="TRUE" width="463px" height="417px" border="0" class="img_whs7"> <img src="pics/editing_groups2.png" x-maintain-ratio="TRUE" width="541px" height="417px" border="0" class="img_whs8"></p>\r
\r
<h3><a name=bookmark2>Union of two groups</a></h3>\r
\r
-<p class="whs1">import SMESH</p>\r
+<p class="whs1"># Attention! This script has been written \r
+ using the old approach basing on direct usage of SMESH idl interface.</p>\r
\r
-<p class="whs1">import SMESH_mechanic</p>\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to create a union of two groups. </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
\r
-<p class="whs1">smesh = \r
- SMESH_mechanic.smesh</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">mesh = \r
- SMESH_mechanic.mesh</p>\r
+<p class="whs3"><span style="font-family: 'Lucida Console', monospace;">import \r
+ SMESH</span></p>\r
\r
-<p class="whs1">salome = SMESH_mechanic.salome</p>\r
+<p class="whs3">import SMESH_mechanic</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>\r
+<p class="whs3">smesh = \r
+ SMESH_mechanic.smesh</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">mesh = \r
+ SMESH_mechanic.mesh</p>\r
\r
-<p class="whs2"># Criterion : AREA > \r
- 20</p>\r
+<p class="whs3">salome = SMESH_mechanic.salome</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFunctor = aFilterMgr.CreateArea()</p>\r
+<p class="whs3">aFilterMgr = smesh.CreateFilterManager()</p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
- aFunctor )</p>\r
+<p class="whs4"># Criterion : AREA \r
+ > 20</p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
- 20 )</p>\r
+<p class="whs3">aFunctor = aFilterMgr.CreateArea()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs3">aPredicate.SetMargin(20.)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs2"># create a group by adding \r
- elements with area > 20</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aGroup1 = mesh.CreateGroup( \r
- SMESH.FACE, "Area > 20" )</p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
-<p class="whs1">aGroup1.Add( anIds \r
- )</p>\r
+<p class="whs3">print "Criterion: \r
+ Area > 20, Nb = ", len( anIds )</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">print "Criterion: \r
- Area > 20 Nb = ", len( anIds )</p>\r
+<p class="whs4"># create a group by \r
+ adding elements with area > 20</p>\r
\r
-<p class="whs1">for i in range( \r
- len( anIds ) ):</p>\r
+<p class="whs3">aGroup1 = mesh.CreateGroup(SMESH.FACE, \r
+ "Area > 20")</p>\r
\r
-<p class="whs1"> print \r
- anIds[ i ]</p>\r
+<p class="whs3">aGroup1.Add(anIds)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"># Criterion : AREA = 20</p>\r
+<p class="whs4"># Criterion : AREA \r
+ = 20</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">aFunctor = aFilterMgr.CreateArea()</p>\r
\r
-<p class="whs1">aFunctor = aFilterMgr.CreateArea()</p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateEqualTo()</p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateEqualTo()</p>\r
+<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>\r
\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
- aFunctor )</p>\r
+<p class="whs3">aPredicate.SetMargin(20.)</p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
- 20 )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">print "Criterion: \r
+ Area = 20, Nb = ", len( anIds )</p>\r
\r
-<p class="whs2"># create a group by adding \r
- elements with area > 20</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aGroup2 = mesh.CreateGroup( \r
- SMESH.FACE, "Area = 20" )</p>\r
-\r
-<p class="whs1">aGroup2.Add( anIds \r
- )</p>\r
+<p class="whs4"># create a group by \r
+ adding elements with area = 20</p>\r
\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">print "Criterion: \r
- Area = 20 Nb = ", len( anIds )</p>\r
-\r
-<p class="whs1">for i in range( \r
- len( anIds ) ):</p>\r
+<p class="whs3">aGroup2 = mesh.CreateGroup( \r
+ SMESH.FACE, "Area = 20" )</p>\r
\r
-<p class="whs1"> print \r
- anIds[ i ]</p>\r
+<p class="whs3">aGroup2.Add(anIds)</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"># create union group : \r
- area >= 20</p>\r
+<p class="whs4"># create union group \r
+ : area >= 20</p>\r
\r
-<p class="whs1">aGroup3 = mesh.UnionGroups(aGroup1, \r
+<p class="whs3">aGroup3 = mesh.UnionGroups(aGroup1, \r
aGroup2, "Area >= 20")</p>\r
\r
-<p class="whs1">print "Criterion: \r
- Area >= 20 Nb = ", len( aGroup3.GetListOfID() )</p>\r
+<p class="whs3">print "Criterion: \r
+ Area >= 20, Nb = ", len(aGroup3.GetListOfID())</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"># Criterion : AREA < \r
- 20</p>\r
+<p class="whs4"># Criterion : AREA \r
+ < 20</p>\r
\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs1">aFunctor = aFilterMgr.CreateArea()</p>\r
-\r
-<p class="whs1">aPredicate = aFilterMgr.CreateLessThan()</p>\r
-\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
- aFunctor )</p>\r
+<p class="whs3">aFunctor = aFilterMgr.CreateArea()</p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
- 20 )</p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateLessThan()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs3">aPredicate.SetMargin(20.)</p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"># create a group by adding \r
- elements with area < 20</p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
-<p class="whs1">aGroup4 = mesh.CreateGroup( \r
- SMESH.FACE, "Area < 20" )</p>\r
+<p class="whs3">print "Criterion: \r
+ Area < 20, Nb = ", len(anIds)</p>\r
\r
-<p class="whs1">aGroup4.Add( anIds \r
- )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs4"># create a group by \r
+ adding elements with area < 20</p>\r
\r
-<p class="whs1">print "Criterion: \r
- Area < 20 Nb = ", len( anIds )</p>\r
+<p class="whs3">aGroup4 = mesh.CreateGroup(SMESH.FACE, \r
+ "Area < 20")</p>\r
\r
-<p class="whs1">for i in range( \r
- len( anIds ) ):</p>\r
+<p class="whs3">aGroup4.Add(anIds)</p>\r
\r
-<p class="whs1"> print \r
- anIds[ i ]</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs4"># create union group \r
+ : area >= 20 and area < 20</p>\r
\r
-<p class="whs2"># create union group : \r
- area >= 20 and area < 20</p>\r
-\r
-<p class="whs1">aGroup5 = mesh.UnionGroups(aGroup3, \r
+<p class="whs3">aGroup5 = mesh.UnionGroups(aGroup3, \r
aGroup4, "Any Area")</p>\r
\r
-<p class="whs1">print "Criterion: \r
- Any Area Nb = ", len( aGroup5.GetListOfID() )</p>\r
+<p class="whs3">print "Criterion: \r
+ Any Area, Nb = ", len(aGroup5.GetListOfID())</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">salome.sg.updateObjBrowser(1) \r
+<p class="whs3">salome.sg.updateObjBrowser(1) \r
</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"><img src="pics/union_groups1.png" x-maintain-ratio="TRUE" width="394px" height="425px" border="0" class="img_whs6"></p>\r
+<p class="whs3"><img src="pics/union_groups1.png" x-maintain-ratio="TRUE" width="394px" height="425px" border="0" class="img_whs9"></p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"><img src="pics/union_groups2.png" x-maintain-ratio="TRUE" width="368px" height="379px" border="0" class="img_whs7"> <img src="pics/union_groups3.png" x-maintain-ratio="TRUE" width="344px" height="381px" border="0" class="img_whs8"></p>\r
+<p class="whs3"><img src="pics/union_groups2.png" x-maintain-ratio="TRUE" width="368px" height="379px" border="0" class="img_whs10"> <img src="pics/union_groups3.png" x-maintain-ratio="TRUE" width="344px" height="381px" border="0" class="img_whs11"></p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
<h3><a name=bookmark3>Intersection of two groups</a></h3>\r
\r
-<p class="whs1">import SMESH</p>\r
+<p class="whs6"># Attention! This script has been written \r
+ using the old approach basing on direct usage of SMESH idl interface.</p>\r
\r
-<p class="whs1">import SMESH_mechanic</p>\r
+<p class="whs6"># For the moment smesh package doesn't \r
+ provide methods to create an intersection of two groups. </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs6"># In the next SALOME version the scripts \r
+ will be updated to use only the commands from smesh package.</p>\r
\r
-<p class="whs1">smesh = \r
- SMESH_mechanic.smesh</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">mesh = \r
- SMESH_mechanic.mesh</p>\r
+<p class="whs3">import SMESH</p>\r
\r
-<p class="whs1">salome = SMESH_mechanic.salome</p>\r
+<p class="whs3">import SMESH_mechanic</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>\r
+<p class="whs3">smesh = \r
+ SMESH_mechanic.smesh</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">mesh = \r
+ SMESH_mechanic.mesh</p>\r
\r
-<p class="whs2"># Criterion : AREA > \r
- 20</p>\r
+<p class="whs3">salome = SMESH_mechanic.salome</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFunctor = aFilterMgr.CreateArea()</p>\r
+<p class="whs3">aFilterMgr = smesh.CreateFilterManager()</p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
- aFunctor )</p>\r
+<p class="whs4"># Criterion : AREA \r
+ > 20</p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
- 20 )</p>\r
+<p class="whs3">aFunctor = aFilterMgr.CreateArea()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs3">aPredicate.SetMargin(20.)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs2"># create a group by adding \r
- elements with area > 20</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aGroup1 = mesh.CreateGroup( \r
- SMESH.FACE, "Area > 20" )</p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
-<p class="whs1">aGroup1.Add( anIds \r
- )</p>\r
-\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">print "Criterion: \r
- Area > 20 Nb = ", len( anIds )</p>\r
+<p class="whs3">print "Criterion: \r
+ Area > 20, Nb = ", len(anIds)</p>\r
\r
-<p class="whs1">for i in range( \r
- len( anIds ) ):</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> print \r
- anIds[ i ]</p>\r
+<p class="whs4"># create a group by \r
+ adding elements with area > 20</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aGroup1 = mesh.CreateGroup(SMESH.FACE, \r
+ "Area > 20")</p>\r
\r
-<p class="whs2"># Criterion : AREA < \r
- 60</p>\r
-\r
-<p class="whs2"> </p>\r
+<p class="whs3">aGroup1.Add(anIds)</p>\r
\r
-<p class="whs1">aFunctor = aFilterMgr.CreateArea()</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateLessThan()</p>\r
+<p class="whs4"># Criterion : AREA \r
+ < 60</p>\r
\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
- aFunctor )</p>\r
+<p class="whs3">aFunctor = aFilterMgr.CreateArea()</p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
- 60 )</p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateLessThan()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs3">aPredicate.SetMargin(60)</p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"># create a group by adding \r
- elements with area < 60</p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
-<p class="whs1">aGroup2 = mesh.CreateGroup( \r
- SMESH.FACE, "Area < 60" )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aGroup2.Add( anIds \r
- )</p>\r
+<p class="whs3">print "Criterion: \r
+ Area < 60, Nb = ", len(anIds)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">print "Criterion: \r
- Area < 60 Nb = ", len( anIds )</p>\r
+<p class="whs4"># create a group by \r
+ adding elements with area < 60</p>\r
\r
-<p class="whs1">for i in range( \r
- len( anIds ) ):</p>\r
+<p class="whs3">aGroup2 = mesh.CreateGroup(SMESH.FACE, \r
+ "Area < 60")</p>\r
\r
-<p class="whs1"> print \r
- anIds[ i ]</p>\r
+<p class="whs3">aGroup2.Add(anIds)</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"># create an intersection \r
+<p class="whs4"># create an intersection \r
of groups : 20 < area < 60</p>\r
\r
-<p class="whs1">aGroup3 = mesh.IntersectGroups(aGroup1, \r
+<p class="whs3">aGroup3 = mesh.IntersectGroups(aGroup1, \r
aGroup2, "20 < Area < 60")</p>\r
\r
-<p class="whs1">print "Criterion: \r
- 20 < Area < 60 Nb = ", len( aGroup3.GetListOfID() )</p>\r
+<p class="whs3">print "Criterion: \r
+ 20 < Area < 60, Nb = ", len(aGroup3.GetListOfID())</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
+<p class="whs3">salome.sg.updateObjBrowser(1) \r
</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs2"><img src="pics/intersect_groups1.png" x-maintain-ratio="TRUE" width="314px" height="351px" border="0" class="img_whs9"> <img src="pics/intersect_groups2.png" x-maintain-ratio="TRUE" width="319px" height="351px" border="0" class="img_whs10"> <img src="pics/intersect_groups3.png" x-maintain-ratio="TRUE" width="304px" height="352px" border="0" class="img_whs11"></p>\r
+<p class="whs2"><img src="pics/intersect_groups1.png" x-maintain-ratio="TRUE" width="314px" height="351px" border="0" class="img_whs12"> <img src="pics/intersect_groups2.png" x-maintain-ratio="TRUE" width="319px" height="351px" border="0" class="img_whs13"> <img src="pics/intersect_groups3.png" x-maintain-ratio="TRUE" width="304px" height="352px" border="0" class="img_whs14"></p>\r
\r
<h3><a name=bookmark4>Cut of two groups</a></h3>\r
\r
-<p class="whs1">import SMESH</p>\r
+<p class="whs1"># Attention! This script has been written \r
+ using the old approach basing on direct usage of SMESH idl interface.</p>\r
\r
-<p class="whs1">import SMESH_mechanic</p>\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to create a cut of two groups. </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
\r
-<p class="whs1">smesh = \r
- SMESH_mechanic.smesh</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">mesh = \r
- SMESH_mechanic.mesh</p>\r
+<p class="whs3">import SMESH</p>\r
\r
-<p class="whs1">salome = SMESH_mechanic.salome</p>\r
+<p class="whs3">import SMESH_mechanic</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>\r
+<p class="whs3">smesh = \r
+ SMESH_mechanic.smesh</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">mesh = \r
+ SMESH_mechanic.mesh</p>\r
\r
-<p class="whs2"># Criterion : AREA > \r
- 20</p>\r
+<p class="whs3">salome = SMESH_mechanic.salome</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFunctor = aFilterMgr.CreateArea()</p>\r
+<p class="whs3">aFilterMgr = smesh.CreateFilterManager()</p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
- aFunctor )</p>\r
+<p class="whs4"># Criterion : AREA \r
+ > 20</p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
- 20 )</p>\r
+<p class="whs3">aFunctor = aFilterMgr.CreateArea()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs3">aPredicate.SetMargin(20.)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs2"># create a group by adding \r
- elements with area > 20</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aGroupMain = mesh.CreateGroup( \r
- SMESH.FACE, "Area > 20" )</p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
-<p class="whs1">aGroupMain.Add( \r
- anIds )</p>\r
+<p class="whs3">print "Criterion: \r
+ Area > 20, Nb = ", len(anIds)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">print "Criterion: \r
- Area > 20 Nb = ", len( anIds )</p>\r
+<p class="whs4"># create a group by \r
+ adding elements with area > 20</p>\r
\r
-<p class="whs1">for i in range( \r
- len( anIds ) ):</p>\r
+<p class="whs3">aGroupMain = mesh.CreateGroup(SMESH.FACE, \r
+ "Area > 20")</p>\r
\r
-<p class="whs1"> print \r
- anIds[ i ]</p>\r
+<p class="whs3">aGroupMain.Add(anIds)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"># Criterion : AREA < \r
- 60</p>\r
+<p class="whs4"># Criterion : AREA \r
+ < 60</p>\r
\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs1">aFunctor = aFilterMgr.CreateArea()</p>\r
-\r
-<p class="whs1">aPredicate = aFilterMgr.CreateLessThan()</p>\r
-\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
- aFunctor )</p>\r
+<p class="whs3">aFunctor = aFilterMgr.CreateArea()</p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
- 60 )</p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateLessThan()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs3">aPredicate.SetMargin(60.)</p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"># create a group by adding \r
- elements with area < 60</p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
-<p class="whs1">aGroupTool = mesh.CreateGroup( \r
- SMESH.FACE, "Area < 60" )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aGroupTool.Add( \r
- anIds )</p>\r
+<p class="whs3">print "Criterion: \r
+ Area < 60, Nb = ", len(anIds)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">print "Criterion: \r
- Area < 60 Nb = ", len( anIds )</p>\r
+<p class="whs4"># create a group by \r
+ adding elements with area < 60</p>\r
\r
-<p class="whs1">for i in range( \r
- len( anIds ) ):</p>\r
+<p class="whs3">aGroupTool = mesh.CreateGroup(SMESH.FACE, \r
+ "Area < 60")</p>\r
\r
-<p class="whs1"> print \r
- anIds[ i ]</p>\r
+<p class="whs3">aGroupTool.Add(anIds)</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"># create an intersection \r
- of groups : area >= 60</p>\r
+<p class="whs4"># create a cut of groups \r
+ : area >= 60</p>\r
\r
-<p class="whs1">aGroupRes = mesh.CutGroups(aGroupMain, \r
+<p class="whs3">aGroupRes = mesh.CutGroups(aGroupMain, \r
aGroupTool, "Area >= 60")</p>\r
\r
-<p class="whs1">print "Criterion: \r
- Area >= 60 Nb = ", len( aGroupRes.GetListOfID() )</p>\r
-\r
-<p class="whs1"> </p>\r
+<p class="whs3">print "Criterion: \r
+ Area >= 60, Nb = ", len(aGroupRes.GetListOfID())</p>\r
\r
-<p class="whs1">salome.sg.updateObjBrowser(1) \r
+<p class="whs3">salome.sg.updateObjBrowser(1) \r
</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"><img src="pics/cut_groups1.png" x-maintain-ratio="TRUE" width="318px" height="355px" border="0" class="img_whs12"> <img src="pics/cut_groups2.png" x-maintain-ratio="TRUE" width="318px" height="355px" border="0" class="img_whs13"> <img src="pics/cut_groups3.png" x-maintain-ratio="TRUE" width="320px" height="354px" border="0" class="img_whs14"></p>\r
+<p class="whs2"><img src="pics/cut_groups1.png" x-maintain-ratio="TRUE" width="318px" height="355px" border="0" class="img_whs15"> <img src="pics/cut_groups2.png" x-maintain-ratio="TRUE" width="318px" height="355px" border="0" class="img_whs16"> <img src="pics/cut_groups3.png" x-maintain-ratio="TRUE" width="320px" height="354px" border="0" class="img_whs17"></p>\r
\r
<script type="text/javascript" language="javascript1.2">\r
<!--\r
-<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
-
-<html>
-
-<head>
-<title>Modifying Meshes</title>
-<meta http-equiv="content-type" content="text/html; charset=windows-1252">
-<meta name="generator" content="RoboHelp by eHelp Corporation www.ehelp.com"><style>
-<!--
-P { margin-top:0pt; margin-bottom:0pt; }
-LI.kadov-P { }
--->
-</style><style type="text/css">
-<!--
-p.whs1 { margin-top:0pt; margin-bottom:0pt; font-family:'Lucida Console' , monospace; }
-p.whs2 { margin-top:0pt; margin-bottom:0pt; }
-p.whs3 { margin-top:0pt; margin-bottom:0pt; font-family:'Times New Roman' , serif; }
-h4.whs4 { margin-top:0pt; margin-bottom:0pt; }
-p.whs5 { margin-top:0.5pt; margin-bottom:0pt; font-family:'Lucida Console' , monospace; }
-p.whs6 { margin-top:0.5pt; margin-bottom:0pt; }
-p.whs7 { font-family:'Lucida Console' , monospace; }
-p.whs8 { font-family:'Times New Roman' , serif; }
-p.whs9 { margin-left:36px; font-family:'Lucida Console' , monospace; }
-p.whs10 { margin-left:36px; }
-p.whs11 { margin-left:192px; font-family:'Lucida Console' , monospace; }
-p.whs12 { margin-left:48px; font-family:'Lucida Console' , monospace; }
-p.whs13 { margin-left:40px; font-family:'Lucida Console' , monospace; }
--->
-</style><script type="text/javascript" language="JavaScript">
-<!--
-if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))
-{
- var strNSS = "<style type='text/css'>";
- strNSS += "p.whs1 {margin-top:1pt;margin-bottom:1pt; }";
- strNSS += "p.whs2 {margin-top:1pt;margin-bottom:1pt; }";
- strNSS += "p.whs3 {margin-top:1pt;margin-bottom:1pt; }";
- strNSS += "h4.whs4 {margin-top:1pt;margin-bottom:1pt; }";
- strNSS += "p.whs5 {margin-top:1pt;margin-bottom:1pt; }";
- strNSS += "p.whs6 {margin-top:1pt;margin-bottom:1pt; }";
- strNSS +="</style>";
- document.write(strNSS);
-}
-//-->
-</script>
-<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("MESH module\nTUI Scripts\nModifying Meshes");
-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>Modifying Meshes</h1>
-
-<h3><a name=bookmark>Adding Nodes and Elements</a></h3>
-
-<h4>Add Node</h4>
-
-<p class="whs1">import SMESH</p>
-
-<p class="whs1">import SMESH_mechanic</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">smesh =
- SMESH_mechanic.smesh</p>
-
-<p class="whs1">mesh =
- SMESH_mechanic.mesh</p>
-
-<p class="whs1">salome = SMESH_mechanic.salome</p>
-
-<p class="whs2"> </p>
-
-<p class="whs2"># add node</p>
-
-<p class="whs1">aMeshEditor = mesh.GetMeshEditor()</p>
-
-<p class="whs1">if aMeshEditor.AddNode(50,
- 10, 0) == 1:</p>
-
-<p class="whs1"> print
- "Node addition is OK!"</p>
-
-<p class="whs1">else:</p>
-
-<p class="whs1"> print
- "KO node addition."</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">salome.sg.updateObjBrowser(1)
- </p>
-
-<p class="whs1"> </p>
-
-<h4>Add Edge</h4>
-
-<p class="whs1">import SMESH</p>
-
-<p class="whs1">import SMESH_mechanic</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">smesh =
- SMESH_mechanic.smesh</p>
-
-<p class="whs1">mesh =
- SMESH_mechanic.mesh</p>
-
-<p class="whs1">salome = SMESH_mechanic.salome</p>
-
-<p class="whs2"> </p>
-
-<p class="whs2"># add node</p>
-
-<p class="whs1">aMeshEditor = mesh.GetMeshEditor()</p>
-
-<p class="whs1">if aMeshEditor.AddNode(50,
- 10, 0) == 1:</p>
-
-<p class="whs1"> print
- "Node addition is OK!"</p>
-
-<p class="whs1">else:</p>
-
-<p class="whs1"> print
- "KO node addition."</p>
-
-<p class="whs1"> </p>
-
-<p class="whs2"># add edge</p>
-
-<p class="whs1">LastNodeId = mesh.NbNodes()</p>
-
-<p class="whs1">if aMeshEditor.AddEdge([LastNodeId,
- 38]) == 1:</p>
-
-<p class="whs1"> print
- "Edge addition is OK!"</p>
-
-<p class="whs1">else:</p>
-
-<p class="whs1"> print
- "KO edge addition."</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">salome.sg.updateObjBrowser(1)
- </p>
-
-<p class="whs1"> </p>
-
-<h4>Add Triangle</h4>
-
-<p class="whs1">import SMESH</p>
-
-<p class="whs1">import SMESH_mechanic</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">smesh =
- SMESH_mechanic.smesh</p>
-
-<p class="whs1">mesh =
- SMESH_mechanic.mesh</p>
-
-<p class="whs1">salome = SMESH_mechanic.salome</p>
-
-<p class="whs1"> </p>
-
-<p class="whs2"># add node</p>
-
-<p class="whs1">aMeshEditor = mesh.GetMeshEditor()</p>
-
-<p class="whs1">if aMeshEditor.AddNode(50,
- 10, 0) == 1:</p>
-
-<p class="whs1"> print
- "Node addition is OK!"</p>
-
-<p class="whs1">else:</p>
-
-<p class="whs1"> print
- "KO node addition."</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">LastNodeId = mesh.NbNodes()</p>
-
-<p class="whs2"> </p>
-
-<p class="whs2"># add triangle</p>
-
-<p class="whs1">if aMeshEditor.AddFace([LastNodeId,
- 38, 39]) == 1:</p>
-
-<p class="whs1"> print
- "Triangle addition is OK!"</p>
-
-<p class="whs1">else:</p>
-
-<p class="whs1"> print
- "KO triangle addition."</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">salome.sg.updateObjBrowser(1)
- </p>
-
-<p class="whs1"> </p>
-
-<h4>Add Quadrangle</h4>
-
-<p class="whs1">import SMESH</p>
-
-<p class="whs1">import SMESH_mechanic</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">smesh =
- SMESH_mechanic.smesh</p>
-
-<p class="whs1">mesh =
- SMESH_mechanic.mesh</p>
-
-<p class="whs1">salome = SMESH_mechanic.salome</p>
-
-<p class="whs1"> </p>
-
-<p class="whs2"># add node</p>
-
-<p class="whs1">aMeshEditor = mesh.GetMeshEditor()</p>
-
-<p class="whs1">if aMeshEditor.AddNode(50,
- 10, 0) == 1:</p>
-
-<p class="whs1"> print
- "Node addition is OK!"</p>
-
-<p class="whs1">else:</p>
-
-<p class="whs1"> print
- "KO node addition."</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">LastNodeId = mesh.NbNodes()</p>
-
-<p class="whs2"> </p>
-
-<p class="whs2"># add quadrangle</p>
-
-<p class="whs1">if aMeshEditor.AddNode(40,
- 20, 0) == 1:</p>
-
-<p class="whs1"> print
- "Node addition is OK!"</p>
-
-<p class="whs1">else:</p>
-
-<p class="whs1"> print
- "KO node addition."</p>
-
-<p class="whs1">if aMeshEditor.AddFace([mesh.NbNodes(),
- LastNodeId, 38, 39]) == 1:</p>
-
-<p class="whs1"> print
- "Quadrangle addition is OK!"</p>
-
-<p class="whs1">else:</p>
-
-<p class="whs1"> print
- "KO quadrangle addition."</p>
-
-<p class="whs1"> </p>
-
-<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
- </p>
-
-<p class="whs2"> </p>
-
-<h4>Add Tetrahedron</h4>
-
-<p class="whs1">import SMESH</p>
-
-<p class="whs1">import SMESH_mechanic</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">smesh =
- SMESH_mechanic.smesh</p>
-
-<p class="whs1">mesh =
- SMESH_mechanic.mesh</p>
-
-<p class="whs1">salome = SMESH_mechanic.salome</p>
-
-<p class="whs1"> </p>
-
-<p class="whs2"># add node</p>
-
-<p class="whs1">aMeshEditor = mesh.GetMeshEditor()</p>
-
-<p class="whs1">if aMeshEditor.AddNode(50,
- 10, 0) == 1:</p>
-
-<p class="whs1"> print
- "Node addition is OK!"</p>
-
-<p class="whs1">else:</p>
-
-<p class="whs1"> print
- "KO node addition."</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">LastNodeId = mesh.NbNodes()</p>
-
-<p class="whs2"> </p>
-
-<p class="whs2"># add tetrahedron</p>
-
-<p class="whs1">if aMeshEditor.AddVolume([LastNodeId,
- 38, 39, 246]) == 1:</p>
-
-<p class="whs1"> print
- "Tetrahedron addition is OK!"</p>
-
-<p class="whs1">else:</p>
-
-<p class="whs1"> print
- "KO tetrahedron addition."</p>
-
-<p class="whs1"> </p>
-
-<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
- </p>
-
-<p class="whs2"> </p>
-
-<h4>Add Hexahedron</h4>
-
-<p class="whs1">import SMESH</p>
-
-<p class="whs1">import SMESH_mechanic</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">smesh =
- SMESH_mechanic.smesh</p>
-
-<p class="whs1">mesh =
- SMESH_mechanic.mesh</p>
-
-<p class="whs1">salome = SMESH_mechanic.salome</p>
-
-<p class="whs1"> </p>
-
-<p class="whs2"># add nodes</p>
-
-<p class="whs1">aMeshEditor = mesh.GetMeshEditor()</p>
-
-<p class="whs1">if aMeshEditor.AddNode(50,
- 10, 0) == 1:</p>
-
-<p class="whs1"> print
- "Node addition is OK!"</p>
-
-<p class="whs1">else:</p>
-
-<p class="whs1"> print
- "KO node addition."</p>
-
-<p class="whs1">aNodeId1 = mesh.NbNodes()</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">if aMeshEditor.AddNode(47,
- 12, 0) == 1:</p>
-
-<p class="whs1"> print
- "Node addition is OK!"</p>
-
-<p class="whs1">else:</p>
-
-<p class="whs1"> print
- "KO node addition."</p>
-
-<p class="whs1">aNodeId2 = mesh.NbNodes()</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">if aMeshEditor.AddNode(50,
- 10, 10) == 1:</p>
-
-<p class="whs1"> print
- "Node addition is OK!"</p>
-
-<p class="whs1">else:</p>
-
-<p class="whs1"> print
- "KO node addition."</p>
-
-<p class="whs1">aNodeId3 = mesh.NbNodes()</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">if aMeshEditor.AddNode(47,
- 12, 10) == 1:</p>
-
-<p class="whs1"> print
- "Node addition is OK!"</p>
-
-<p class="whs1">else:</p>
-
-<p class="whs1"> print
- "KO node addition."</p>
-
-<p class="whs1">aNodeId4 = mesh.NbNodes()</p>
-
-<p class="whs1"> </p>
-
-<p class="whs2"># add hexahedron</p>
-
-<p class="whs1">if aMeshEditor.AddVolume([aNodeId2,
- aNodeId1, 38, 39, aNodeId4, aNodeId3, 245, 246]) == 1:</p>
-
-<p class="whs1"> print
- "Hexahedron addition is OK!"</p>
-
-<p class="whs1">else:</p>
-
-<p class="whs1"> print
- "KO Hexahedron addition."</p>
-
-<p class="whs1"> </p>
-
-<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
- </p>
-
-<p class="whs2"> </p>
-
-<h4>Add Polygon</h4>
-
-<p class="whs1">import salome</p>
-
-<p class="whs1">import geompy</p>
-
-<p class="whs1">import math</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">import StdMeshers</p>
-
-<p class="whs1"> </p>
-
-<p class="whs2"># GEOM module </p>
-
-<p class="whs1">shape_mesh = geompy.MakeCylinderRH(13,
- 77)</p>
-
-<p class="whs1">geompy.addToStudy(shape_mesh,
- "cylinder")</p>
-
-<p class="whs1"> </p>
-
-<p class="whs2"># SMESH module</p>
-
-<p class="whs1">smesh = salome.lcc.FindOrLoadComponent("FactoryServer",
- "SMESH")</p>
-
-<p class="whs1">smesh.SetCurrentStudy(salome.myStudy)</p>
-
-<p class="whs1">mesh = smesh.CreateMesh(shape_mesh)</p>
-
-<p class="whs1">MeshEditor = mesh.GetMeshEditor()</p>
-
-<p class="whs1"> </p>
-
-<p class="whs2"># a method to build a polygonal
- mesh element with nb_vert angles:</p>
-
-<p class="whs1">def MakePolygon
- (a_mesh, x0, y0, z0, radius, nb_vert):</p>
-
-<p class="whs1"> node_start_id
- = a_mesh.NbNodes() + 1</p>
-
-<p class="whs1"> al
- = 2.0 * math.pi / nb_vert</p>
-
-<p class="whs1"> node_ids
- = []</p>
-
-<p class="whs2"> </p>
-
-<p class="whs2"># Create nodes for a polyhedron</p>
-
-<p class="whs1"> for
- ii in range(nb_vert):</p>
-
-<p class="whs1"> MeshEditor.AddNode(x0
- + radius * math.cos(ii*al),</p>
-
-<p class="whs1"> y0
- + radius * math.sin(ii*al),</p>
-
-<p class="whs1"> z0)</p>
-
-<p class="whs1"> node_ids.append(node_start_id
- + ii)</p>
-
-<p class="whs1"> pass</p>
-
-<p class="whs2"> </p>
-
-<p class="whs2"># Create a polygon</p>
-
-<p class="whs1"> MeshEditor.AddPolygonalFace(node_ids)</p>
-
-<p class="whs1"> return
- 0</p>
-
-<p class="whs1"> </p>
-
-<p class="whs2"># Create three polygons</p>
-
-<p class="whs1">MakePolygon(mesh,
- 0, 0, 0,
- 30, 13)</p>
-
-<p class="whs1">MakePolygon(mesh,
- 0, 0, 10, 21, 9)</p>
-
-<p class="whs1">MakePolygon(mesh,
- 0, 0, 20, 13, 6)</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">salome.sg.updateObjBrowser(1)
- </p>
-
-<p class="whs1"> </p>
-
-<h4>Add polyhedron</h4>
-
-<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">import
- salome</span></p>
-
-<p class="whs1">import geompy</p>
-
-<p class="whs1">import math</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">#import SMESH</p>
-
-<p class="whs1">import StdMeshers</p>
-
-<p class="whs1"> </p>
-
-<p class="whs3"># GEOM</p>
-
-<p class="whs1">shape_mesh = geompy.MakeCylinderRH(13,
- 77)</p>
-
-<p class="whs1">geompy.addToStudy(shape_mesh,
- "cylinder")</p>
-
-<p class="whs1"> </p>
-
-<p class="whs3"># SMESH</p>
-
-<p class="whs1">smesh = salome.lcc.FindOrLoadComponent("FactoryServer",
- "SMESH")</p>
-
-<p class="whs1">smesh.SetCurrentStudy(salome.myStudy)</p>
-
-<p class="whs1">mesh = smesh.CreateMesh(shape_mesh)</p>
-
-<p class="whs1">MeshEditor = mesh.GetMeshEditor()</p>
-
-<p class="whs1"> </p>
-
-<p class="whs3"># Now we are going
- to create a 12-hedron:</p>
-
-<p class="whs3"> </p>
-
-<p class="whs3"># Create nodes for
- polyhedron</p>
-
-<p class="whs1">al = 2 * math.pi
- / 5.0</p>
-
-<p class="whs1">cosal = math.cos(al)</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">aa = 13</p>
-
-<p class="whs1">rr = aa / (2.0 *
- math.sin(al/2.0))</p>
-
-<p class="whs1">dr = 2.0 * rr *
- cosal</p>
-
-<p class="whs1">r1 = rr + dr</p>
-
-<p class="whs1">dh = rr * math.sqrt(2.0
- * (1.0 - cosal * (1.0 + 2.0 * cosal)))</p>
-
-<p class="whs1">hh = 2.0 * dh -
- dr * (rr*(cosal - 1) + (rr + dr)*(math.cos(al/2) - 1)) / dh</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">for i in range(5):</p>
-
-<p class="whs1"> MeshEditor.AddNode(rr*math.cos(i*al),
- rr*math.sin(i*al), 0)
- <span style="font-family: 'Times New Roman', serif;"># 1,3,5,7, 9 # bottom</span></p>
-
-<p class="whs1"> MeshEditor.AddNode(r1*math.cos(i*al),
- r1*math.sin(i*al), dh) <span style="font-family: 'Times New Roman', serif;">#
- 2,4,6,8,10 # above bottom</span></p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">for i in range(5):</p>
-
-<p class="whs1"> MeshEditor.AddNode(rr*math.cos(i*al
- + al/2.0),</p>
-
-<p class="whs1"> rr*math.sin(i*al
- + al/2.0), hh) # 11,13,15,17,19 <span style="font-family: 'Times New Roman', serif;">#
- top</span></p>
-
-<p class="whs1"> MeshEditor.AddNode(r1*math.cos(i*al
- + al/2.0),</p>
-
-<p class="whs1"> r1*math.sin(i*al
- + al/2.0), hh - dh) # 12,14,16,18,20 <span style="font-family: 'Times New Roman', serif;">#
- below top</span></p>
-
-<p class="whs1"> </p>
-
-<p class="whs3"># Create a polyhedral
- volume</p>
-
-<p class="whs1">MeshEditor.AddPolyhedralVolume([
- 1, 3, 5,
- 7, 9,
- <span style="font-family: 'Times New Roman', serif;">#
- bottom</span></p>
-
-<p class="whs1"> 1,
- 2, 12,
- 4, 3,
- <span style="font-family: 'Times New Roman', serif;">#
- .</span></p>
-
-<p class="whs1"> 3,
- 4, 14,
- 6, 5,
- <span style="font-family: 'Times New Roman', serif;">#
- .</span></p>
-
-<p class="whs1"> 5,
- 6, 16,
- 8, 7,
- <span style="font-family: 'Times New Roman', serif;">#
- . above bottom</span></p>
-
-<p class="whs1"> 7,
- 8, 18,
- 10, 9,
- <span style="font-family: 'Times New Roman', serif;">#
- .</span></p>
-
-<p class="whs1"> 9,
- 10, 20, 2,
- 1, <span
- style="font-family: 'Times New Roman', serif;">#
- .</span></p>
-
-<p class="whs1"> 11,
- 12, 4,
- 14, 13, <span style="font-family: 'Times New Roman', serif;">#
- -</span></p>
-
-<p class="whs1"> 13,
- 14, 6,
- 16, 15, <span style="font-family: 'Times New Roman', serif;">#
- -</span></p>
-
-<p class="whs1"> 15,
- 16, 8,
- 18, 17, <span style="font-family: 'Times New Roman', serif;">#
- - below top</span></p>
-
-<p class="whs1"> 17,
- 18, 10, 20, 19, <span style="font-family: 'Times New Roman', serif;">#
- -</span></p>
-
-<p class="whs1"> 19,
- 20, 2,
- 12, 11, <span style="font-family: 'Times New Roman', serif;">#
- -</span></p>
-
-<p class="whs1"> 11,
- 13, 15, 17, 19], <span style="font-family: 'Times New Roman', serif;">#
- top</span></p>
-
-<p class="whs1"> [5,5,5,5,5,5,5,5,5,5,5,5])</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">salome.sg.updateObjBrowser(1)
- </p>
-
-<p class="whs1"> </p>
-
-<h3><a name=bookmark1>Removing Nodes and Elements</a></h3>
-
-<h4 class="whs4">Removing Nodes</h4>
-
-<p class="whs2"> </p>
-
-<p class="whs1">import SMESH</p>
-
-<p class="whs1">import SMESH_mechanic</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">smesh =
- SMESH_mechanic.smesh</p>
-
-<p class="whs1">mesh =
- SMESH_mechanic.mesh</p>
-
-<p class="whs1">salome = SMESH_mechanic.salome</p>
-
-<p class="whs2"> </p>
-
-<p class="whs2"># add node</p>
-
-<p class="whs1">aMeshEditor = mesh.GetMeshEditor()</p>
-
-<p class="whs1">if aMeshEditor.RemoveNodes([246,
- 255]) == 1:</p>
-
-<p class="whs1"> print
- "Node removing is OK!"</p>
-
-<p class="whs1">else:</p>
-
-<p class="whs1"> print
- "KO node removing."</p>
-
-<p class="whs1"> </p>
-
-<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
- </p>
-
-<p class="whs2"> </p>
-
-<h4>Removing Elements</h4>
-
-<p class="whs1">import SMESH</p>
-
-<p class="whs1">import SMESH_mechanic</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">smesh =
- SMESH_mechanic.smesh</p>
-
-<p class="whs1">mesh =
- SMESH_mechanic.mesh</p>
-
-<p class="whs1">salome = SMESH_mechanic.salome</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">anEditor = mesh.GetMeshEditor()</p>
-
-<p class="whs1">anEditor.RemoveElements([850,
- 859, 814])</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">salome.sg.updateObjBrowser(1)
- </p>
-
-<p class="whs1"> </p>
-
-<h3><a name=bookmark2>Renumbering Nodes and Elements</a></h3>
-
-<p class="whs5">import SMESH</p>
-
-<p class="whs5">import SMESH_mechanic</p>
-
-<p class="whs5"> </p>
-
-<p class="whs5">mesh =
- SMESH_mechanic.mesh</p>
-
-<p class="whs5">salome = SMESH_mechanic.salome</p>
-
-<p class="whs5"> </p>
-
-<p class="whs5">anEditor = mesh.GetMeshEditor()</p>
-
-<p class="whs5">anEditor.RenumberNodes()</p>
-
-<p class="whs5"> </p>
-
-<p class="whs6"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
- </p>
-
-<p class="whs6"> </p>
-
-<p> </p>
-
-<h3><a name=bookmark3>Moving Nodes</a></h3>
-
-<p class="whs1">import SMESH</p>
-
-<p class="whs1">import SMESH_mechanic</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">smesh =
- SMESH_mechanic.smesh</p>
-
-<p class="whs1">mesh =
- SMESH_mechanic.mesh</p>
-
-<p class="whs1">salome = SMESH_mechanic.salome</p>
-
-<p class="whs1"> </p>
-
-<p class="whs2"># move node</p>
-
-<p class="whs1">aMeshEditor = mesh.GetMeshEditor()</p>
-
-<p class="whs1">aMeshEditor.MoveNode(38,
- 20, 10, 0)</p>
-
-<p class="whs1"> </p>
-
-<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
- </p>
-
-<p class="whs2"> </p>
-
-<h3><a name=bookmark4>Diagonal Inversion</a></h3>
-
-<p class="whs1">import SMESH</p>
-
-<p class="whs1">import SMESH_mechanic</p>
-
-<p class="whs1"> </p>
-
-<p class="whs1">smesh =
- SMESH_mechanic.smesh</p>
-
-<p class="whs1">mesh =
- SMESH_mechanic.mesh</p>
-
-<p class="whs1">salome = SMESH_mechanic.salome</p>
-
-<p class="whs1"> </p>
-
-<p class="whs2"># inverse diagonal</p>
-
-<p class="whs1">aMeshEditor = mesh.GetMeshEditor()</p>
-
-<p class="whs1">aMeshEditor.InverseDiag(700,
- 642)</p>
-
-<p class="whs1"> </p>
-
-<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
- </p>
-
-<p class="whs2"> </p>
-
-<h3><a name=bookmark5>Uniting two Triangles</a></h3>
-
-<p class="whs7">import SMESH</p>
-
-<p class="whs7">import SMESH_mechanic</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">smesh =
- SMESH_mechanic.smesh</p>
-
-<p class="whs7">mesh =
- SMESH_mechanic.mesh</p>
-
-<p class="whs7">salome = SMESH_mechanic.salome</p>
-
-<p class="whs7"> </p>
-
-<p># delete diagonal</p>
-
-<p class="whs7">aMeshEditor = mesh.GetMeshEditor()</p>
-
-<p class="whs7">aMeshEditor.DeleteDiag(700,
- 642)</p>
-
-<p class="whs7"> </p>
-
-<p><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
- </p>
-
-<p> </p>
-
-<h3><a name=bookmark6>Uniting a Set of Triangles</a></h3>
-
-<p class="whs7">import SMESH</p>
-
-<p class="whs7">import SMESH_mechanic</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">smesh =
- SMESH_mechanic.smesh</p>
-
-<p class="whs7">mesh =
- SMESH_mechanic.mesh</p>
-
-<p class="whs7">salome = SMESH_mechanic.salome</p>
-
-<p class="whs7"> </p>
-
-<p># unite a set of triangles</p>
-
-<p class="whs7">aFilterMgr = smesh.CreateFilterManager()</p>
-
-<p class="whs7">aFunctor = aFilterMgr.CreateMinimumAngle()</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">aMeshEditor = mesh.GetMeshEditor()</p>
-
-<p class="whs7">aMeshEditor.TriToQuad([1145,
- 1147, 1159, 1135], aFunctor, 60)</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">salome.sg.updateObjBrowser(1)
- </p>
-
-<p class="whs7"> </p>
-
-<h3><a name=bookmark12>Orientation</a></h3>
-
-<p class="whs7"><span style="font-family: 'Lucida Console', monospace;">import
- salome</span></p>
-
-<p class="whs7">import geompy</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">import StdMeshers</p>
-
-<p class="whs7"> </p>
-
-<p class="whs8"># GEOM module</p>
-
-<p class="whs7">shape_mesh = geompy.MakeCylinderRH(13,
- 77)</p>
-
-<p class="whs7">geompy.addToStudy(shape_mesh,
- "cylinder")</p>
-
-<p class="whs7"> </p>
-
-<p class="whs8"># SMESH module</p>
-
-<p class="whs7">smesh = salome.lcc.FindOrLoadComponent("FactoryServer",
- "SMESH")</p>
-
-<p class="whs7">smesh.SetCurrentStudy(salome.myStudy)</p>
-
-<p class="whs7">mesh = smesh.CreateMesh(shape_mesh)</p>
-
-<p class="whs7">MeshEditor = mesh.GetMeshEditor()</p>
-
-<p class="whs7"> </p>
-
-<p class="whs8"># build five quadrangles:</p>
-
-<p class="whs7">node_start_id = mesh.NbNodes()
- + 1</p>
-
-<p class="whs7">dx = 10</p>
-
-<p class="whs7">dy = 20</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">MeshEditor.AddNode(0.0
- * dx, 0, 0) # 1</p>
-
-<p class="whs7">MeshEditor.AddNode(1.0
- * dx, 0, 0) # 2</p>
-
-<p class="whs7">MeshEditor.AddNode(2.0
- * dx, 0, 0) # 3</p>
-
-<p class="whs7">MeshEditor.AddNode(3.0
- * dx, 0, 0) # 4</p>
-
-<p class="whs7">MeshEditor.AddNode(4.0
- * dx, 0, 0) # 5</p>
-
-<p class="whs7">MeshEditor.AddNode(5.0
- * dx, 0, 0) # 6</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">MeshEditor.AddNode(0.0
- * dx, dy, 0) # 7</p>
-
-<p class="whs7">MeshEditor.AddNode(1.0
- * dx, dy, 0) # 8</p>
-
-<p class="whs7">MeshEditor.AddNode(2.0
- * dx, dy, 0) # 9</p>
-
-<p class="whs7">MeshEditor.AddNode(3.0
- * dx, dy, 0) # 10</p>
-
-<p class="whs7">MeshEditor.AddNode(4.0
- * dx, dy, 0) # 11</p>
-
-<p class="whs7">MeshEditor.AddNode(5.0
- * dx, dy, 0) # 12</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">MeshEditor.AddFace([1,
- 2, 8, 7])</p>
-
-<p class="whs7">MeshEditor.AddFace([2,
- 3, 9, 8])</p>
-
-<p class="whs7">MeshEditor.AddFace([3,
- 4, 10, 9])</p>
-
-<p class="whs7">MeshEditor.AddFace([4,
- 5, 11, 10])</p>
-
-<p class="whs7">MeshEditor.AddFace([5,
- 6, 12, 11])</p>
-
-<p class="whs7"> </p>
-
-<p class="whs8"># Change orientation
- of the second and the fourth faces.</p>
-
-<p class="whs7">MeshEditor.Reorient([2,
- 4])</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">salome.sg.updateObjBrowser(1)
- </p>
-
-<p class="whs7"> </p>
-
-<h3><a name=bookmark7>Cutting Quadrangles</a></h3>
-
-<p class="whs7">import SMESH</p>
-
-<p class="whs7">import SMESH_mechanic</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">smesh =
- SMESH_mechanic.smesh</p>
-
-<p class="whs7">mesh =
- SMESH_mechanic.mesh</p>
-
-<p class="whs7">salome = SMESH_mechanic.salome</p>
-
-<p class="whs7"> </p>
-
-<p class="whs8"># unite a set of triangles</p>
-
-<p class="whs7">aFilterMgr = smesh.CreateFilterManager()</p>
-
-<p class="whs7">aFunctor = aFilterMgr.CreateMinimumAngle()</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">aMeshEditor = mesh.GetMeshEditor()</p>
-
-<p class="whs7">aMeshEditor.QuadToTri([405,
- 406], aFunctor)</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">salome.sg.updateObjBrowser(1)
- </p>
-
-<p class="whs8"> </p>
-
-<h3><a name=bookmark8>Smoothing</a></h3>
-
-<p class="whs7">import SMESH</p>
-
-<p class="whs7">import SMESH_mechanic</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">smesh =
- SMESH_mechanic.smesh</p>
-
-<p class="whs7">mesh =
- SMESH_mechanic.mesh</p>
-
-<p class="whs7">salome = SMESH_mechanic.salome</p>
-
-<p class="whs7"> </p>
-
-<p class="whs8"># smooth</p>
-
-<p class="whs7">FacesSmooth = [911,
- 931, 950, 864, 932]</p>
-
-<p class="whs7">GroupSmooth = mesh.CreateGroup(SMESH.FACE,"Group
- of faces (smooth)")</p>
-
-<p class="whs7">GroupSmooth.Add(FacesSmooth)</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">aMeshEditor = mesh.GetMeshEditor()</p>
-
-<p class="whs7">aMeshEditor.SmoothObject(GroupSmooth,
- [], 20, 2, SMESH.SMESH_MeshEditor.CENTROIDAL_SMOOTH)</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">salome.sg.updateObjBrowser(1)
- </p>
-
-<p class="whs7"> </p>
-
-<p class="whs7"> </p>
-
-<h3><a name=bookmark9>Extrusion</a></h3>
-
-<p class="whs7">import SMESH</p>
-
-<p class="whs7">import SMESH_mechanic</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">smesh =
- SMESH_mechanic.smesh</p>
-
-<p class="whs7">mesh =
- SMESH_mechanic.mesh</p>
-
-<p class="whs7">salome = SMESH_mechanic.salome</p>
-
-<p class="whs7"> </p>
-
-<p class="whs8"># extrusion of the group</p>
-
-<p class="whs7">point = SMESH.PointStruct(0,
- 0, 5)</p>
-
-<p class="whs7">vector = SMESH.DirStruct(point)</p>
-
-<p class="whs7">FacesTriToQuad = [2381,
- 2382, 2383, 2384, 2385, 2386, 2387, 2388, 2389, 2390, 2391, 2392, 2393,
- 2394, 2395, 2396, 2397, 2398, 2399, 2400, 2401, 2402, 2403, 2404, 2405,
- 2406, 2407, 2408, 2409, 2410, 2411, 2412, 2413, 2414, 2415, 2416, 2417,
- 2418, 2419, 2420, 2421, 2422]</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">GroupTriToQuad = mesh.CreateGroup(SMESH.FACE,"Group
- of faces (quad)")</p>
-
-<p class="whs7">GroupTriToQuad.Add(FacesTriToQuad)</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">aMeshEditor = mesh.GetMeshEditor()</p>
-
-<p class="whs7">aMeshEditor.ExtrusionSweepObject(GroupTriToQuad,
- vector, 5)</p>
-
-<p class="whs7"> </p>
-
-<p class="whs8"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
- </p>
-
-<p class="whs8"> </p>
-
-<h3><a name=bookmark10>Extrusion along a Path</a></h3>
-
-<p class="whs7">import math</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">import salome</p>
-
-<p class="whs7">salome.salome_init()</p>
-
-<p class="whs7"> </p>
-
-<p class="whs8"># Geometry</p>
-
-<p class="whs7">import geompy</p>
-
-<p class="whs8"> </p>
-
-<p class="whs8"># 1. Create points</p>
-
-<p class="whs7">points = [[0, 0],
- [50, 30], [50, 110], [0, 150], [-80, 150], [-130, 70], [-130, -20]]</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">iv = 1</p>
-
-<p class="whs7">vertices = []</p>
-
-<p class="whs7">for point in points:</p>
-
-<p class="whs9">vert
- = geompy.MakeVertex(point[0], point[1], 0)</p>
-
-<p class="whs9">geompy.addToStudy(vert,
- "Vertex_" + `iv`)</p>
-
-<p class="whs9">vertices.append(vert)</p>
-
-<p class="whs9">iv
- += 1</p>
-
-<p class="whs9">pass</p>
-
-<p class="whs8"> </p>
-
-<p class="whs8"># 2. Create edges and
- wires</p>
-
-<p class="whs7">Edge_straight = geompy.MakeEdge(vertices[0],
- vertices[4])</p>
-
-<p class="whs7">Edge_bezierrr = geompy.MakeBezier(vertices)</p>
-
-<p class="whs7">Wire_polyline = geompy.MakePolyline(vertices)</p>
-
-<p class="whs7">Edge_Circle =
- geompy.MakeCircleThreePnt(vertices[0], vertices[1], vertices[2])</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">geompy.addToStudy(Edge_straight,
- "Edge_straight")</p>
-
-<p class="whs7">geompy.addToStudy(Edge_bezierrr,
- "Edge_bezierrr")</p>
-
-<p class="whs7">geompy.addToStudy(Wire_polyline,
- "Wire_polyline")</p>
-
-<p class="whs7">geompy.addToStudy(Edge_Circle
- , "Edge_Circle")</p>
-
-<p class="whs8"> </p>
-
-<p class="whs8"># 3. Explode wire on
- edges, as they will be used for mesh extrusion</p>
-
-<p class="whs7">Wire_polyline_edges
- = geompy.SubShapeAll(Wire_polyline, geompy.ShapeType["EDGE"])</p>
-
-<p class="whs7">for ii in range(len(Wire_polyline_edges)):</p>
-
-<p class="whs9">geompy.addToStudyInFather(Wire_polyline,
- Wire_polyline_edges[ii], "Edge_" + `ii + 1`)</p>
-
-<p class="whs9">pass</p>
-
-<p class="whs10"> </p>
-
-<p class="whs8"># Mesh</p>
-
-<p class="whs7">import smesh</p>
-
-<p class="whs7">import SMESH</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">gen = smesh.smesh</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">smeshgui = salome.ImportComponentGUI("SMESH")</p>
-
-<p class="whs7">smeshgui.Init(salome.myStudyId)</p>
-
-<p class="whs8"> </p>
-
-<p class="whs8"># 1D algorithm and three
- 1D hypotheses</p>
-
-<p class="whs7">Wire_discretisation
- = gen.CreateHypothesis('Regular_1D', 'libStdMeshersEngine.so')</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">Nb_Segments_3 = gen.CreateHypothesis('NumberOfSegments',
- 'libStdMeshersEngine.so')</p>
-
-<p class="whs7">Nb_Segments_7 = gen.CreateHypothesis('NumberOfSegments',
- 'libStdMeshersEngine.so')</p>
-
-<p class="whs7">Nb_Segments_8 = gen.CreateHypothesis('NumberOfSegments',
- 'libStdMeshersEngine.so')</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">Nb_Segments_3.SetNumberOfSegments(3)</p>
-
-<p class="whs7">Nb_Segments_7.SetNumberOfSegments(7)</p>
-
-<p class="whs7">Nb_Segments_8.SetNumberOfSegments(8)</p>
-
-<p class="whs8"> </p>
-
-<p class="whs8"># Mesh given shape with
- given 1d hypothesis</p>
-
-<p class="whs7">def Mesh1D(shape1d,
- hyp1d, name):</p>
-
-<p class="whs9">mesh1d_tool
- = smesh.Mesh(shape1d)</p>
-
-<p class="whs9">mesh1d
- = mesh1d_tool.GetMesh()</p>
-
-<p class="whs9">status
- = mesh1d.AddHypothesis(shape1d, hyp1d)</p>
-
-<p class="whs9">status
- = mesh1d.AddHypothesis(shape1d, Wire_discretisation)</p>
-
-<p class="whs9">isDone
- = mesh1d_tool.Compute()</p>
-
-<p class="whs9">if
- not isDone: print 'Mesh ', name, ': computation failed'</p>
-
-<p class="whs9">return
- mesh1d</p>
-
-<p class="whs7"> </p>
-
-<p class="whs8"># Create mesh with six
- nodes, seven edges and two quadrangle faces</p>
-
-<p class="whs7">def MakeQuadMesh2(mesh_name):</p>
-
-<p class="whs9">quad_1
- = gen.CreateEmptyMesh()</p>
-
-<p class="whs9">smeshgui.SetName(salome.ObjectToID(quad_1),
- mesh_name)</p>
-
-<p class="whs9">editor_1
- = quad_1.GetMeshEditor()</p>
-
-<p class="whs10"> </p>
-
-<p class="whs10"># six nodes</p>
-
-<p class="whs9">n1
- = editor_1.AddNode(0, 20, 10)</p>
-
-<p class="whs9">n2
- = editor_1.AddNode(0, 40, 10)</p>
-
-<p class="whs9">n3
- = editor_1.AddNode(0, 40, 30)</p>
-
-<p class="whs9">n4
- = editor_1.AddNode(0, 20, 30)</p>
-
-<p class="whs9">n5
- = editor_1.AddNode(0, 0,
- 30)</p>
-
-<p class="whs9">n6
- = editor_1.AddNode(0, 0,
- 10)</p>
-
-<p class="whs10"> </p>
-
-<p class="whs10"># seven edges</p>
-
-<p class="whs9">editor_1.AddEdge([n1,
- n2]) # 1</p>
-
-<p class="whs9">editor_1.AddEdge([n2,
- n3]) # 2</p>
-
-<p class="whs9">editor_1.AddEdge([n3,
- n4]) # 3</p>
-
-<p class="whs9">editor_1.AddEdge([n4,
- n1]) # 4</p>
-
-<p class="whs9">editor_1.AddEdge([n4,
- n5]) # 5</p>
-
-<p class="whs9">editor_1.AddEdge([n5,
- n6]) # 6</p>
-
-<p class="whs9">editor_1.AddEdge([n6,
- n1]) # 7</p>
-
-<p class="whs10"> </p>
-
-<p class="whs10"># two quadrangle faces</p>
-
-<p class="whs9">editor_1.AddFace([n1,
- n2, n3, n4]) # 8</p>
-
-<p class="whs9">editor_1.AddFace([n1,
- n4, n5, n6]) # 9</p>
-
-<p class="whs9">return
- [quad_1, editor_1, [1,2,3,4,5,6,7], [8,9]]</p>
-
-<p class="whs8"> </p>
-
-<p class="whs8"># Path meshes</p>
-
-<p class="whs7">Edge_straight_mesh
- = Mesh1D(Edge_straight, Nb_Segments_7, "Edge_straight")</p>
-
-<p class="whs7">Edge_bezierrr_mesh
- = Mesh1D(Edge_bezierrr, Nb_Segments_7, "Edge_bezierrr")</p>
-
-<p class="whs7">Wire_polyline_mesh
- = Mesh1D(Wire_polyline, Nb_Segments_3, "Wire_polyline")</p>
-
-<p class="whs7">Edge_Circle_mesh =
- Mesh1D(Edge_Circle ,
- Nb_Segments_8, "Edge_Circle")</p>
-
-<p class="whs8"> </p>
-
-<p class="whs8"># Initial meshes (to
- be extruded)</p>
-
-<p class="whs7">[quad_1, editor_1,
- ee_1, ff_1] = MakeQuadMesh2("quad_1")</p>
-
-<p class="whs7">[quad_2, editor_2,
- ee_2, ff_2] = MakeQuadMesh2("quad_2")</p>
-
-<p class="whs7">[quad_3, editor_3,
- ee_3, ff_3] = MakeQuadMesh2("quad_3")</p>
-
-<p class="whs7">[quad_4, editor_4,
- ee_4, ff_4] = MakeQuadMesh2("quad_4")</p>
-
-<p class="whs7">[quad_5, editor_5,
- ee_5, ff_5] = MakeQuadMesh2("quad_5")</p>
-
-<p class="whs7">[quad_6, editor_6,
- ee_6, ff_6] = MakeQuadMesh2("quad_6")</p>
-
-<p class="whs7">[quad_7, editor_7,
- ee_7, ff_7] = MakeQuadMesh2("quad_7")</p>
-
-<p class="whs8"> </p>
-
-<p class="whs8"># ExtrusionAlongPath</p>
-
-<p class="whs8"># IDsOfElements, PathMesh,
- PathShape, NodeStart,</p>
-
-<p class="whs8"># HasAngles, Angles,
- HasRefPoint, RefPoint</p>
-
-<p class="whs8"> </p>
-
-<p class="whs7">refPoint = SMESH.PointStruct(0,
- 0, 0)</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">a10 = 10.0*math.pi/180.0</p>
-
-<p class="whs7">a45 = 45.0*math.pi/180.0</p>
-
-<p class="whs8"> </p>
-
-<p class="whs8"># 1. Extrusion of two
- mesh edges along straight path</p>
-
-<p class="whs7">error = editor_1.ExtrusionAlongPath([1,2],
- Edge_straight_mesh, Edge_straight, 1,</p>
-
-<p class="whs11"> 0,
- [], 0, refPoint)</p>
-
-<p class="whs8"> </p>
-
-<p class="whs8"># 2. Extrusion of one
- mesh edge along curved path</p>
-
-<p class="whs7">error = editor_2.ExtrusionAlongPath([2],
- Edge_bezierrr_mesh, Edge_bezierrr, 1,</p>
-
-<p class="whs11"> 0,
- [], 0, refPoint)</p>
-
-<p class="whs8"> </p>
-
-<p class="whs8"># 3. Extrusion of one
- mesh edge along curved path with angles usage</p>
-
-<p class="whs7">error = editor_3.ExtrusionAlongPath([2],
- Edge_bezierrr_mesh, Edge_bezierrr, 1,</p>
-
-<p class="whs11"> 1,
- [a45, a45, a45, 0, -a45, -a45, -a45], 0, refPoint)</p>
-
-<p class="whs8"> </p>
-
-<p class="whs8"># 4. Extrusion of one
- mesh edge along path, which is a part of meshed wire</p>
-
-<p class="whs7">error = editor_4.ExtrusionAlongPath([4],
- Wire_polyline_mesh, Wire_polyline_edges[0], 1,</p>
-
-<p class="whs11"> 1,
- [a10, a10, a10], 0, refPoint)</p>
-
-<p class="whs8"> </p>
-
-<p class="whs8"># 5. Extrusion of two
- mesh faces along path, which is a part of meshed wire</p>
-
-<p class="whs7">error = editor_5.ExtrusionAlongPath(ff_5
- , Wire_polyline_mesh, Wire_polyline_edges[2], 4,</p>
-
-<p class="whs11"> 0,
- [], 0, refPoint)</p>
-
-<p class="whs8"> </p>
-
-<p class="whs8"># 6. Extrusion of two
- mesh faces along closed path</p>
-
-<p class="whs7">error = editor_6.ExtrusionAlongPath(ff_6
- , Edge_Circle_mesh, Edge_Circle, 1,</p>
-
-<p class="whs11"> 0,
- [], 0, refPoint)</p>
-
-<p class="whs8"> </p>
-
-<p class="whs8"># 7. Extrusion of two
- mesh faces along closed path with angles usage</p>
-
-<p class="whs7">error = editor_7.ExtrusionAlongPath(ff_7,
- Edge_Circle_mesh, Edge_Circle, 1,</p>
-
-<p class="whs11"> 1,
- [a45, -a45, a45, -a45, a45, -a45, a45, -a45], 0, refPoint)</p>
-
-<p class="whs8"> </p>
-
-<p class="whs7">if salome.sg.hasDesktop():</p>
-
-<p class="whs12">salome.sg.updateObjBrowser(1)</p>
-
-<p class="whs12">pass</p>
-
-<h3><a name=bookmark11>Revolution</a></h3>
-
-<p class="whs7">import SMESH</p>
-
-<p class="whs7">import SMESH_mechanic</p>
-
-<p class="whs7">import math</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">smesh =
- SMESH_mechanic.smesh</p>
-
-<p class="whs7">mesh =
- SMESH_mechanic.mesh</p>
-
-<p class="whs7">salome = SMESH_mechanic.salome</p>
-
-<p class="whs8"> </p>
-
-<p class="whs8"># rotate a sweep object</p>
-
-<p class="whs7">FacesRotate = [492,
- 493, 502, 503]</p>
-
-<p class="whs7">GroupRotate = mesh.CreateGroup(SMESH.FACE,"Group
- of faces (rotate)")</p>
-
-<p class="whs7">GroupRotate.Add(FacesRotate)</p>
-
-<p class="whs7">angle45 = 45*math.pi/180</p>
-
-<p class="whs7">axisXYZ = SMESH.AxisStruct(-38.3128,
- -73.3658, -23.321, -13.3402, -13.3265, 6.66632)</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">aMeshEditor = mesh.GetMeshEditor()</p>
-
-<p class="whs7">aMeshEditor.RotationSweepObject(GroupRotate,
- axisXYZ, angle45, 4, 1e-5)</p>
-
-<p class="whs7"> </p>
-
-<p class="whs8"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
- </p>
-
-<p class="whs8"> </p>
-
-<h3><a name=bookmark13>Pattern Mapping</a></h3>
-
-<p class="whs7">import salome</p>
-
-<p class="whs7">import geompy</p>
-
-<p class="whs7">import SMESH, smesh</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">geompy.init_geom(salome.myStudy)</p>
-
-<p class="whs7">smesh.smesh.SetCurrentStudy(salome.myStudy)</p>
-
-<p class="whs7"> </p>
-
-<p class="whs8"># define geometry</p>
-
-<p class="whs7">Box_1 = geompy.MakeBoxDXDYDZ(200,
- 200, 200)</p>
-
-<p class="whs7">geompy.addToStudy(Box_1,
- "Box_1")</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">faces = geompy.SubShapeAll(Box_1,
- geompy.ShapeType["FACE"])</p>
-
-<p class="whs7">Face_1 = faces[0]</p>
-
-<p class="whs7">Face_2 = faces[1]</p>
-
-<p class="whs7">geompy.addToStudyInFather(Box_1,
- Face_1, "Face_1")</p>
-
-<p class="whs7">geompy.addToStudyInFather(Box_1,
- Face_2, "Face_2")</p>
-
-<p class="whs7"> </p>
-
-<p class="whs8"># build quadrangle mesh
- 3x3 on Face_1</p>
-
-<p class="whs7">Mesh_1 = smesh.Mesh(Face_1)</p>
-
-<p class="whs7">Wire_discretisation
- = Mesh_1.Segment()</p>
-
-<p class="whs7">Wire_discretisation.NumberOfSegments(3)</p>
-
-<p class="whs7">Mesh_1.Quadrangle()</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">isDone = Mesh_1.Compute()</p>
-
-<p class="whs7">if not isDone: print
- 'Mesh Mesh_1 : computation failed'</p>
-
-<p class="whs7"> </p>
-
-<p class="whs8"># pattern the mesh</p>
-
-<p class="whs7">Mesh_2 = smesh.Mesh(Face_2)</p>
-
-<p class="whs7">Nb_Segments_1 = smesh.smesh.CreateHypothesis('NumberOfSegments',
- 'libStdMeshersEngine.so')</p>
-
-<p class="whs7">Nb_Segments_1.SetNumberOfSegments(1)</p>
-
-<p class="whs7">status = Mesh_2.GetMesh().AddHypothesis(Face_2,
- Nb_Segments_1)</p>
-
-<p class="whs7">status = Mesh_2.GetMesh().AddHypothesis(Face_2,
- Wire_discretisation.GetAlgorithm())</p>
-
-<p class="whs7">Triangle_Mefisto =
- Mesh_2.Triangle()</p>
-
-<p class="whs7">Max_Element_Area =
- Triangle_Mefisto.MaxElementArea(240)</p>
-
-<p class="whs7"> </p>
-
-<p class="whs7">isDone = Mesh_2.Compute()</p>
-
-<p class="whs7">if not isDone: print
- 'Mesh Mesh_2 : computation failed'</p>
-
-<p class="whs7"> </p>
-
-<p class="whs8"># create a pattern</p>
-
-<p class="whs7">pattern = smesh.smesh.GetPattern()</p>
-
-<p class="whs7">isDone = pattern.LoadFromFace(Mesh_2.GetMesh(),
- Face_2, 0)</p>
-
-<p class="whs7">if (isDone != 1):</p>
-
-<p class="whs13">print
- 'LoadFromFace :', pattern.GetErrorCode()</p>
-
-<p class="whs7"> </p>
-
-<p class="whs8"># apply the pattern to
- a face of the first mesh</p>
-
-<p class="whs7">pattern.ApplyToMeshFaces(Mesh_1.GetMesh(),
- [17], 0, 0)</p>
-
-<p class="whs7">isDone = pattern.MakeMesh(Mesh_1.GetMesh(),
- 0, 0)</p>
-
-<p class="whs7">if (isDone != 1):</p>
-
-<p class="whs13">print
- 'MakeMesh :', pattern.GetErrorCode()</p>
-
-<p class="whs7"> </p>
-
-<p class="whs8"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
- </p>
-
-<script type="text/javascript" language="javascript1.2">
-<!--
-if (window.writeIntopicBar)
- writeIntopicBar(0);
-//-->
-</script>
-</body>
-</html>
+<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">\r
+\r
+<html>\r
+\r
+<head>\r
+<title>Modifying Meshes</title>\r
+<meta http-equiv="content-type" content="text/html; charset=windows-1252">\r
+<meta name="generator" content="RoboHelp by eHelp Corporation www.ehelp.com"><style>\r
+<!--\r
+P { margin-top:0pt; margin-bottom:0pt; }\r
+LI.kadov-P { }\r
+-->\r
+</style><style type="text/css">\r
+<!--\r
+p.whs1 { margin-top:0pt; margin-bottom:0pt; font-weight:bold; color:#ff0000; }\r
+p.whs2 { margin-top:0pt; margin-bottom:0pt; }\r
+p.whs3 { margin-top:0pt; margin-bottom:0pt; font-family:'Lucida Console' , monospace; }\r
+p.whs4 { margin-top:0pt; margin-bottom:0pt; font-family:'Times New Roman' , serif; }\r
+h4.whs5 { margin-top:0pt; margin-bottom:0pt; }\r
+p.whs6 { margin-top:0.5pt; margin-bottom:0pt; font-family:'Lucida Console' , monospace; }\r
+p.whs7 { margin-top:0.5pt; margin-bottom:0pt; }\r
+p.whs8 { margin-top:0.5pt; margin-bottom:0pt; font-family:'Times New Roman' , serif; }\r
+p.whs9 { font-family:'Lucida Console' , monospace; }\r
+p.whs10 { font-family:'Times New Roman' , serif; }\r
+p.whs11 { margin-left:36px; font-family:'Lucida Console' , monospace; }\r
+p.whs12 { margin-left:36px; }\r
+p.whs13 { margin-left:192px; font-family:'Lucida Console' , monospace; }\r
+p.whs14 { font-family:'Lucida Console' , monospace; margin-left:0px; }\r
+-->\r
+</style><script type="text/javascript" language="JavaScript">\r
+<!--\r
+if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))\r
+{\r
+ var strNSS = "<style type='text/css'>";\r
+ strNSS += "p.whs1 {margin-top:1pt;margin-bottom:1pt; }";\r
+ strNSS += "p.whs2 {margin-top:1pt;margin-bottom:1pt; }";\r
+ strNSS += "p.whs3 {margin-top:1pt;margin-bottom:1pt; }";\r
+ strNSS += "p.whs4 {margin-top:1pt;margin-bottom:1pt; }";\r
+ strNSS += "h4.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 += "p.whs8 {margin-top:1pt;margin-bottom:1pt; }";\r
+ strNSS += "p.whs14 {margin-left:1pt; }";\r
+ strNSS +="</style>";\r
+ document.write(strNSS);\r
+}\r
+//-->\r
+</script>\r
+<script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">\r
+<!--\r
+function reDo() {\r
+ if (innerWidth != origWidth || innerHeight != origHeight)\r
+ location.reload();\r
+}\r
+if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {\r
+ origWidth = innerWidth;\r
+ origHeight = innerHeight;\r
+ onresize = reDo;\r
+}\r
+onerror = null; \r
+//-->\r
+</script>\r
+<style type="text/css">\r
+<!--\r
+div.WebHelpPopupMenu { position:absolute; left:0px; top:0px; z-index:4; visibility:hidden; }\r
+p.WebHelpNavBar { text-align:right; }\r
+-->\r
+</style><script type="text/javascript" language="javascript1.2" src="whmsg.js"></script>\r
+<script type="text/javascript" language="javascript" src="whver.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="whproxy.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="whutils.js"></script>\r
+<script type="text/javascript" language="javascript1.2" src="whtopic.js"></script>\r
+<script type="text/javascript" language="javascript1.2">\r
+<!--\r
+if (window.gbWhTopic)\r
+{\r
+ if (window.setRelStartPage)\r
+ {\r
+ addTocInfo("MESH module\nTUI Scripts\nModifying Meshes");\r
+addButton("show",BTN_IMG,"Show","","","","",0,0,"whd_show0.gif","whd_show2.gif","whd_show1.gif");\r
+addButton("hide",BTN_IMG,"Hide","","","","",0,0,"whd_hide0.gif","whd_hide2.gif","whd_hide1.gif");\r
+\r
+ }\r
+\r
+\r
+ if (window.setRelStartPage)\r
+ {\r
+ setRelStartPage("index.htm");\r
+\r
+ autoSync(1);\r
+ sendSyncInfo();\r
+ sendAveInfoOut();\r
+ }\r
+\r
+}\r
+else\r
+ if (window.gbIE4)\r
+ document.location.reload();\r
+//-->\r
+</script>\r
+</head>\r
+<body><script type="text/javascript" language="javascript1.2">\r
+<!--\r
+if (window.writeIntopicBar)\r
+ writeIntopicBar(4);\r
+//-->\r
+</script>\r
+<h1>Modifying Meshes</h1>\r
+\r
+<h3><a name=bookmark>Adding Nodes and Elements</a></h3>\r
+\r
+<p class="whs1"># Attention! The scripts for Adding nodes \r
+ and Elements have \r
+ been written using the old approach basing on direct usage of SMESH idl \r
+ interface.</p>\r
+\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to add nodes and elements. </p>\r
+\r
+<p class="whs2"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ In the next SALOME version the scripts will be updated to use only the \r
+ commands from smesh package.</B></font></span></p>\r
+\r
+<h4>Add Node</h4>\r
+\r
+<p class="whs3"><span style="font-family: 'Lucida Console', monospace;">import \r
+ SMESH</span></p>\r
+\r
+<p class="whs3">import SMESH_mechanic</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">mesh = SMESH_mechanic.mesh</p>\r
+\r
+<p class="whs3">aMeshEditor = mesh.GetMeshEditor()</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"># add node</p>\r
+\r
+<p class="whs3">new_id = aMeshEditor.AddNode(50, \r
+ 10, 0)</p>\r
+\r
+<p class="whs3">print ""</p>\r
+\r
+<p class="whs3">if new_id == 0: \r
+ print "KO node addition."</p>\r
+\r
+<p class="whs3">else: print \r
+ "New Node has been added with ID ", new_id </p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<h4>Add Edge</h4>\r
+\r
+<p class="whs3"><span style="font-family: 'Lucida Console', monospace;">import \r
+ SMESH</span></p>\r
+\r
+<p class="whs3">import SMESH_mechanic</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">mesh = SMESH_mechanic.mesh</p>\r
+\r
+<p class="whs3">aMeshEditor = mesh.GetMeshEditor()</p>\r
+\r
+<p class="whs3">print ""</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"># add node</p>\r
+\r
+<p class="whs3">n1 = aMeshEditor.AddNode(50, \r
+ 10, 0)</p>\r
+\r
+<p class="whs3">if n1 == 0: print \r
+ "KO node addition."</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"># add edge</p>\r
+\r
+<p class="whs3">e1 = aMeshEditor.AddEdge([n1, \r
+ 38])</p>\r
+\r
+<p class="whs3">if e1 == 0: print \r
+ "KO edge addition."</p>\r
+\r
+<p class="whs3">else: print \r
+ "New Edge has been added with ID ", e1 </p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<h4>Add Triangle</h4>\r
+\r
+<p class="whs3"><span style="font-family: 'Lucida Console', monospace;">import \r
+ SMESH</span></p>\r
+\r
+<p class="whs3">import SMESH_mechanic</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">mesh = SMESH_mechanic.mesh</p>\r
+\r
+<p class="whs3">aMeshEditor = mesh.GetMeshEditor()</p>\r
+\r
+<p class="whs3">print ""</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"># add node</p>\r
+\r
+<p class="whs3">n1 = aMeshEditor.AddNode(50, \r
+ 10, 0)</p>\r
+\r
+<p class="whs3">if n1 == 0: print \r
+ "KO node addition."</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"># add triangle</p>\r
+\r
+<p class="whs3">t1 = aMeshEditor.AddFace([n1, \r
+ 38, 39])</p>\r
+\r
+<p class="whs3">if t1 == 0: print \r
+ "KO triangle addition."</p>\r
+\r
+<p class="whs3">else: print \r
+ "New Triangle has been added with ID ", t1 </p>\r
+\r
+<h4>Add Quadrangle</h4>\r
+\r
+<p class="whs3">import SMESH</p>\r
+\r
+<p class="whs3">import SMESH_mechanic</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">mesh = SMESH_mechanic.mesh</p>\r
+\r
+<p class="whs3">aMeshEditor = mesh.GetMeshEditor()</p>\r
+\r
+<p class="whs3">print ""</p>\r
+\r
+<p class="whs2"> </p>\r
+\r
+<p class="whs2"># add node</p>\r
+\r
+<p class="whs3">n1 = aMeshEditor.AddNode(50, \r
+ 10, 0)</p>\r
+\r
+<p class="whs3">if n1 == 0: print \r
+ "KO node addition."</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">n2 = aMeshEditor.AddNode(40, \r
+ 20, 0)</p>\r
+\r
+<p class="whs3">if n2 == 0: print \r
+ "KO node addition."</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs2"># add quadrangle</p>\r
+\r
+<p class="whs3">q1 = aMeshEditor.AddFace([n2, \r
+ n1, 38, 39])</p>\r
+\r
+<p class="whs3">if q1 == 0: print \r
+ "KO quadrangle addition."</p>\r
+\r
+<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">else: \r
+ print \r
+ "New Quadrangle has been added with ID ", q1</span> </p>\r
+\r
+<h4>Add Tetrahedron</h4>\r
+\r
+<p class="whs3">import SMESH </p>\r
+\r
+<p class="whs3">import SMESH_mechanic</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">mesh = SMESH_mechanic.mesh</p>\r
+\r
+<p class="whs3">aMeshEditor = mesh.GetMeshEditor()</p>\r
+\r
+<p class="whs3">print ""</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"># add node</p>\r
+\r
+<p class="whs3">n1 = aMeshEditor.AddNode(50, \r
+ 10, 0)</p>\r
+\r
+<p class="whs3">if n1 == 0: print \r
+ "KO node addition."</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"># add tetrahedron</p>\r
+\r
+<p class="whs3">t1 = aMeshEditor.AddVolume([n1, \r
+ 38, 39, 246])</p>\r
+\r
+<p class="whs3">if t1 == 0: print \r
+ "KO tetrahedron addition."</p>\r
+\r
+<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">else: \r
+ print \r
+ "New Tetrahedron has been added with ID ", t1</span> </p>\r
+\r
+<h4>Add Hexahedron</h4>\r
+\r
+<p class="whs3"><span style="font-family: 'Lucida Console', monospace;">import \r
+ SMESH</span></p>\r
+\r
+<p class="whs3">import SMESH_mechanic</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">mesh = SMESH_mechanic.mesh</p>\r
+\r
+<p class="whs3">aMeshEditor = mesh.GetMeshEditor()</p>\r
+\r
+<p class="whs3">print ""</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"># add nodes</p>\r
+\r
+<p class="whs3">nId1 = aMeshEditor.AddNode(50, \r
+ 10, 0)</p>\r
+\r
+<p class="whs3">nId2 = aMeshEditor.AddNode(47, \r
+ 12, 0)</p>\r
+\r
+<p class="whs3">nId3 = aMeshEditor.AddNode(50, \r
+ 10, 10)</p>\r
+\r
+<p class="whs3">nId4 = aMeshEditor.AddNode(47, \r
+ 12, 10)</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">if nId1 == 0 or \r
+ nId2 == 0 or nId3 == 0 or nId4 == 0: print "KO node addition."</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"># add hexahedron</p>\r
+\r
+<p class="whs3">vId = aMeshEditor.AddVolume([nId2, \r
+ nId1, 38, 39, nId4, nId3, 245, 246])</p>\r
+\r
+<p class="whs3">if vId == 0: print \r
+ "KO Hexahedron addition."</p>\r
+\r
+<p class="whs3">else: print \r
+ "New Hexahedron has been added with ID ", vId </p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<h4>Add Polygon</h4>\r
+\r
+<p class="whs3"><span style="font-family: 'Lucida Console', monospace;">import \r
+ math</span></p>\r
+\r
+<p class="whs3">import salome</p>\r
+\r
+<p class="whs3">import smesh</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"># create an empty mesh \r
+ structure</p>\r
+\r
+<p class="whs3">gen = smesh.smesh</p>\r
+\r
+<p class="whs3">mesh = gen.CreateEmptyMesh()</p>\r
+\r
+<p class="whs3">MeshEditor = mesh.GetMeshEditor()</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"># a method to build \r
+ a polygonal mesh element with <nb_vert> angles:</p>\r
+\r
+<p class="whs3">def MakePolygon \r
+ (a_mesh, x0, y0, z0, radius, nb_vert):</p>\r
+\r
+<p class="whs3"> al \r
+ = 2.0 * math.pi / nb_vert</p>\r
+\r
+<p class="whs3"> node_ids \r
+ = []</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"> # \r
+ Create nodes for a polygon</p>\r
+\r
+<p class="whs3"> for \r
+ ii in range(nb_vert):</p>\r
+\r
+<p class="whs3"> nid \r
+ = MeshEditor.AddNode(x0 + radius * math.cos(ii*al),</p>\r
+\r
+<p class="whs3"> y0 \r
+ + radius * math.sin(ii*al),</p>\r
+\r
+<p class="whs3"> z0)</p>\r
+\r
+<p class="whs3"> node_ids.append(nid)</p>\r
+\r
+<p class="whs3"> pass</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"> # \r
+ Create a polygon</p>\r
+\r
+<p class="whs3"> return \r
+ MeshEditor.AddPolygonalFace(node_ids)</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"># Create three polygons</p>\r
+\r
+<p class="whs3">f1 = MakePolygon(mesh, \r
+ 0, 0, 0, \r
+ 30, 13)</p>\r
+\r
+<p class="whs3">f2 = MakePolygon(mesh, \r
+ 0, 0, 10, 21, 9)</p>\r
+\r
+<p class="whs3">f3 = MakePolygon(mesh, \r
+ 0, 0, 20, 13, 6)</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">salome.sg.updateObjBrowser(1) \r
+ </p>\r
+\r
+<h4>Add Polyhedron</h4>\r
+\r
+<p class="whs3"><span style="font-family: 'Lucida Console', monospace;">import \r
+ salome</span></p>\r
+\r
+<p class="whs3">import math</p>\r
+\r
+<p class="whs3">import smesh</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"># create an empty mesh \r
+ structure</p>\r
+\r
+<p class="whs3">gen = smesh.smesh</p>\r
+\r
+<p class="whs3">mesh = gen.CreateEmptyMesh()</p>\r
+\r
+<p class="whs3">MeshEditor = mesh.GetMeshEditor()</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"># Create nodes for \r
+ 12-hedron with pentagonal faces</p>\r
+\r
+<p class="whs3">al = 2 * math.pi \r
+ / 5.0</p>\r
+\r
+<p class="whs3">cosal = math.cos(al)</p>\r
+\r
+<p class="whs3">aa = 13</p>\r
+\r
+<p class="whs3">rr = aa / (2.0 * \r
+ math.sin(al/2.0))</p>\r
+\r
+<p class="whs3">dr = 2.0 * rr * \r
+ cosal</p>\r
+\r
+<p class="whs3">r1 = rr + dr</p>\r
+\r
+<p class="whs3">dh = rr * math.sqrt(2.0 \r
+ * (1.0 - cosal * (1.0 + 2.0 * cosal)))</p>\r
+\r
+<p class="whs3">hh = 2.0 * dh - \r
+ dr * (rr*(cosal - 1) + (rr + dr)*(math.cos(al/2) - 1)) / dh</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">dd = [] <span style="font-family: 'Times New Roman', serif;"># \r
+ top</span></p>\r
+\r
+<p class="whs3">cc = [] <span style="font-family: 'Times New Roman', serif;"># \r
+ below top</span></p>\r
+\r
+<p class="whs3">bb = [] <span style="font-family: 'Times New Roman', serif;"># \r
+ above bottom</span></p>\r
+\r
+<p class="whs3">aa = [] <span style="font-family: 'Times New Roman', serif;"># \r
+ bottom</span></p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">for i in range(5):</p>\r
+\r
+<p class="whs3"> cos_bot \r
+ = math.cos(i*al)</p>\r
+\r
+<p class="whs3"> sin_bot \r
+ = math.sin(i*al)</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3"> <span \r
+ style="margin-top: 0pt;\r
+ margin-bottom: 0pt;\r
+ font-family: 'Lucida Console', monospace;">cos_top \r
+ = math.cos(i*al + al/2.0)</span></p>\r
+\r
+<p class="whs3"> sin_top \r
+ = math.sin(i*al + al/2.0)</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3"> nd \r
+ = MeshEditor.AddNode(rr * cos_top, rr * sin_top, hh ) \r
+ <span style="font-family: 'Times New Roman', serif;"># top</span></p>\r
+\r
+<p class="whs3"> nc \r
+ = MeshEditor.AddNode(r1 * cos_top, r1 * sin_top, hh - dh) <span style="font-family: 'Times New Roman', serif;"># \r
+ below top</span></p>\r
+\r
+<p class="whs3"> nb \r
+ = MeshEditor.AddNode(r1 * cos_bot, r1 * sin_bot, dh) \r
+ <span style="font-family: 'Times New Roman', serif;"># above bottom</span></p>\r
+\r
+<p class="whs3"> na \r
+ = MeshEditor.AddNode(rr * cos_bot, rr * sin_bot, 0) \r
+ <span style="font-family: 'Times New Roman', serif;"># bottom</span></p>\r
+\r
+<p class="whs3"> dd.append(nd) \r
+ <span style="font-family: 'Times New Roman', serif;"># top</span></p>\r
+\r
+<p class="whs3"> cc.append(nc) \r
+ <span style="font-family: 'Times New Roman', serif;"># below top</span></p>\r
+\r
+<p class="whs3"> bb.append(nb) \r
+ <span style="font-family: 'Times New Roman', serif;"># above bottom</span></p>\r
+\r
+<p class="whs3"> aa.append(na) \r
+ <span style="font-family: 'Times New Roman', serif;"># bottom</span></p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3"> pass</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"># Create a polyhedral \r
+ volume (12-hedron with pentagonal faces)</p>\r
+\r
+<p class="whs3">MeshEditor.AddPolyhedralVolume([dd[0], \r
+ dd[1], dd[2], dd[3], dd[4], <span style="font-family: 'Times New Roman', serif;"># \r
+ top</span></p>\r
+\r
+<p class="whs3"> dd[0], \r
+ cc[0], bb[1], cc[1], dd[1], # \r
+ -</p>\r
+\r
+<p class="whs3"> dd[1], \r
+ cc[1], bb[2], cc[2], dd[2], # \r
+ -</p>\r
+\r
+<p class="whs3"> dd[2], \r
+ cc[2], bb[3], cc[3], dd[3], <span style="font-family: 'Times New Roman', serif;"># \r
+ - below top</span></p>\r
+\r
+<p class="whs3"> dd[3], \r
+ cc[3], bb[4], cc[4], dd[4], # \r
+ -</p>\r
+\r
+<p class="whs3"> dd[4], \r
+ cc[4], bb[0], cc[0], dd[0], # \r
+ -</p>\r
+\r
+<p class="whs3"> aa[4], \r
+ bb[4], cc[4], bb[0], aa[0], # \r
+ .</p>\r
+\r
+<p class="whs3"> aa[3], \r
+ bb[3], cc[3], bb[4], aa[4], # \r
+ .</p>\r
+\r
+<p class="whs3"> aa[2], \r
+ bb[2], cc[2], bb[3], aa[3], <span style="font-family: 'Times New Roman', serif;"># \r
+ . above bottom</span></p>\r
+\r
+<p class="whs3"> aa[1], \r
+ bb[1], cc[1], bb[2], aa[2], # \r
+ .</p>\r
+\r
+<p class="whs3"> aa[0], \r
+ bb[0], cc[0], bb[1], aa[1], # \r
+ .</p>\r
+\r
+<p class="whs3"> aa[0], \r
+ aa[1], aa[2], aa[3], aa[4]], <span style="font-family: 'Times New Roman', serif;"># \r
+ bottom</span></p>\r
+\r
+<p class="whs3"> [5,5,5,5,5,5,5,5,5,5,5,5])</p>\r
+\r
+<p class="whs3">salome.sg.updateObjBrowser(1) \r
+ </p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<h3><a name=bookmark1>Removing Nodes and Elements</a></h3>\r
+\r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
+\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to remove nodes and elements. </p>\r
+\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
+\r
+<h4 class="whs5"> </h4>\r
+\r
+<h4 class="whs5">Removing Nodes</h4>\r
+\r
+<p class="whs2"> </p>\r
+\r
+<p class="whs3"><span style="font-family: 'Lucida Console', monospace;">import \r
+ SMESH_mechanic</span></p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">mesh = SMESH_mechanic.mesh</p>\r
+\r
+<p class="whs3">aMeshEditor = mesh.GetMeshEditor()</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"># remove nodes #246 \r
+ and #255</p>\r
+\r
+<p class="whs3">res = aMeshEditor.RemoveNodes([246, \r
+ 255])</p>\r
+\r
+<p class="whs3">if res == 1: print \r
+ "Nodes removing is OK!"</p>\r
+\r
+<p class="whs3">else: print \r
+ "KO nodes removing." </p>\r
+\r
+<p class="whs2"> </p>\r
+\r
+<h4>Removing Elements</h4>\r
+\r
+<p class="whs3"><span style="font-family: 'Lucida Console', monospace;">import \r
+ SMESH_mechanic</span></p>\r
+\r
+<p class="whs3">mesh = SMESH_mechanic.mesh</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">anEditor = mesh.GetMeshEditor()</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"># remove three elements: \r
+ #850, #859 and #814</p>\r
+\r
+<p class="whs3">res = anEditor.RemoveElements([850, \r
+ 859, 814])</p>\r
+\r
+<p class="whs3">if res == 1: print \r
+ "Elements removing is OK!"</p>\r
+\r
+<p class="whs3">else: print \r
+ "KO Elements removing." </p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<h3><a name=bookmark2>Renumbering Nodes and Elements</a></h3>\r
+\r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
+\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to renumber nodes and elements. </p>\r
+\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
+\r
+<p class="whs6"> </p>\r
+\r
+<p class="whs6">import SMESH_mechanic</p>\r
+\r
+<p class="whs6"> </p>\r
+\r
+<p class="whs6">mesh = SMESH_mechanic.mesh</p>\r
+\r
+<p class="whs6">anEditor = mesh.GetMeshEditor()</p>\r
+\r
+<p class="whs7"> </p>\r
+\r
+<p class="whs7"><span style="font-family: 'Lucida Console', monospace;">anEditor.RenumberNodes()</span> \r
+ </p>\r
+\r
+<h3><a name=bookmark3>Moving Nodes</a></h3>\r
+\r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
+\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to move nodes. </p>\r
+\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">import SMESH</p>\r
+\r
+<p class="whs3">import SMESH_mechanic</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">mesh = SMESH_mechanic.mesh</p>\r
+\r
+<p class="whs3">aMeshEditor = mesh.GetMeshEditor()</p>\r
+\r
+<p class="whs2"> </p>\r
+\r
+<p class="whs2"># move node #38</p>\r
+\r
+<p class="whs3">aMeshEditor.MoveNode(38, \r
+ 20., 10., 0.) </p>\r
+\r
+<p class="whs2"> </p>\r
+\r
+<h3><a name=bookmark4>Diagonal Inversion</a></h3>\r
+\r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
+\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to produce a diagonal inversion. </p>\r
+\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
+\r
+<p class="whs7"> </p>\r
+\r
+<p class="whs6">import salome</p>\r
+\r
+<p class="whs6">import smesh</p>\r
+\r
+<p class="whs6"> </p>\r
+\r
+<p class="whs8"># create an empty mesh \r
+ structure</p>\r
+\r
+<p class="whs6">gen = smesh.smesh</p>\r
+\r
+<p class="whs6">mesh = gen.CreateEmptyMesh()</p>\r
+\r
+<p class="whs6">aMeshEditor = mesh.GetMeshEditor()</p>\r
+\r
+<p class="whs6"> </p>\r
+\r
+<p class="whs8"># create the following \r
+ mesh:</p>\r
+\r
+<p class="whs6"># .----.----.----.</p>\r
+\r
+<p class="whs6"># | /| \r
+ /| \r
+ /|</p>\r
+\r
+<p class="whs6"># | / \r
+ | / | / \r
+ |</p>\r
+\r
+<p class="whs6"># | / | \r
+ / | / |</p>\r
+\r
+<p class="whs6"># |/ |/ \r
+ |/ \r
+ |</p>\r
+\r
+<p class="whs6"># .----.----.----.</p>\r
+\r
+<p class="whs6"> </p>\r
+\r
+<p class="whs6">bb = [0, 0, 0, 0]</p>\r
+\r
+<p class="whs6">tt = [0, 0, 0, 0]</p>\r
+\r
+<p class="whs6">ff = [0, 0, 0, 0, \r
+ 0, 0]</p>\r
+\r
+<p class="whs6"> </p>\r
+\r
+<p class="whs6">bb[0] = aMeshEditor.AddNode( \r
+ 0., 0., 0.)</p>\r
+\r
+<p class="whs6">bb[1] = aMeshEditor.AddNode(10., \r
+ 0., 0.)</p>\r
+\r
+<p class="whs6">bb[2] = aMeshEditor.AddNode(20., \r
+ 0., 0.)</p>\r
+\r
+<p class="whs6">bb[3] = aMeshEditor.AddNode(30., \r
+ 0., 0.)</p>\r
+\r
+<p class="whs6"> </p>\r
+\r
+<p class="whs6">tt[0] = aMeshEditor.AddNode( \r
+ 0., 15., 0.)</p>\r
+\r
+<p class="whs6">tt[1] = aMeshEditor.AddNode(10., \r
+ 15., 0.)</p>\r
+\r
+<p class="whs6">tt[2] = aMeshEditor.AddNode(20., \r
+ 15., 0.)</p>\r
+\r
+<p class="whs6">tt[3] = aMeshEditor.AddNode(30., \r
+ 15., 0.)</p>\r
+\r
+<p class="whs6"> </p>\r
+\r
+<p class="whs6">ff[0] = aMeshEditor.AddFace([bb[0], \r
+ bb[1], tt[1]])</p>\r
+\r
+<p class="whs6">ff[1] = aMeshEditor.AddFace([bb[0], \r
+ tt[1], tt[0]])</p>\r
+\r
+<p class="whs6">ff[2] = aMeshEditor.AddFace([bb[1], \r
+ bb[2], tt[2]])</p>\r
+\r
+<p class="whs6">ff[3] = aMeshEditor.AddFace([bb[1], \r
+ tt[2], tt[1]])</p>\r
+\r
+<p class="whs6">ff[4] = aMeshEditor.AddFace([bb[2], \r
+ bb[3], tt[3]])</p>\r
+\r
+<p class="whs6">ff[5] = aMeshEditor.AddFace([bb[2], \r
+ tt[3], tt[2]])</p>\r
+\r
+<p class="whs6"> </p>\r
+\r
+<p class="whs8"># inverse the diagonal \r
+ bb[1] - tt[2]</p>\r
+\r
+<p class="whs6">print "\nDiagonal \r
+ inversion ... ",</p>\r
+\r
+<p class="whs6">res = aMeshEditor.InverseDiag(bb[1], \r
+ tt[2])</p>\r
+\r
+<p class="whs6">if not res: print \r
+ "failed!"</p>\r
+\r
+<p class="whs6">else: print \r
+ "done."</p>\r
+\r
+<p class="whs7"> </p>\r
+\r
+<p class="whs7"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
+ </p>\r
+\r
+<h3><a name=bookmark5>Uniting two Triangles</a></h3>\r
+\r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
+\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to unite two triangles. </p>\r
+\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
+\r
+<p> </p>\r
+\r
+<p class="whs9">import salome</p>\r
+\r
+<p class="whs9">import smesh</p>\r
+\r
+<p> </p>\r
+\r
+<p># create an empty mesh structure</p>\r
+\r
+<p class="whs9">gen = smesh.smesh</p>\r
+\r
+<p class="whs9">mesh = gen.CreateEmptyMesh()</p>\r
+\r
+<p class="whs9">aMeshEditor = mesh.GetMeshEditor()</p>\r
+\r
+<p> </p>\r
+\r
+<p># create the following mesh:</p>\r
+\r
+<p class="whs9"># .----.----.----.</p>\r
+\r
+<p class="whs9"># | /| \r
+ /| \r
+ /|</p>\r
+\r
+<p class="whs9"># | / \r
+ | / | / \r
+ |</p>\r
+\r
+<p class="whs9"># | / | \r
+ / | / |</p>\r
+\r
+<p class="whs9"># |/ |/ \r
+ |/ \r
+ |</p>\r
+\r
+<p class="whs9"># .----.----.----.</p>\r
+\r
+<p> </p>\r
+\r
+<p class="whs9">bb = [0, 0, 0, 0]</p>\r
+\r
+<p class="whs9">tt = [0, 0, 0, 0]</p>\r
+\r
+<p class="whs9">ff = [0, 0, 0, 0, \r
+ 0, 0]</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">bb[0] = aMeshEditor.AddNode( \r
+ 0., 0., 0.)</p>\r
+\r
+<p class="whs9">bb[1] = aMeshEditor.AddNode(10., \r
+ 0., 0.)</p>\r
+\r
+<p class="whs9">bb[2] = aMeshEditor.AddNode(20., \r
+ 0., 0.)</p>\r
+\r
+<p class="whs9">bb[3] = aMeshEditor.AddNode(30., \r
+ 0., 0.)</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">tt[0] = aMeshEditor.AddNode( \r
+ 0., 15., 0.)</p>\r
+\r
+<p class="whs9">tt[1] = aMeshEditor.AddNode(10., \r
+ 15., 0.)</p>\r
+\r
+<p class="whs9">tt[2] = aMeshEditor.AddNode(20., \r
+ 15., 0.)</p>\r
+\r
+<p class="whs9">tt[3] = aMeshEditor.AddNode(30., \r
+ 15., 0.)</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">ff[0] = aMeshEditor.AddFace([bb[0], \r
+ bb[1], tt[1]])</p>\r
+\r
+<p class="whs9">ff[1] = aMeshEditor.AddFace([bb[0], \r
+ tt[1], tt[0]])</p>\r
+\r
+<p class="whs9">ff[2] = aMeshEditor.AddFace([bb[1], \r
+ bb[2], tt[2]])</p>\r
+\r
+<p class="whs9">ff[3] = aMeshEditor.AddFace([bb[1], \r
+ tt[2], tt[1]])</p>\r
+\r
+<p class="whs9">ff[4] = aMeshEditor.AddFace([bb[2], \r
+ bb[3], tt[3]])</p>\r
+\r
+<p class="whs9">ff[5] = aMeshEditor.AddFace([bb[2], \r
+ tt[3], tt[2]])</p>\r
+\r
+<p> </p>\r
+\r
+<p># delete the diagonal bb[1] - tt[2]</p>\r
+\r
+<p class="whs9">print "\nUnite \r
+ two triangles ... ",</p>\r
+\r
+<p class="whs9">res = aMeshEditor.DeleteDiag(bb[1], \r
+ tt[2])</p>\r
+\r
+<p class="whs9">if not res: print \r
+ "failed!"</p>\r
+\r
+<p class="whs9">else: print \r
+ "done."</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
+ </p>\r
+\r
+<h3><a name=bookmark6>Uniting a Set of Triangles</a></h3>\r
+\r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
+\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to unite a set of triangles. </p>\r
+\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
+\r
+<p class="whs10"> </p>\r
+\r
+<p class="whs9">import salome</p>\r
+\r
+<p class="whs9">import smesh</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># create an empty mesh \r
+ structure</p>\r
+\r
+<p class="whs9">gen = smesh.smesh</p>\r
+\r
+<p class="whs9">mesh = gen.CreateEmptyMesh()</p>\r
+\r
+<p class="whs9">aMeshEditor = mesh.GetMeshEditor()</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># create the following \r
+ mesh:</p>\r
+\r
+<p class="whs9"># .----.----.----.</p>\r
+\r
+<p class="whs9"># | /| \r
+ /| \r
+ /|</p>\r
+\r
+<p class="whs9"># | / \r
+ | / | / \r
+ |</p>\r
+\r
+<p class="whs9"># | / | \r
+ / | / |</p>\r
+\r
+<p class="whs9"># |/ |/ \r
+ |/ \r
+ |</p>\r
+\r
+<p class="whs9"># .----.----.----.</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">bb = [0, 0, 0, 0]</p>\r
+\r
+<p class="whs9">tt = [0, 0, 0, 0]</p>\r
+\r
+<p class="whs9">ff = [0, 0, 0, 0, \r
+ 0, 0]</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">bb[0] = aMeshEditor.AddNode( \r
+ 0., 0., 0.)</p>\r
+\r
+<p class="whs9">bb[1] = aMeshEditor.AddNode(10., \r
+ 0., 0.)</p>\r
+\r
+<p class="whs9">bb[2] = aMeshEditor.AddNode(20., \r
+ 0., 0.)</p>\r
+\r
+<p class="whs9">bb[3] = aMeshEditor.AddNode(30., \r
+ 0., 0.)</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">tt[0] = aMeshEditor.AddNode( \r
+ 0., 15., 0.)</p>\r
+\r
+<p class="whs9">tt[1] = aMeshEditor.AddNode(10., \r
+ 15., 0.)</p>\r
+\r
+<p class="whs9">tt[2] = aMeshEditor.AddNode(20., \r
+ 15., 0.)</p>\r
+\r
+<p class="whs9">tt[3] = aMeshEditor.AddNode(30., \r
+ 15., 0.)</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">ff[0] = aMeshEditor.AddFace([bb[0], \r
+ bb[1], tt[1]])</p>\r
+\r
+<p class="whs9">ff[1] = aMeshEditor.AddFace([bb[0], \r
+ tt[1], tt[0]])</p>\r
+\r
+<p class="whs9">ff[2] = aMeshEditor.AddFace([bb[1], \r
+ bb[2], tt[2]])</p>\r
+\r
+<p class="whs9">ff[3] = aMeshEditor.AddFace([bb[1], \r
+ tt[2], tt[1]])</p>\r
+\r
+<p class="whs9">ff[4] = aMeshEditor.AddFace([bb[2], \r
+ bb[3], tt[3]])</p>\r
+\r
+<p class="whs9">ff[5] = aMeshEditor.AddFace([bb[2], \r
+ tt[3], tt[2]])</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># unite a set of triangles</p>\r
+\r
+<p class="whs9">aFilterMgr = smesh.smesh.CreateFilterManager()</p>\r
+\r
+<p class="whs9">aFunctor = aFilterMgr.CreateMinimumAngle()</p>\r
+\r
+<p class="whs9">print "\nUnite \r
+ a set of triangles ... ",</p>\r
+\r
+<p class="whs9">res = aMeshEditor.TriToQuad([ff[2], \r
+ ff[3], ff[4], ff[5]], aFunctor, 60.)</p>\r
+\r
+<p class="whs9">if not res: print \r
+ "failed!"</p>\r
+\r
+<p class="whs9">else: print \r
+ "done."</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">salome.sg.updateObjBrowser(1) \r
+ </p>\r
+\r
+<h3><a name=bookmark12>Orientation</a></h3>\r
+\r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
+\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to change orientation. </p>\r
+\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">import salome</p>\r
+\r
+<p class="whs9">import smesh</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># SMESH module</p>\r
+\r
+<p class="whs9">gen = smesh.smesh</p>\r
+\r
+<p class="whs9">mesh = gen.CreateEmptyMesh()</p>\r
+\r
+<p class="whs9">MeshEditor = mesh.GetMeshEditor()</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># build five quadrangles:</p>\r
+\r
+<p class="whs9">dx = 10</p>\r
+\r
+<p class="whs9">dy = 20</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">n1 = \r
+ MeshEditor.AddNode(0.0 * dx, 0, 0)</p>\r
+\r
+<p class="whs9">n2 = \r
+ MeshEditor.AddNode(1.0 * dx, 0, 0)</p>\r
+\r
+<p class="whs9">n3 = \r
+ MeshEditor.AddNode(2.0 * dx, 0, 0)</p>\r
+\r
+<p class="whs9">n4 = \r
+ MeshEditor.AddNode(3.0 * dx, 0, 0)</p>\r
+\r
+<p class="whs9">n5 = \r
+ MeshEditor.AddNode(4.0 * dx, 0, 0)</p>\r
+\r
+<p class="whs9">n6 = \r
+ MeshEditor.AddNode(5.0 * dx, 0, 0)</p>\r
+\r
+<p class="whs9">n7 = \r
+ MeshEditor.AddNode(0.0 * dx, dy, 0)</p>\r
+\r
+<p class="whs9">n8 = \r
+ MeshEditor.AddNode(1.0 * dx, dy, 0)</p>\r
+\r
+<p class="whs9">n9 = \r
+ MeshEditor.AddNode(2.0 * dx, dy, 0)</p>\r
+\r
+<p class="whs9">n10 = MeshEditor.AddNode(3.0 \r
+ * dx, dy, 0)</p>\r
+\r
+<p class="whs9">n11 = MeshEditor.AddNode(4.0 \r
+ * dx, dy, 0)</p>\r
+\r
+<p class="whs9">n12 = MeshEditor.AddNode(5.0 \r
+ * dx, dy, 0)</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">f1 = MeshEditor.AddFace([n1, \r
+ n2, n8 , n7 ])</p>\r
+\r
+<p class="whs9">f2 = MeshEditor.AddFace([n2, \r
+ n3, n9 , n8 ])</p>\r
+\r
+<p class="whs9">f3 = MeshEditor.AddFace([n3, \r
+ n4, n10, n9 ])</p>\r
+\r
+<p class="whs9">f4 = MeshEditor.AddFace([n4, \r
+ n5, n11, n10])</p>\r
+\r
+<p class="whs9">f5 = MeshEditor.AddFace([n5, \r
+ n6, n12, n11])</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># Change the orientation \r
+ of the second and the fourth faces.</p>\r
+\r
+<p class="whs9">MeshEditor.Reorient([2, \r
+ 4])</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">salome.sg.updateObjBrowser(1) \r
+ </p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<h3><a name=bookmark7>Cutting Quadrangles</a></h3>\r
+\r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
+\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to cut quadrangles. </p>\r
+\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">import SMESH</p>\r
+\r
+<p class="whs9">import SMESH_mechanic</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">smesh = SMESH_mechanic.smesh</p>\r
+\r
+<p class="whs9">mesh = \r
+ SMESH_mechanic.mesh</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># cut two quadrangles: \r
+ 405 and 406</p>\r
+\r
+<p class="whs9">aFilterMgr = smesh.CreateFilterManager()</p>\r
+\r
+<p class="whs9">aFunctor = aFilterMgr.CreateMinimumAngle()</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">aMeshEditor = mesh.GetMeshEditor()</p>\r
+\r
+<p class="whs9">aMeshEditor.QuadToTri([405, \r
+ 406], aFunctor) </p>\r
+\r
+<p class="whs10"> </p>\r
+\r
+<h3><a name=bookmark8>Smoothing</a></h3>\r
+\r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
+\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to perform smoothing. </p>\r
+\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs9">import salome</p>\r
+\r
+<p class="whs9">import geompy</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">import SMESH</p>\r
+\r
+<p class="whs9">import SMESH_mechanic</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">mesh = SMESH_mechanic.mesh</p>\r
+\r
+<p class="whs9">aMeshEditor = mesh.GetMeshEditor()</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># select the top face</p>\r
+\r
+<p class="whs9">faces = geompy.SubShapeAllSorted(SMESH_mechanic.shape_mesh, \r
+ geompy.ShapeType["FACE"])</p>\r
+\r
+<p class="whs9">face = faces[3]</p>\r
+\r
+<p class="whs9">geompy.addToStudyInFather(SMESH_mechanic.shape_mesh, \r
+ face, "face planar with hole")</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># create a group of faces \r
+ to be smoothed</p>\r
+\r
+<p class="whs9">GroupSmooth = mesh.CreateGroupFromGEOM(SMESH.FACE, \r
+ "Group of faces (smooth)", face)</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># perform smoothing</p>\r
+\r
+<p class="whs10"># boolean SmoothObject(Object, \r
+ IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method)</p>\r
+\r
+<p class="whs9">res = aMeshEditor.SmoothObject(GroupSmooth, \r
+ [], 20, 2., SMESH.SMESH_MeshEditor.CENTROIDAL_SMOOTH)</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">print "\nSmoothing \r
+ ... ",</p>\r
+\r
+<p class="whs9">if not res: print \r
+ "failed!"</p>\r
+\r
+<p class="whs9">else: print \r
+ "done."</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">salome.sg.updateObjBrowser(1) \r
+ </p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<h3><a name=bookmark9>Extrusion</a></h3>\r
+\r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
+\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to perform extrusion. </p>\r
+\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">import salome</p>\r
+\r
+<p class="whs9">import geompy</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">import SMESH</p>\r
+\r
+<p class="whs9">import SMESH_mechanic</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">mesh = SMESH_mechanic.mesh</p>\r
+\r
+<p class="whs9">aMeshEditor = mesh.GetMeshEditor()</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># select the top face</p>\r
+\r
+<p class="whs9">faces = geompy.SubShapeAllSorted(SMESH_mechanic.shape_mesh, \r
+ geompy.ShapeType["FACE"])</p>\r
+\r
+<p class="whs9">face = faces[7]</p>\r
+\r
+<p class="whs9">geompy.addToStudyInFather(SMESH_mechanic.shape_mesh, \r
+ face, "face circular top")</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># create a vector for \r
+ extrusion</p>\r
+\r
+<p class="whs9">point = SMESH.PointStruct(0., \r
+ 0., 5.)</p>\r
+\r
+<p class="whs9">vector = SMESH.DirStruct(point)</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># create a group to be \r
+ extruded</p>\r
+\r
+<p class="whs9">GroupTri = mesh.CreateGroupFromGEOM(SMESH.FACE, \r
+ "Group of faces (extrusion)", face)</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># perform extrusion of \r
+ the group</p>\r
+\r
+<p class="whs9">aMeshEditor.ExtrusionSweepObject(GroupTri, \r
+ vector, 5)</p>\r
+\r
+<p class="whs10"> </p>\r
+\r
+<p class="whs10"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
+ </p>\r
+\r
+<h3><a name=bookmark10>Extrusion along a Path</a></h3>\r
+\r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
+\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to perform extrusion along a path. </p>\r
+\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">import math</p>\r
+\r
+<p class="whs9">import salome</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># Geometry</p>\r
+\r
+<p class="whs9">import geompy</p>\r
+\r
+<p class="whs10"> </p>\r
+\r
+<p class="whs10"># 1. Create points</p>\r
+\r
+<p class="whs9">points = [[0, 0], \r
+ [50, 30], [50, 110], [0, 150], [-80, 150], [-130, 70], [-130, -20]]</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">iv = 1</p>\r
+\r
+<p class="whs9">vertices = []</p>\r
+\r
+<p class="whs9">for point in points:</p>\r
+\r
+<p class="whs11">vert \r
+ = geompy.MakeVertex(point[0], point[1], 0)</p>\r
+\r
+<p class="whs11">geompy.addToStudy(vert, \r
+ "Vertex_" + `iv`)</p>\r
+\r
+<p class="whs11">vertices.append(vert)</p>\r
+\r
+<p class="whs11">iv \r
+ += 1</p>\r
+\r
+<p class="whs11">pass</p>\r
+\r
+<p class="whs10"> </p>\r
+\r
+<p class="whs10"># 2. Create edges and \r
+ wires</p>\r
+\r
+<p class="whs9">Edge_straight = geompy.MakeEdge(vertices[0], \r
+ vertices[4])</p>\r
+\r
+<p class="whs9">Edge_bezierrr = geompy.MakeBezier(vertices)</p>\r
+\r
+<p class="whs9">Wire_polyline = geompy.MakePolyline(vertices)</p>\r
+\r
+<p class="whs9">Edge_Circle = \r
+ geompy.MakeCircleThreePnt(vertices[0], vertices[1], vertices[2])</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">geompy.addToStudy(Edge_straight, \r
+ "Edge_straight")</p>\r
+\r
+<p class="whs9">geompy.addToStudy(Edge_bezierrr, \r
+ "Edge_bezierrr")</p>\r
+\r
+<p class="whs9">geompy.addToStudy(Wire_polyline, \r
+ "Wire_polyline")</p>\r
+\r
+<p class="whs9">geompy.addToStudy(Edge_Circle \r
+ , "Edge_Circle")</p>\r
+\r
+<p class="whs10"> </p>\r
+\r
+<p class="whs10"># 3. Explode wire on \r
+ edges, as they will be used for mesh extrusion</p>\r
+\r
+<p class="whs9">Wire_polyline_edges \r
+ = geompy.SubShapeAll(Wire_polyline, geompy.ShapeType["EDGE"])</p>\r
+\r
+<p class="whs9">for ii in range(len(Wire_polyline_edges)):</p>\r
+\r
+<p class="whs11">geompy.addToStudyInFather(Wire_polyline, \r
+ Wire_polyline_edges[ii], "Edge_" + `ii + 1`)</p>\r
+\r
+<p class="whs11">pass</p>\r
+\r
+<p class="whs12"> </p>\r
+\r
+<p class="whs10"># Mesh</p>\r
+\r
+<p class="whs9">import smesh</p>\r
+\r
+<p class="whs9">import SMESH</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">gen = smesh.smesh</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">smeshgui = salome.ImportComponentGUI("SMESH")</p>\r
+\r
+<p class="whs9">smeshgui.Init(salome.myStudyId)</p>\r
+\r
+<p class="whs10"> </p>\r
+\r
+<p class="whs10"># 1D algorithm and three \r
+ 1D hypotheses</p>\r
+\r
+<p class="whs9">Wire_discretisation \r
+ = gen.CreateHypothesis('Regular_1D', 'libStdMeshersEngine.so')</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">Nb_Segments_3 = gen.CreateHypothesis('NumberOfSegments', \r
+ 'libStdMeshersEngine.so')</p>\r
+\r
+<p class="whs9">Nb_Segments_7 = gen.CreateHypothesis('NumberOfSegments', \r
+ 'libStdMeshersEngine.so')</p>\r
+\r
+<p class="whs9">Nb_Segments_8 = gen.CreateHypothesis('NumberOfSegments', \r
+ 'libStdMeshersEngine.so')</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">Nb_Segments_3.SetNumberOfSegments(3)</p>\r
+\r
+<p class="whs9">Nb_Segments_7.SetNumberOfSegments(7)</p>\r
+\r
+<p class="whs9">Nb_Segments_8.SetNumberOfSegments(8)</p>\r
+\r
+<p class="whs10"> </p>\r
+\r
+<p class="whs10"># Mesh given shape with \r
+ given 1d hypothesis</p>\r
+\r
+<p class="whs9">def Mesh1D(shape1d, \r
+ hyp1d, name):</p>\r
+\r
+<p class="whs11">mesh1d_tool \r
+ = smesh.Mesh(shape1d)</p>\r
+\r
+<p class="whs11">mesh1d \r
+ = mesh1d_tool.GetMesh()</p>\r
+\r
+<p class="whs11">status \r
+ = mesh1d.AddHypothesis(shape1d, hyp1d)</p>\r
+\r
+<p class="whs11">status \r
+ = mesh1d.AddHypothesis(shape1d, Wire_discretisation)</p>\r
+\r
+<p class="whs11">isDone \r
+ = mesh1d_tool.Compute()</p>\r
+\r
+<p class="whs11">if \r
+ not isDone: print 'Mesh ', name, ': computation failed'</p>\r
+\r
+<p class="whs11">return \r
+ mesh1d</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># Create a mesh with \r
+ six nodes, seven edges and two quadrangle faces</p>\r
+\r
+<p class="whs9">def MakeQuadMesh2(mesh_name):</p>\r
+\r
+<p class="whs11">quad_1 \r
+ = gen.CreateEmptyMesh()</p>\r
+\r
+<p class="whs11">smeshgui.SetName(salome.ObjectToID(quad_1), \r
+ mesh_name)</p>\r
+\r
+<p class="whs11">editor_1 \r
+ = quad_1.GetMeshEditor()</p>\r
+\r
+<p class="whs12"> </p>\r
+\r
+<p class="whs12"># six nodes</p>\r
+\r
+<p class="whs11">n1 \r
+ = editor_1.AddNode(0, 20, 10)</p>\r
+\r
+<p class="whs11">n2 \r
+ = editor_1.AddNode(0, 40, 10)</p>\r
+\r
+<p class="whs11">n3 \r
+ = editor_1.AddNode(0, 40, 30)</p>\r
+\r
+<p class="whs11">n4 \r
+ = editor_1.AddNode(0, 20, 30)</p>\r
+\r
+<p class="whs11">n5 \r
+ = editor_1.AddNode(0, 0, \r
+ 30)</p>\r
+\r
+<p class="whs11">n6 \r
+ = editor_1.AddNode(0, 0, \r
+ 10)</p>\r
+\r
+<p class="whs12"> </p>\r
+\r
+<p class="whs12"># seven edges</p>\r
+\r
+<p class="whs11">editor_1.AddEdge([n1, \r
+ n2]) # 1</p>\r
+\r
+<p class="whs11">editor_1.AddEdge([n2, \r
+ n3]) # 2</p>\r
+\r
+<p class="whs11">editor_1.AddEdge([n3, \r
+ n4]) # 3</p>\r
+\r
+<p class="whs11">editor_1.AddEdge([n4, \r
+ n1]) # 4</p>\r
+\r
+<p class="whs11">editor_1.AddEdge([n4, \r
+ n5]) # 5</p>\r
+\r
+<p class="whs11">editor_1.AddEdge([n5, \r
+ n6]) # 6</p>\r
+\r
+<p class="whs11">editor_1.AddEdge([n6, \r
+ n1]) # 7</p>\r
+\r
+<p class="whs12"> </p>\r
+\r
+<p class="whs12"># two quadrangle faces</p>\r
+\r
+<p class="whs11">editor_1.AddFace([n1, \r
+ n2, n3, n4]) # 8</p>\r
+\r
+<p class="whs11">editor_1.AddFace([n1, \r
+ n4, n5, n6]) # 9</p>\r
+\r
+<p class="whs11">return \r
+ [quad_1, editor_1, [1,2,3,4,5,6,7], [8,9]]</p>\r
+\r
+<p class="whs10"> </p>\r
+\r
+<p class="whs10"># Path meshes</p>\r
+\r
+<p class="whs9">Edge_straight_mesh \r
+ = Mesh1D(Edge_straight, Nb_Segments_7, "Edge_straight")</p>\r
+\r
+<p class="whs9">Edge_bezierrr_mesh \r
+ = Mesh1D(Edge_bezierrr, Nb_Segments_7, "Edge_bezierrr")</p>\r
+\r
+<p class="whs9">Wire_polyline_mesh \r
+ = Mesh1D(Wire_polyline, Nb_Segments_3, "Wire_polyline")</p>\r
+\r
+<p class="whs9">Edge_Circle_mesh = \r
+ Mesh1D(Edge_Circle , \r
+ Nb_Segments_8, "Edge_Circle")</p>\r
+\r
+<p class="whs10"> </p>\r
+\r
+<p class="whs10"># Initial meshes (to \r
+ be extruded)</p>\r
+\r
+<p class="whs9">[quad_1, editor_1, \r
+ ee_1, ff_1] = MakeQuadMesh2("quad_1")</p>\r
+\r
+<p class="whs9">[quad_2, editor_2, \r
+ ee_2, ff_2] = MakeQuadMesh2("quad_2")</p>\r
+\r
+<p class="whs9">[quad_3, editor_3, \r
+ ee_3, ff_3] = MakeQuadMesh2("quad_3")</p>\r
+\r
+<p class="whs9">[quad_4, editor_4, \r
+ ee_4, ff_4] = MakeQuadMesh2("quad_4")</p>\r
+\r
+<p class="whs9">[quad_5, editor_5, \r
+ ee_5, ff_5] = MakeQuadMesh2("quad_5")</p>\r
+\r
+<p class="whs9">[quad_6, editor_6, \r
+ ee_6, ff_6] = MakeQuadMesh2("quad_6")</p>\r
+\r
+<p class="whs9">[quad_7, editor_7, \r
+ ee_7, ff_7] = MakeQuadMesh2("quad_7")</p>\r
+\r
+<p class="whs10"> </p>\r
+\r
+<p class="whs10"># ExtrusionAlongPath</p>\r
+\r
+<p class="whs10"># IDsOfElements, PathMesh, \r
+ PathShape, NodeStart,</p>\r
+\r
+<p class="whs10"># HasAngles, Angles, \r
+ HasRefPoint, RefPoint</p>\r
+\r
+<p class="whs10"> </p>\r
+\r
+<p class="whs9">refPoint = SMESH.PointStruct(0, \r
+ 0, 0)</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">a10 = 10.0*math.pi/180.0</p>\r
+\r
+<p class="whs9">a45 = 45.0*math.pi/180.0</p>\r
+\r
+<p class="whs10"> </p>\r
+\r
+<p class="whs10"># 1. Extrusion of two \r
+ mesh edges along a straight path</p>\r
+\r
+<p class="whs9">error = editor_1.ExtrusionAlongPath([1,2], \r
+ Edge_straight_mesh, Edge_straight, 1,</p>\r
+\r
+<p class="whs13"> 0, \r
+ [], 0, refPoint)</p>\r
+\r
+<p class="whs10"> </p>\r
+\r
+<p class="whs10"># 2. Extrusion of one \r
+ mesh edge along a curved path</p>\r
+\r
+<p class="whs9">error = editor_2.ExtrusionAlongPath([2], \r
+ Edge_bezierrr_mesh, Edge_bezierrr, 1,</p>\r
+\r
+<p class="whs13"> 0, \r
+ [], 0, refPoint)</p>\r
+\r
+<p class="whs10"> </p>\r
+\r
+<p class="whs10"># 3. Extrusion of one \r
+ mesh edge along a curved path with usage of angles </p>\r
+\r
+<p class="whs9">error = editor_3.ExtrusionAlongPath([2], \r
+ Edge_bezierrr_mesh, Edge_bezierrr, 1,</p>\r
+\r
+<p class="whs13"> 1, \r
+ [a45, a45, a45, 0, -a45, -a45, -a45], 0, refPoint)</p>\r
+\r
+<p class="whs10"> </p>\r
+\r
+<p class="whs10"># 4. Extrusion of one \r
+ mesh edge along the path, which is a part of a meshed wire</p>\r
+\r
+<p class="whs9">error = editor_4.ExtrusionAlongPath([4], \r
+ Wire_polyline_mesh, Wire_polyline_edges[0], 1,</p>\r
+\r
+<p class="whs13"> 1, \r
+ [a10, a10, a10], 0, refPoint)</p>\r
+\r
+<p class="whs10"> </p>\r
+\r
+<p class="whs10"># 5. Extrusion of two \r
+ mesh faces along the path, which is a part of a meshed wire</p>\r
+\r
+<p class="whs9">error = editor_5.ExtrusionAlongPath(ff_5 \r
+ , Wire_polyline_mesh, Wire_polyline_edges[2], 4,</p>\r
+\r
+<p class="whs13"> 0, \r
+ [], 0, refPoint)</p>\r
+\r
+<p class="whs10"> </p>\r
+\r
+<p class="whs10"># 6. Extrusion of two \r
+ mesh faces along a closed path</p>\r
+\r
+<p class="whs9">error = editor_6.ExtrusionAlongPath(ff_6 \r
+ , Edge_Circle_mesh, Edge_Circle, 1,</p>\r
+\r
+<p class="whs13"> 0, \r
+ [], 0, refPoint)</p>\r
+\r
+<p class="whs10"> </p>\r
+\r
+<p class="whs10"># 7. Extrusion of two \r
+ mesh faces along a closed path with usage of angles </p>\r
+\r
+<p class="whs9">error = editor_7.ExtrusionAlongPath(ff_7, \r
+ Edge_Circle_mesh, Edge_Circle, 1,</p>\r
+\r
+<p class="whs13"> 1, \r
+ [a45, -a45, a45, -a45, a45, -a45, a45, -a45], 0, refPoint</p>\r
+\r
+<p class="whs13"> </p>\r
+\r
+<p class="whs14">salome.sg.updateObjBrowser(1)</p>\r
+\r
+<h3><a name=bookmark11>Revolution</a></h3>\r
+\r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
+\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to perform revolution. </p>\r
+\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
+\r
+<p class="whs1"> </p>\r
+\r
+<p class="whs9">import math</p>\r
+\r
+<p class="whs9">import SMESH</p>\r
+\r
+<p class="whs9">import SMESH_mechanic</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">mesh = SMESH_mechanic.mesh</p>\r
+\r
+<p class="whs9">aMeshEditor = mesh.GetMeshEditor()</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># create a group of faces \r
+ to be revolved</p>\r
+\r
+<p class="whs9">FacesRotate = [492, \r
+ 493, 502, 503]</p>\r
+\r
+<p class="whs9">GroupRotate = mesh.CreateGroup(SMESH.FACE,"Group \r
+ of faces (rotate)")</p>\r
+\r
+<p class="whs9">GroupRotate.Add(FacesRotate)</p>\r
+\r
+<p class="whs10"> </p>\r
+\r
+<p class="whs10"># define revolution angle \r
+ and axis</p>\r
+\r
+<p class="whs9">angle45 = 45 * math.pi \r
+ / 180</p>\r
+\r
+<p class="whs9">axisXYZ = SMESH.AxisStruct(-38.3128, \r
+ -73.3658, -23.321, -13.3402, -13.3265, 6.66632)</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># perform revolution \r
+ of an object</p>\r
+\r
+<p class="whs9">aMeshEditor.RotationSweepObject(GroupRotate, \r
+ axisXYZ, angle45, 4, 1e-5) </p>\r
+\r
+<p class="whs10"> </p>\r
+\r
+<h3><a name=bookmark13>Pattern Mapping</a></h3>\r
+\r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
+\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to perform pattern mapping. </p>\r
+\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">import geompy</p>\r
+\r
+<p class="whs9">import smesh</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># define the geometry</p>\r
+\r
+<p class="whs9">Box_1 = geompy.MakeBoxDXDYDZ(200., \r
+ 200., 200.)</p>\r
+\r
+<p class="whs9">geompy.addToStudy(Box_1, \r
+ "Box_1")</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">faces = geompy.SubShapeAll(Box_1, \r
+ geompy.ShapeType["FACE"])</p>\r
+\r
+<p class="whs9">Face_1 = faces[0]</p>\r
+\r
+<p class="whs9">Face_2 = faces[1]</p>\r
+\r
+<p class="whs9">geompy.addToStudyInFather(Box_1, \r
+ Face_1, "Face_1")</p>\r
+\r
+<p class="whs9">geompy.addToStudyInFather(Box_1, \r
+ Face_2, "Face_2")</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># build a quadrangle \r
+ mesh 3x3 on Face_1</p>\r
+\r
+<p class="whs9">Mesh_1 = smesh.Mesh(Face_1)</p>\r
+\r
+<p class="whs9">algo1D = Mesh_1.Segment()</p>\r
+\r
+<p class="whs9">algo1D.NumberOfSegments(3)</p>\r
+\r
+<p class="whs9">Mesh_1.Quadrangle()</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs9">isDone = Mesh_1.Compute()</p>\r
+\r
+<p class="whs9">if not isDone: print \r
+ 'Mesh Mesh_1 : computation failed'</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># build a triangle mesh \r
+ on Face_2</p>\r
+\r
+<p class="whs9">Mesh_2 = smesh.Mesh(Face_2)</p>\r
+\r
+<p class="whs9">algo1D = Mesh_2.Segment()</p>\r
+\r
+<p class="whs9">algo1D.NumberOfSegments(1)</p>\r
+\r
+<p class="whs9">algo2D = Mesh_2.Triangle()</p>\r
+\r
+<p class="whs9">algo2D.MaxElementArea(240)</p>\r
+\r
+<p class="whs9">isDone = Mesh_2.Compute()</p>\r
+\r
+<p class="whs9">if not isDone: print \r
+ 'Mesh Mesh_2 : computation failed'</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># create a pattern</p>\r
+\r
+<p class="whs9">pattern = smesh.smesh.GetPattern()</p>\r
+\r
+<p class="whs9">isDone = pattern.LoadFromFace(Mesh_2.GetMesh(), \r
+ Face_2, 0)</p>\r
+\r
+<p class="whs9">if (isDone != 1): \r
+ print 'LoadFromFace :', pattern.GetErrorCode()</p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"># apply the pattern to \r
+ a face of the first mesh</p>\r
+\r
+<p class="whs9">pattern.ApplyToMeshFaces(Mesh_1.GetMesh(), \r
+ [17], 0, 0)</p>\r
+\r
+<p class="whs9">isDone = pattern.MakeMesh(Mesh_1.GetMesh(), \r
+ 0, 0)</p>\r
+\r
+<p class="whs9">if (isDone != 1): \r
+ print 'MakeMesh :', pattern.GetErrorCode() </p>\r
+\r
+<p class="whs9"> </p>\r
+\r
+<p class="whs10"> </p>\r
+\r
+<script type="text/javascript" language="javascript1.2">\r
+<!--\r
+if (window.writeIntopicBar)\r
+ writeIntopicBar(0);\r
+//-->\r
+</script>\r
+</body>\r
+</html>\r
<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.whs1 { margin-top:0pt; margin-bottom:0pt; font-weight:bold; color:#ff0000; }\r
p.whs2 { margin-top:0pt; margin-bottom:0pt; }\r
-p.whs3 { margin-top:0pt; margin-bottom:0pt; font-family:'Times New Roman' , serif; }\r
+p.whs3 { margin-top:0pt; margin-bottom:0pt; font-family:'Lucida Console' , monospace; }\r
+p.whs4 { margin-top:0pt; margin-bottom:0pt; font-family:'Times New Roman' , serif; }\r
-->\r
</style><script type="text/javascript" language="JavaScript">\r
<!--\r
strNSS += "p.whs1 {margin-top:1pt;margin-bottom:1pt; }";\r
strNSS += "p.whs2 {margin-top:1pt;margin-bottom:1pt; }";\r
strNSS += "p.whs3 {margin-top:1pt;margin-bottom:1pt; }";\r
+ strNSS += "p.whs4 {margin-top:1pt;margin-bottom:1pt; }";\r
strNSS +="</style>";\r
document.write(strNSS);\r
}\r
\r
<h3><a name=bookmark>Free Borders</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> \r
+<p class="whs1"># Attention! This script has been written \r
+ using the old approach basing on direct usage of SMESH idl interface.</p>\r
\r
-<p class="whs1">import salome</p>\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to check free borders. </p>\r
\r
-<p class="whs1">import geompy</p>\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
\r
-<p class="whs1">import SMESH</p>\r
+<p class="whs2"> </p>\r
+\r
+<p class="whs3">import salome</p>\r
\r
-<p class="whs1">import StdMeshers</p>\r
+<p class="whs3">import geompy</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">smesh = salome.lcc.FindOrLoadComponent("FactoryServer", \r
- "SMESH")</p>\r
+<p class="whs3">import smesh</p>\r
\r
-<p class="whs1">smesh.SetCurrentStudy(salome.myStudy)</p>\r
+<p class="whs3">import SMESH</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs2"># create a box without \r
- one plane</p>\r
+<p class="whs2"># create open shell: a \r
+ box without one plane</p>\r
\r
-<p class="whs1">box = geompy.MakeBox(0., \r
+<p class="whs3">box = geompy.MakeBox(0., \r
0., 0., 20., 20., 15.)</p>\r
\r
-<p class="whs1">subShapeList = geompy.SubShapeAll(box, \r
+<p class="whs3">FaceList = geompy.SubShapeAll(box, \r
geompy.ShapeType["FACE"])</p>\r
\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">FaceList = \r
- []</p>\r
-\r
-<p class="whs1">for i in range( \r
- 5 ):</p>\r
-\r
-<p class="whs1"> FaceList.append( \r
- subShapeList[ i ] )</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">aComp = geompy.MakeCompound( \r
- FaceList )</p>\r
-\r
-<p class="whs1">aBox = geompy.Sew( \r
- aComp, 1. )</p>\r
+<p class="whs3">FaceList.remove(FaceList[5])</p>\r
\r
-<p class="whs1">idbox = geompy.addToStudy( \r
- aBox, "box" )</p>\r
+<p class="whs3">box = geompy.MakeShell(FaceList)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">idbox = geompy.addToStudy(box, \r
+ "box")</p>\r
\r
-<p class="whs1">aBox = \r
- salome.IDToObject( idbox )</p>\r
-\r
-<p class="whs1"> </p>\r
+<p class="whs2"> </p>\r
\r
<p class="whs2"># create a mesh</p>\r
\r
-<p class="whs1">hyp1 = smesh.CreateHypothesis("NumberOfSegments", \r
- "libStdMeshersEngine.so")</p>\r
-\r
-<p class="whs1">hyp1.SetNumberOfSegments(5)</p>\r
-\r
-<p class="whs1">hyp2 = smesh.CreateHypothesis("MaxElementArea", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs3">tria = smesh.Mesh(box, \r
+ "Mesh_free_borders")</p>\r
\r
-<p class="whs1">hyp2.SetMaxElementArea(20)</p>\r
+<p class="whs3">algo = tria.Segment()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">algo.NumberOfSegments(5)</p>\r
\r
-<p class="whs1">algo1 = smesh.CreateHypothesis("Regular_1D", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs3">algo = tria.Triangle()</p>\r
\r
-<p class="whs1">algo2 = smesh.CreateHypothesis("MEFISTO_2D", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs3">algo.MaxElementArea(20.)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">tria.Compute()</p>\r
\r
-<p class="whs1">mesh = smesh.CreateMesh(aBox)</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">mesh.AddHypothesis(aBox,hyp1)</p>\r
+<p class="whs3">mesh = tria.GetMesh()</p>\r
\r
-<p class="whs1">mesh.AddHypothesis(aBox,hyp2)</p>\r
+<p class="whs3">gen = smesh.smesh</p>\r
\r
-<p class="whs1">mesh.AddHypothesis(aBox,algo1)</p>\r
-\r
-<p class="whs1">mesh.AddHypothesis(aBox,algo2)</p>\r
+<p class="whs2"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs2"># criterion : free borders</p>\r
\r
-<p class="whs1">smesh.Compute(mesh,aBox)</p>\r
+<p class="whs3">aFilterMgr = gen.CreateFilterManager()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateFreeBorders()</p>\r
\r
-<p class="whs1">smeshgui = salome.ImportComponentGUI("SMESH")</p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1">smeshgui.Init(salome.myStudyId);</p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs1">smeshgui.SetName( \r
- salome.ObjectToID( mesh ), "Mesh_freebord" );</p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs2"># criterion : free borders</p>\r
+<p class="whs2"># print the result</p>\r
\r
-<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>\r
+<p class="whs3">print "Criterion: \r
+ Free borders Nb = ", len(anIds)</p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateFreeBorders()</p>\r
+<p class="whs3">j = 1</p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs3">for i in range(len(anIds)):</p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs3"> if \r
+ j > 20: j = 1; print ""</p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs3"> print \r
+ anIds[i],</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3"> j \r
+ = j + 1</p>\r
\r
-<p class="whs2"># print the result</p>\r
+<p class="whs3"> pass</p>\r
\r
-<p class="whs1">print "Criterion: \r
- Free borders Nb = ", len( anIds )</p>\r
-\r
-<p class="whs1">for i in range( \r
- len( anIds ) ):</p>\r
-\r
-<p class="whs1"> print \r
- anIds[ i ]</p>\r
+<p class="whs3">print ""</p>\r
\r
<p class="whs2"> </p>\r
\r
<p class="whs2"># create a group</p>\r
\r
-<p class="whs1">aGroup = mesh.CreateGroup( \r
- SMESH.EDGE, "Free borders" )</p>\r
+<p class="whs3">aGroup = mesh.CreateGroup(SMESH.EDGE, \r
+ "Free borders")</p>\r
+\r
+<p class="whs3">aGroup.Add(anIds)</p>\r
\r
-<p class="whs1">aGroup.Add( anIds \r
- )</p>\r
+<p class="whs3"> </p>\r
\r
<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
</p>\r
\r
-<p class="whs2"> </p>\r
-\r
<h3><a name=bookmark1>Borders at Multiconnection</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> \r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
\r
-<p class="whs1">import salome</p>\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to check borders at multiconnection. </p>\r
\r
-<p class="whs1">import geompy</p>\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
\r
-<p class="whs1">import SMESH</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">import StdMeshers</p>\r
+<p class="whs3">import salome</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">import geompy</p>\r
\r
-<p class="whs1">smesh = salome.lcc.FindOrLoadComponent("FactoryServer", \r
- "SMESH")</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">smesh.SetCurrentStudy(salome.myStudy)</p>\r
+<p class="whs3">import smesh</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">import SMESH</p>\r
\r
-<p class="whs2"># create a box without \r
- one plane</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs4"># create open shell: \r
+ a box without one plane</p>\r
\r
-<p class="whs1">box = geompy.MakeBox(0., \r
+<p class="whs3">box = geompy.MakeBox(0., \r
0., 0., 20., 20., 15.)</p>\r
\r
-<p class="whs1">subShapeList = geompy.SubShapeAll(box, \r
+<p class="whs3">FaceList = geompy.SubShapeAll(box, \r
geompy.ShapeType["FACE"])</p>\r
\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">FaceList = \r
- []</p>\r
-\r
-<p class="whs1">for i in range( \r
- 5 ):</p>\r
-\r
-<p class="whs1"> FaceList.append( \r
- subShapeList[ i ] )</p>\r
-\r
-<p class="whs1"> </p>\r
+<p class="whs3">FaceList.remove(FaceList[5])</p>\r
\r
-<p class="whs1">aComp = geompy.MakeCompound( \r
- FaceList )</p>\r
+<p class="whs3">box = geompy.MakeShell(FaceList)</p>\r
\r
-<p class="whs1">aBox = geompy.Sew( \r
- aComp, 1. )</p>\r
+<p class="whs3">idbox = geompy.addToStudy(box, \r
+ "box")</p>\r
\r
-<p class="whs1">idbox = geompy.addToStudy( \r
- aBox, "box" )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs4"># create a mesh</p>\r
\r
-<p class="whs1">aBox = \r
- salome.IDToObject( idbox )</p>\r
+<p class="whs3">tria = smesh.Mesh(box, \r
+ "Mesh_borders_at_multi-connections")</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">algo = tria.Segment()</p>\r
\r
-<p class="whs2"># create a mesh</p>\r
-\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs1">hyp1 = smesh.CreateHypothesis("NumberOfSegments", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs3">algo.NumberOfSegments(5)</p>\r
\r
-<p class="whs1">hyp1.SetNumberOfSegments(5)</p>\r
+<p class="whs3">algo = tria.Triangle()</p>\r
\r
-<p class="whs1">hyp2 = smesh.CreateHypothesis("MaxElementArea", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs3">algo.MaxElementArea(20.)</p>\r
\r
-<p class="whs1">hyp2.SetMaxElementArea(20)</p>\r
+<p class="whs3">tria.Compute()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">mesh = tria.GetMesh()</p>\r
\r
-<p class="whs1">algo1 = smesh.CreateHypothesis("Regular_1D", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs3">gen = smesh.smesh</p>\r
\r
-<p class="whs1">algo2 = smesh.CreateHypothesis("MEFISTO_2D", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs4"># Criterion : Borders \r
+ at multi-connection</p>\r
\r
-<p class="whs1">mesh = smesh.CreateMesh(aBox)</p>\r
+<p class="whs3">nb_conn = 2</p>\r
\r
-<p class="whs1">mesh.AddHypothesis(aBox,hyp1)</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">mesh.AddHypothesis(aBox,hyp2)</p>\r
+<p class="whs3">aFilterMgr = gen.CreateFilterManager()</p>\r
\r
-<p class="whs1">mesh.AddHypothesis(aBox,algo1)</p>\r
+<p class="whs3">aFunctor = aFilterMgr.CreateMultiConnection()</p>\r
\r
-<p class="whs1">mesh.AddHypothesis(aBox,algo2)</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateEqualTo()</p>\r
\r
-<p class="whs1">smesh.Compute(mesh,aBox)</p>\r
+<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aPredicate.SetMargin(nb_conn)</p>\r
\r
-<p class="whs1">smeshgui = salome.ImportComponentGUI("SMESH")</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">smeshgui.Init(salome.myStudyId);</p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1">smeshgui.SetName( \r
- salome.ObjectToID( mesh ), "Mesh_borders_at_multi-connections" \r
- );</p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"># Criterion : Borders at \r
- multi-connection</p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
-<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFunctor = aFilterMgr.CreateMultiConnection()</p>\r
+<p class="whs4"># print the result</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">print "Criterion: \r
+ Borders at multi-connections Nb = ", len(anIds)</p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateEqualTo()</p>\r
+<p class="whs3">j = 1</p>\r
\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
- aFunctor )</p>\r
+<p class="whs3">for i in range(len(anIds)):</p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
- 2 )</p>\r
+<p class="whs3"> if \r
+ j > 20: j = 1; print ""</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> print \r
+ anIds[i],</p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs3"> j \r
+ = j + 1</p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs3"> pass</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">print ""</p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs4"># create a group</p>\r
\r
-<p class="whs2"># print the result</p>\r
-\r
-<p class="whs1">print "Criterion: \r
- Borders at multi-connections Nb = ", len( anIds )</p>\r
+<p class="whs3">aGroup = mesh.CreateGroup(SMESH.EDGE, \r
+ "Borders at multi-connections")</p>\r
\r
-<p class="whs1">for i in range( \r
- len( anIds ) ):</p>\r
+<p class="whs3">aGroup.Add(anIds)</p>\r
\r
-<p class="whs1"> print \r
- anIds[ i ]</p>\r
-\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs2"># create a group</p>\r
-\r
-<p class="whs1">aGroup = mesh.CreateGroup( \r
- SMESH.EDGE, "Borders at multi-connections" )</p>\r
-\r
-<p class="whs1">aGroup.Add( anIds \r
- )</p>\r
-\r
-<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
+<p class="whs3">salome.sg.updateObjBrowser(1) \r
</p>\r
\r
-<p class="whs2"> </p>\r
-\r
<h3><a name=bookmark2>Length 1D</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> \r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to check length 1D. </p>\r
\r
-<p class="whs1">import salome</p>\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
\r
-<p class="whs1">import geompy</p>\r
+<p class="whs2"> </p>\r
\r
-<p class="whs1">import SMESH</p>\r
+<p class="whs3">import salome</p>\r
\r
-<p class="whs1">import StdMeshers</p>\r
+<p class="whs3">import geompy</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">smesh = salome.lcc.FindOrLoadComponent("FactoryServer", \r
- "SMESH")</p>\r
+<p class="whs3">import smesh</p>\r
\r
-<p class="whs1">smesh.SetCurrentStudy(salome.myStudy)</p>\r
+<p class="whs3">import SMESH</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs2"># create a box without \r
- one plane</p>\r
+<p class="whs2"># create open shell: a \r
+ box without one plane</p>\r
\r
-<p class="whs1">box = geompy.MakeBox(0., \r
+<p class="whs3">box = geompy.MakeBox(0., \r
0., 0., 20., 20., 15.)</p>\r
\r
-<p class="whs1">subShapeList = geompy.SubShapeAll(box, \r
+<p class="whs3">FaceList = geompy.SubShapeAll(box, \r
geompy.ShapeType["FACE"])</p>\r
\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">FaceList = \r
- []</p>\r
-\r
-<p class="whs1">for i in range( \r
- 5 ):</p>\r
-\r
-<p class="whs1"> FaceList.append( \r
- subShapeList[ i ] )</p>\r
-\r
-<p class="whs1"> </p>\r
+<p class="whs3">FaceList.remove(FaceList[5])</p>\r
\r
-<p class="whs1">aComp = geompy.MakeCompound( \r
- FaceList )</p>\r
+<p class="whs3">box = geompy.MakeShell(FaceList)</p>\r
\r
-<p class="whs1">aBox = geompy.Sew( \r
- aComp, 1. )</p>\r
+<p class="whs3">idbox = geompy.addToStudy(box, \r
+ "box")</p>\r
\r
-<p class="whs1">idbox = geompy.addToStudy( \r
- aBox, "box" )</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">aBox = \r
- salome.IDToObject( idbox )</p>\r
-\r
-<p class="whs1"> </p>\r
+<p class="whs2"> </p>\r
\r
<p class="whs2"># create a mesh</p>\r
\r
-<p class="whs1">hyp1 = smesh.CreateHypothesis("NumberOfSegments", \r
- "libStdMeshersEngine.so")</p>\r
-\r
-<p class="whs1">hyp1.SetNumberOfSegments(5)</p>\r
-\r
-<p class="whs1">hyp2 = smesh.CreateHypothesis("MaxElementArea", \r
- "libStdMeshersEngine.so")</p>\r
-\r
-<p class="whs1">hyp2.SetMaxElementArea(20)</p>\r
+<p class="whs3">tria = smesh.Mesh(box, \r
+ "Mesh_Length_1D")</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">algo = tria.Segment()</p>\r
\r
-<p class="whs1">algo1 = smesh.CreateHypothesis("Regular_1D", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs3">algo.NumberOfSegments(5)</p>\r
\r
-<p class="whs1">algo2 = smesh.CreateHypothesis("MEFISTO_2D", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs3">algo = tria.Triangle()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">algo.MaxElementArea(20.)</p>\r
\r
-<p class="whs1">mesh = smesh.CreateMesh(aBox)</p>\r
+<p class="whs3">tria.Compute()</p>\r
\r
-<p class="whs1">mesh.AddHypothesis(aBox,hyp1)</p>\r
+<p class="whs3">mesh = tria.GetMesh()</p>\r
\r
-<p class="whs1">mesh.AddHypothesis(aBox,hyp2)</p>\r
+<p class="whs3">gen = smesh.smesh</p>\r
\r
-<p class="whs1">mesh.AddHypothesis(aBox,algo1)</p>\r
-\r
-<p class="whs1">mesh.AddHypothesis(aBox,algo2)</p>\r
+<p class="whs2"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs2"># Criterion : Length > \r
+ 3.</p>\r
\r
-<p class="whs1">smesh.Compute(mesh,aBox)</p>\r
+<p class="whs3">length_margin = \r
+ 3.</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">smeshgui = salome.ImportComponentGUI("SMESH")</p>\r
+<p class="whs3">aFilterMgr = gen.CreateFilterManager()</p>\r
\r
-<p class="whs1">smeshgui.Init(salome.myStudyId);</p>\r
+<p class="whs3">aFunctor = aFilterMgr.CreateLength()</p>\r
\r
-<p class="whs1">smeshgui.SetName( \r
- salome.ObjectToID( mesh ), "Mesh" );</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
\r
-<p class="whs2"># Criterion : Length > \r
- 3</p>\r
+<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>\r
\r
-<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>\r
+<p class="whs3">aPredicate.SetMargin(length_margin)</p>\r
\r
-<p class="whs1">aFunctor = aFilterMgr.CreateLength()</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
- aFunctor )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
- 3 )</p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs2"> </p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs2"># print the result</p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs3">print "Criterion: \r
+ Edges length > ", length_margin, " Nb = ", len(anIds)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">j = 1</p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs3">for i in range(len(anIds)):</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3"> if \r
+ j > 20: j = 1; print ""</p>\r
\r
-<p class="whs2"># print the result</p>\r
+<p class="whs3"> print \r
+ anIds[i],</p>\r
\r
-<p class="whs1">print "Criterion: \r
- Edges length > 3 Nb = ", len( anIds )</p>\r
+<p class="whs3"> j \r
+ = j + 1</p>\r
\r
-<p class="whs1">for i in range( \r
- len( anIds ) ):</p>\r
+<p class="whs3"> pass</p>\r
\r
-<p class="whs1"> print \r
- anIds[ i ]</p>\r
+<p class="whs3">print ""</p>\r
\r
<p class="whs2"> </p>\r
\r
<p class="whs2"># create a group</p>\r
\r
-<p class="whs1">aGroup = mesh.CreateGroup( \r
- SMESH.EDGE, "Edges with legth > 3" )</p>\r
+<p class="whs3">aGroup = mesh.CreateGroup(SMESH.EDGE, \r
+ "Edges with length > " + `length_margin`)</p>\r
\r
-<p class="whs1">aGroup.Add( anIds \r
- )</p>\r
+<p class="whs3">aGroup.Add(anIds)</p>\r
\r
-<p class="whs1">salome.sg.updateObjBrowser(1)</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
+ </p>\r
\r
<h3><a name=bookmark3>Free Edges</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> \r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
+\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to check free edges. </p>\r
\r
-<p class="whs1">import SMESH</p>\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
\r
-<p class="whs1">import SMESH_mechanic</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">import SMESH</p>\r
\r
-<p class="whs1">smesh = \r
+<p class="whs3">import SMESH_mechanic</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">smesh = \r
SMESH_mechanic.smesh</p>\r
\r
-<p class="whs1">mesh = \r
+<p class="whs3">mesh = \r
SMESH_mechanic.mesh</p>\r
\r
-<p class="whs1">salome = SMESH_mechanic.salome</p>\r
+<p class="whs3">salome = SMESH_mechanic.salome</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>\r
+<p class="whs3">aFilterMgr = smesh.CreateFilterManager()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"># Criterion : AREA > \r
- 30</p>\r
+<p class="whs4"># Remove some elements \r
+ to obtain free edges</p>\r
\r
-<p class="whs1">aFunctor = aFilterMgr.CreateArea()</p>\r
+<p class="whs4"># Criterion : AREA \r
+ > 95.</p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
+<p class="whs3">area_margin = 95.</p>\r
\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
- aFunctor )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
- 95 )</p>\r
+<p class="whs3">aFunctor = aFilterMgr.CreateArea()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs3">aPredicate.SetMargin(area_margin)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1">anEditor = mesh.GetMeshEditor()</p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs1">anEditor.RemoveElements(anIds)</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
-<p class="whs2"># Criterion : Free Edges</p>\r
+<p class="whs3">anEditor = mesh.GetMeshEditor()</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">anEditor.RemoveElements(anIds)</p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateFreeEdges()</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aPredicate.SetMesh( \r
- mesh )</p>\r
+<p class="whs4"># Criterion : Free \r
+ Edges</p>\r
\r
-<p class="whs1">aBorders = aPredicate.GetBorders()</p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateFreeEdges()</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">aPredicate.SetMesh(mesh)</p>\r
\r
-<p class="whs2"># create groups</p>\r
+<p class="whs3">aBorders = aPredicate.GetBorders()</p>\r
\r
-<p class="whs1">aGroupF = mesh.CreateGroup( \r
- SMESH.FACE, "Faces with free edges" )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aGroupN = mesh.CreateGroup( \r
- SMESH.NODE, "Nodes on free edges" )</p>\r
+<p class="whs4"># create groups</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">aGroupF = mesh.CreateGroup(SMESH.FACE, \r
+ "Faces with free edges")</p>\r
\r
-<p class="whs2"># fill groups with elements, \r
- corresponding to the criterion</p>\r
+<p class="whs3">aGroupN = mesh.CreateGroup(SMESH.NODE, \r
+ "Nodes on free edges")</p>\r
\r
-<p class="whs1">print ""</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">print "Criterion: \r
- Free edges Nb = ", len( aBorders )</p>\r
+<p class="whs4"># fill groups with \r
+ elements, corresponding to the criterion</p>\r
\r
-<p class="whs1">for i in range( \r
- len( aBorders ) ):</p>\r
+<p class="whs3">print ""</p>\r
\r
-<p class="whs1"> aBorder \r
- = aBorders[ i ]</p>\r
+<p class="whs3">print "Criterion: \r
+ Free edges Nb = ", len(aBorders)</p>\r
\r
-<p class="whs1"> print \r
+<p class="whs3">for i in range(len(aBorders)):</p>\r
+\r
+<p class="whs3"> aBorder \r
+ = aBorders[i]</p>\r
+\r
+<p class="whs3"> print \r
"Face # ", aBorder.myElemId, " : Edge between nodes (",</p>\r
\r
-<p class="whs1"> print \r
+<p class="whs3"> print \r
aBorder.myPnt1, ", ", aBorder.myPnt2, ")"</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> aGroupF.Add( \r
- [aBorder.myElemId] )</p>\r
+<p class="whs3"> <span \r
+ style="margin-top: 0pt;\r
+ margin-bottom: 0pt;\r
+ font-family: 'Lucida Console', monospace;">aGroupF.Add([aBorder.myElemId])</span></p>\r
\r
-<p class="whs1"> aGroupN.Add( \r
- [aBorder.myPnt1, aBorder.myPnt2] )</p>\r
+<p class="whs3"> aGroupN.Add([aBorder.myPnt1, \r
+ aBorder.myPnt2])</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
+<p class="whs3">salome.sg.updateObjBrowser(1) \r
</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3"> </p>\r
\r
<h3><a name=bookmark4>Length 2D</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> \r
+<p class="whs1"><span><font color=red ><B><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></B></font></span></p>\r
\r
-<p class="whs1">import salome</p>\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to check length 2D. </p>\r
\r
-<p class="whs1">import geompy</p>\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
\r
-<p class="whs1">import SMESH</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">import StdMeshers</p>\r
+<p class="whs3">import salome</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">import geompy</p>\r
\r
-<p class="whs1">smesh = salome.lcc.FindOrLoadComponent("FactoryServer", \r
- "SMESH")</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">smesh.SetCurrentStudy(salome.myStudy)</p>\r
+<p class="whs3">import smesh</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">import SMESH</p>\r
\r
-<p class="whs2"># create a box without \r
- one plane</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs4"># create open shell: \r
+ a box without one plane</p>\r
\r
-<p class="whs1">box = geompy.MakeBox(0., \r
+<p class="whs3">box = geompy.MakeBox(0., \r
0., 0., 20., 20., 15.)</p>\r
\r
-<p class="whs1">subShapeList = geompy.SubShapeAll(box, \r
+<p class="whs3">FaceList = geompy.SubShapeAll(box, \r
geompy.ShapeType["FACE"])</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">FaceList.remove(FaceList[5])</p>\r
\r
-<p class="whs1">FaceList = \r
- []</p>\r
+<p class="whs3">box = geompy.MakeShell(FaceList)</p>\r
\r
-<p class="whs1">for i in range( \r
- 5 ):</p>\r
+<p class="whs3">idbox = geompy.addToStudy(box, \r
+ "box")</p>\r
\r
-<p class="whs1"> FaceList.append( \r
- subShapeList[ i ] )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs4"># create a mesh</p>\r
\r
-<p class="whs1">aComp = geompy.MakeCompound( \r
- FaceList )</p>\r
+<p class="whs3">tria = smesh.Mesh(box, \r
+ "Mesh_Length_2D")</p>\r
\r
-<p class="whs1">aBox = geompy.Sew( \r
- aComp, 1. )</p>\r
+<p class="whs3">algo = tria.Segment()</p>\r
\r
-<p class="whs1">idbox = geompy.addToStudy( \r
- aBox, "box" )</p>\r
+<p class="whs3">algo.NumberOfSegments(5)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">algo = tria.Triangle()</p>\r
\r
-<p class="whs1">aBox = \r
- salome.IDToObject( idbox )</p>\r
+<p class="whs3">algo.MaxElementArea(20.)</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">tria.Compute()</p>\r
\r
-<p class="whs2"># create a mesh</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">mesh = tria.GetMesh()</p>\r
\r
-<p class="whs1">hyp1 = smesh.CreateHypothesis("NumberOfSegments", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs3">gen = smesh.smesh</p>\r
\r
-<p class="whs1">hyp1.SetNumberOfSegments(5)</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">hyp2 = smesh.CreateHypothesis("MaxElementArea", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs4"># Criterion : Length \r
+ 2D > 5.7</p>\r
\r
-<p class="whs1">hyp2.SetMaxElementArea(20)</p>\r
+<p class="whs3">length_margin = \r
+ 5.7</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">algo1 = smesh.CreateHypothesis("Regular_1D", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs3">aFilterMgr = gen.CreateFilterManager()</p>\r
\r
-<p class="whs1">algo2 = smesh.CreateHypothesis("MEFISTO_2D", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs3">aFunctor = aFilterMgr.CreateLength2D()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">mesh = smesh.CreateMesh(aBox)</p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
\r
-<p class="whs1">mesh.AddHypothesis(aBox,hyp1)</p>\r
+<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>\r
\r
-<p class="whs1">mesh.AddHypothesis(aBox,hyp2)</p>\r
+<p class="whs3">aPredicate.SetMargin(length_margin)</p>\r
\r
-<p class="whs1">mesh.AddHypothesis(aBox,algo1)</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">mesh.AddHypothesis(aBox,algo2)</p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs1">smesh.Compute(mesh,aBox)</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
-<p class="whs1">smeshgui = salome.ImportComponentGUI("SMESH")</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">smeshgui.Init(salome.myStudyId);</p>\r
+<p class="whs4"># print the result</p>\r
\r
-<p class="whs1">smeshgui.SetName( \r
- salome.ObjectToID( mesh ), "Mesh" );</p>\r
+<p class="whs3">print "Criterion: \r
+ Edges length 2D > ", length_margin, " Nb = ", len(anIds)</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">j = 1</p>\r
\r
-<p class="whs2"># Criterion : Length 2D \r
- > 5</p>\r
+<p class="whs3">for i in range(len(anIds)):</p>\r
\r
-<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>\r
+<p class="whs3"> if \r
+ j > 20: j = 1; print ""</p>\r
\r
-<p class="whs1">aFunctor = aFilterMgr.CreateLength2D()</p>\r
+<p class="whs3"> print \r
+ anIds[i],</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> j \r
+ = j + 1</p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
+<p class="whs3"> pass</p>\r
\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
- aFunctor )</p>\r
+<p class="whs3">print ""</p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
- 5 )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs4"># create a group</p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs3">aGroup = mesh.CreateGroup(SMESH.FACE, \r
+ "Faces with length 2D > " + `length_margin`)</p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs3">aGroup.Add(anIds)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs3">salome.sg.updateObjBrowser(1) \r
+ </p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs2"># print the result</p>\r
+<h3><a name=bookmark5>Borders at Multiconnection 2D</a></h3>\r
\r
-<p class="whs1">print "Criterion: \r
- Edges length 2D > 5 Nb = ", len( anIds )</p>\r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B><span \r
+ style="font-weight: bold; color: #ff0000;"><font color=red ><B># Attention! This script has \r
+ been written using the old approach basing on direct usage of SMESH idl \r
+ interface.</B></font></span></B></font></span></p>\r
\r
-<p class="whs1">for i in range( \r
- len( anIds ) ):</p>\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to check borders at multiconnection 2D. </p>\r
\r
-<p class="whs1"> print \r
- anIds[ i ]</p>\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"># create a group</p>\r
+<p class="whs3">import salome</p>\r
\r
-<p class="whs1">aGroup = mesh.CreateGroup( \r
- SMESH.FACE, "Edges with legth 2D > 5" )</p>\r
+<p class="whs3">import geompy</p>\r
\r
-<p class="whs1">aGroup.Add( anIds \r
- )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
- </p>\r
+<p class="whs3">import smesh</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">import SMESH</p>\r
\r
-<h3><a name=bookmark5>Borders at Multiconnection 2D</a></h3>\r
+<p class="whs3"> </p>\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> \r
+<p class="whs4"># create a compound \r
+ of two glued boxes</p>\r
\r
-<p class="whs1">import salome</p>\r
+<p class="whs3">box1 = geompy.MakeBox(0., \r
+ 0., 0., 20., 20., 15.)</p>\r
\r
-<p class="whs1">import geompy</p>\r
+<p class="whs3">box2 = geompy.MakeTranslation(box1, \r
+ 0., 20., 0)</p>\r
\r
-<p class="whs1">import SMESH</p>\r
+<p class="whs3">comp = geompy.MakeCompound([box1, \r
+ box2])</p>\r
\r
-<p class="whs1">import StdMeshers</p>\r
+<p class="whs3">box = geompy.MakeGlueFaces(comp, \r
+ 0.000001)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">idbox = geompy.addToStudy(box, \r
+ "box")</p>\r
\r
-<p class="whs1">smesh = salome.lcc.FindOrLoadComponent("FactoryServer", \r
- "SMESH")</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">smesh.SetCurrentStudy(salome.myStudy)</p>\r
+<p class="whs4"># create a mesh</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">tria = smesh.Mesh(box, \r
+ "Box compound : 2D triangle mesh")</p>\r
\r
-<p class="whs2"># create a box without \r
- one plane</p>\r
+<p class="whs3">algo = tria.Segment()</p>\r
\r
-<p class="whs1">box = geompy.MakeBox(0., \r
- 0., 0., 20., 20., 15.)</p>\r
+<p class="whs3">algo.NumberOfSegments(5)</p>\r
\r
-<p class="whs1">subShapeList = geompy.SubShapeAll(box, \r
- geompy.ShapeType["FACE"])</p>\r
+<p class="whs3">algo = tria.Triangle()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">algo.MaxElementArea(20.)</p>\r
\r
-<p class="whs1">FaceList = \r
- []</p>\r
+<p class="whs3">tria.Compute()</p>\r
\r
-<p class="whs1">for i in range( \r
- 5 ):</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> FaceList.append( \r
- subShapeList[ i ] )</p>\r
+<p class="whs3">mesh = tria.GetMesh()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">gen = smesh.smesh</p>\r
\r
-<p class="whs1">aComp = geompy.MakeCompound( \r
- FaceList )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aBox = geompy.Sew( \r
- aComp, 1. )</p>\r
+<p class="whs4"># Criterion : MULTI-CONNECTION \r
+ 2D = 3</p>\r
\r
-<p class="whs1">idbox = geompy.addToStudy( \r
- aBox, "box" )</p>\r
+<p class="whs3">nb_conn = 3</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aBox = \r
- salome.IDToObject( idbox )</p>\r
+<p class="whs3">aFilterMgr = gen.CreateFilterManager()</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">aFunctor = aFilterMgr.CreateMultiConnection2D()</p>\r
\r
-<p class="whs2"># create a mesh</p>\r
-\r
-<p class="whs1">hyp1 = smesh.CreateHypothesis("NumberOfSegments", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">hyp1.SetNumberOfSegments(5)</p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateEqualTo()</p>\r
\r
-<p class="whs1">hyp2 = smesh.CreateHypothesis("MaxElementArea", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>\r
\r
-<p class="whs1">hyp2.SetMaxElementArea(20)</p>\r
+<p class="whs3">aPredicate.SetMargin(nb_conn)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">algo1 = smesh.CreateHypothesis("Regular_1D", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1">algo2 = smesh.CreateHypothesis("MEFISTO_2D", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">mesh = smesh.CreateMesh(aBox)</p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
-<p class="whs1">mesh.AddHypothesis(aBox,hyp1)</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">mesh.AddHypothesis(aBox,hyp2)</p>\r
+<p class="whs4"># print the result</p>\r
\r
-<p class="whs1">mesh.AddHypothesis(aBox,algo1)</p>\r
+<p class="whs3">print "Criterion: \r
+ Borders at multi-connection 2D = ", nb_conn, " Nb = ", \r
+ len(anIds)</p>\r
\r
-<p class="whs1">mesh.AddHypothesis(aBox,algo2)</p>\r
+<p class="whs3">j = 1</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">for i in range(len(anIds)):</p>\r
\r
-<p class="whs1">smesh.Compute(mesh,aBox)</p>\r
+<p class="whs3"> if \r
+ j > 20: j = 1; print ""</p>\r
\r
-<p class="whs1">smeshgui = salome.ImportComponentGUI("SMESH")</p>\r
+<p class="whs3"> print \r
+ anIds[i],</p>\r
\r
-<p class="whs1">smeshgui.Init(salome.myStudyId);</p>\r
+<p class="whs3"> j \r
+ = j + 1</p>\r
\r
-<p class="whs1">smeshgui.SetName( \r
- salome.ObjectToID( mesh ), "Mesh" );</p>\r
+<p class="whs3"> pass</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">print ""</p>\r
\r
-<p class="whs2"># Criterion : MULTI-CONNECTION \r
- 2D = 2</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>\r
+<p class="whs4"># create a group</p>\r
\r
-<p class="whs1">aFunctor = aFilterMgr.CreateMultiConnection2D()</p>\r
+<p class="whs3">aGroup = mesh.CreateGroup(SMESH.FACE, \r
+ "Borders at multi-connection 2D = " + `nb_conn`)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aGroup.Add(anIds)</p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateEqualTo()</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
- aFunctor )</p>\r
+<p class="whs3">salome.sg.updateObjBrowser(1) \r
+ </p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
- 2 )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<h3><a name=bookmark6>Area</a></h3>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B><span \r
+ style="font-weight: bold; color: #ff0000;"><font color=red ><B># Attention! This script has \r
+ been written using the old approach basing on direct usage of SMESH idl \r
+ interface.</B></font></span></B></font></span></p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to check area. </p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs2"># print the result</p>\r
+<p class="whs3">import SMESH</p>\r
+\r
+<p class="whs3">import SMESH_mechanic</p>\r
\r
-<p class="whs1">print "Criterion: \r
- Borders at multi-connection 2D = 2 Nb = ", len( anIds )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">for i in range( \r
- len( anIds ) ):</p>\r
+<p class="whs3">smesh = \r
+ SMESH_mechanic.smesh</p>\r
+\r
+<p class="whs3">mesh = \r
+ SMESH_mechanic.mesh</p>\r
\r
-<p class="whs1"> print \r
- anIds[ i ]</p>\r
+<p class="whs3">salome = SMESH_mechanic.salome</p>\r
\r
<p class="whs2"> </p>\r
\r
-<p class="whs2"># create a group</p>\r
+<p class="whs2"># Criterion : AREA > \r
+ 100.</p>\r
\r
-<p class="whs1">aGroup = mesh.CreateGroup( \r
- SMESH.FACE, "Borders at multi-connection 2D = 2" )</p>\r
+<p class="whs3">area_margin = 100.</p>\r
\r
-<p class="whs1">aGroup.Add( anIds \r
- )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
- </p>\r
+<p class="whs3">aFilterMgr = smesh.CreateFilterManager()</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">aFunctor = aFilterMgr.CreateArea()</p>\r
\r
-<h3><a name=bookmark6>Area</a></h3>\r
+<p class="whs3"> </p>\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> \r
+<p class="whs3">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
\r
-<p class="whs1">import SMESH</p>\r
+<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>\r
\r
-<p class="whs1">import SMESH_mechanic</p>\r
+<p class="whs3">aPredicate.SetMargin(area_margin)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">smesh = \r
- SMESH_mechanic.smesh</p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1">mesh = \r
- SMESH_mechanic.mesh</p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs1">salome = SMESH_mechanic.salome</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
-<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>\r
+<p class="whs2"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs2"># print the result</p>\r
\r
-<p class="whs2"># Criterion : AREA > \r
- 100</p>\r
+<p class="whs3">print "Criterion: \r
+ Area > ", area_margin, " Nb = ", len(anIds)</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">j = 1</p>\r
\r
-<p class="whs1">aFunctor = aFilterMgr.CreateArea()</p>\r
+<p class="whs3">for i in range(len(anIds)):</p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
+<p class="whs3"> if \r
+ j > 20: j = 1; print ""</p>\r
\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
- aFunctor )</p>\r
+<p class="whs3"> print \r
+ anIds[i],</p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
- 100 )</p>\r
+<p class="whs3"> j \r
+ = j + 1</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> pass</p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs3">print ""</p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs2"># create a group</p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs3">aGroup = mesh.CreateGroup(SMESH.FACE, \r
+ "Area > " + `area_margin`)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aGroup.Add(anIds)</p>\r
\r
-<p class="whs2"># print the result</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">print "Criterion: \r
- Area > 100 Nb = ", len( anIds )</p>\r
+<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
+ </p>\r
\r
-<p class="whs1">for i in range( \r
- len( anIds ) ):</p>\r
+<h3><a name=bookmark7>Taper</a></h3>\r
\r
-<p class="whs1"> print \r
- anIds[ i ]</p>\r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B><span \r
+ style="font-weight: bold; color: #ff0000;"><font color=red ><B># Attention! This script has \r
+ been written using the old approach basing on direct usage of SMESH idl \r
+ interface.</B></font></span></B></font></span></p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to check taper. </p>\r
\r
-<p class="whs2"># create a group</p>\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
\r
-<p class="whs1">aGroup = mesh.CreateGroup( \r
- SMESH.FACE, "Area > 100" )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aGroup.Add( anIds \r
- )</p>\r
+<p class="whs3">import SMESH</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">import SMESH_mechanic</p>\r
\r
-<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
- </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">smesh = \r
+ SMESH_mechanic.smesh</p>\r
\r
-<h3><a name=bookmark7>Taper</a></h3>\r
+<p class="whs3">mesh = \r
+ SMESH_mechanic.mesh</p>\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> \r
+<p class="whs3">salome = SMESH_mechanic.salome</p>\r
\r
-<p class="whs1">import SMESH</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">import SMESH_mechanic</p>\r
+<p class="whs4"># Criterion : Taper \r
+ > 3e-20</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">taper_margin = 3e-20</p>\r
\r
-<p class="whs1">smesh = \r
- SMESH_mechanic.smesh</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">mesh = \r
- SMESH_mechanic.mesh</p>\r
+<p class="whs3">aFilterMgr = smesh.CreateFilterManager()</p>\r
\r
-<p class="whs1">salome = SMESH_mechanic.salome</p>\r
+<p class="whs3">aFunctor = aFilterMgr.CreateTaper()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>\r
\r
-<p class="whs2"># Criterion : Taper > \r
- 3e-20</p>\r
+<p class="whs3">aPredicate.SetMargin(taper_margin)</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFunctor = aFilterMgr.CreateTaper()</p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
- aFunctor )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
- 3e-20 )</p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs4"># print the result</p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs3">print "Criterion: \r
+ Taper > ", taper_margin, " Nb = ", len(anIds)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">j = 1</p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs3">for i in range(len(anIds)):</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3"> if \r
+ j > 20: j = 1; print ""</p>\r
\r
-<p class="whs2"># print the result</p>\r
+<p class="whs3"> print \r
+ anIds[i],</p>\r
\r
-<p class="whs1">print "Criterion: \r
- Taper > 3e-20 Nb = ", len( anIds )</p>\r
+<p class="whs3"> j \r
+ = j + 1</p>\r
\r
-<p class="whs1">for i in range( \r
- len( anIds ) ):</p>\r
+<p class="whs3"> pass</p>\r
\r
-<p class="whs1"> print \r
- anIds[ i ]</p>\r
+<p class="whs3">print ""</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"># create a group</p>\r
+<p class="whs4"># create a group</p>\r
\r
-<p class="whs1">aGroup = mesh.CreateGroup( \r
- SMESH.FACE, "Taper > 3e-20" )</p>\r
+<p class="whs3">aGroup = mesh.CreateGroup(SMESH.FACE, \r
+ "Taper > " + `taper_margin`)</p>\r
\r
-<p class="whs1">aGroup.Add( anIds \r
- )</p>\r
+<p class="whs3">aGroup.Add(anIds)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
+<p class="whs3">salome.sg.updateObjBrowser(1) \r
</p>\r
\r
-<p class="whs2"> </p>\r
-\r
<h3><a name=bookmark8>Aspect Ratio</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> \r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B><span \r
+ style="font-weight: bold; color: #ff0000;"><font color=red ><B># Attention! This script has \r
+ been written using the old approach basing on direct usage of SMESH idl \r
+ interface.</B></font></span></B></font></span></p>\r
\r
-<p class="whs1">import SMESH</p>\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to check aspect ratio. </p>\r
\r
-<p class="whs1">import SMESH_mechanic</p>\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">smesh = \r
+<p class="whs3">import SMESH</p>\r
+\r
+<p class="whs3">import SMESH_mechanic</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">smesh = \r
SMESH_mechanic.smesh</p>\r
\r
-<p class="whs1">mesh = \r
+<p class="whs3">mesh = \r
SMESH_mechanic.mesh</p>\r
\r
-<p class="whs1">salome = SMESH_mechanic.salome</p>\r
+<p class="whs3">salome = SMESH_mechanic.salome</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>\r
+<p class="whs4"># Criterion : ASPECT \r
+ RATIO > 1.8</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">ar_margin = 1.8</p>\r
\r
-<p class="whs2"># Criterion : ASPECT RATIO \r
- > 1.4</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">aFilterMgr = smesh.CreateFilterManager()</p>\r
\r
-<p class="whs1">aFunctor = aFilterMgr.CreateAspectRatio()</p>\r
+<p class="whs3">aFunctor = aFilterMgr.CreateAspectRatio()</p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
- aFunctor )</p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
- 1.4 )</p>\r
+<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aPredicate.SetMargin(ar_margin)</p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
-<p class="whs2"># print the result</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">print "Criterion: \r
- Aspect Ratio > 1.4 Nb = ", len( anIds )</p>\r
+<p class="whs4"># print the result</p>\r
\r
-<p class="whs1">for i in range( \r
- len( anIds ) ):</p>\r
+<p class="whs3">print "Criterion: \r
+ Aspect Ratio > ", ar_margin, " Nb = ", len(anIds)</p>\r
\r
-<p class="whs1"> print \r
- anIds[ i ]</p>\r
+<p class="whs3">j = 1</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">for i in range(len(anIds)):</p>\r
\r
-<p class="whs2"># create a group</p>\r
+<p class="whs3"> if \r
+ j > 20: j = 1; print ""</p>\r
+\r
+<p class="whs3"> print \r
+ anIds[i],</p>\r
\r
-<p class="whs1">aGroup = mesh.CreateGroup( \r
- SMESH.FACE, "Aspect Ratio > 1.4" )</p>\r
+<p class="whs3"> j \r
+ = j + 1</p>\r
\r
-<p class="whs1">aGroup.Add( anIds \r
- )</p>\r
+<p class="whs3"> pass</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">print ""</p>\r
\r
-<p class="whs1">salome.sg.updateObjBrowser(1) \r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"># create a group</p>\r
+\r
+<p class="whs3">aGroup = mesh.CreateGroup(SMESH.FACE, \r
+ "Aspect Ratio > " + `ar_margin`)</p>\r
+\r
+<p class="whs3">aGroup.Add(anIds)</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">salome.sg.updateObjBrowser(1) \r
</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
<h3><a name=bookmark9>Minimum Angle</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> \r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B><span \r
+ style="font-weight: bold; color: #ff0000;"><font color=red ><B># Attention! This script has \r
+ been written using the old approach basing on direct usage of SMESH idl \r
+ interface.</B></font></span></B></font></span></p>\r
+\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to check minimum angle. </p>\r
+\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">import SMESH</p>\r
+<p class="whs3">import SMESH</p>\r
\r
-<p class="whs1">import SMESH_mechanic</p>\r
+<p class="whs3">import SMESH_mechanic</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">smesh = \r
+<p class="whs3">smesh = \r
SMESH_mechanic.smesh</p>\r
\r
-<p class="whs1">mesh = \r
+<p class="whs3">mesh = \r
SMESH_mechanic.mesh</p>\r
\r
-<p class="whs1">salome = SMESH_mechanic.salome</p>\r
+<p class="whs3">salome = SMESH_mechanic.salome</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>\r
+<p class="whs4"># Criterion : MINIMUM \r
+ ANGLE < 35.</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">min_angle = 35.</p>\r
\r
-<p class="whs3"># Criterion : MINIMUM \r
- ANGLE < 70</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aFilterMgr = smesh.CreateFilterManager()</p>\r
\r
-<p class="whs1">aFunctor = aFilterMgr.CreateMinimumAngle()</p>\r
+<p class="whs3">aFunctor = aFilterMgr.CreateMinimumAngle()</p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateLessThan()</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
- aFunctor )</p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateLessThan()</p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
- 70 )</p>\r
+<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aPredicate.SetMargin(min_angle)</p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
-<p class="whs3"># print the result</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">print "Criterion: \r
- Minimum Angle < 70 Nb = ", len( anIds )</p>\r
+<p class="whs4"># print the result</p>\r
\r
-<p class="whs1">for i in range( \r
- len( anIds ) ):</p>\r
+<p class="whs3">print "Criterion: \r
+ Minimum Angle < ", min_angle, " Nb = ", len(anIds)</p>\r
\r
-<p class="whs1"> print \r
- anIds[ i ]</p>\r
+<p class="whs3">j = 1</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">for i in range(len(anIds)):</p>\r
\r
-<p class="whs3"># create a group</p>\r
+<p class="whs3"> if \r
+ j > 20: j = 1; print ""</p>\r
\r
-<p class="whs1">aGroup = mesh.CreateGroup( \r
- SMESH.FACE, "Minimum Angle < 70" )</p>\r
+<p class="whs3"> print \r
+ anIds[i],</p>\r
\r
-<p class="whs1">aGroup.Add( anIds \r
- )</p>\r
+<p class="whs3"> j \r
+ = j + 1</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> pass</p>\r
\r
-<p class="whs1">salome.sg.updateObjBrowser(1) \r
+<p class="whs3">print ""</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"># create a group</p>\r
+\r
+<p class="whs3">aGroup = mesh.CreateGroup(SMESH.FACE, \r
+ "Minimum Angle < " + `min_angle`)</p>\r
+\r
+<p class="whs3">aGroup.Add(anIds)</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">salome.sg.updateObjBrowser(1) \r
</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
<h3><a name=bookmark10>Warping</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> \r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B><span \r
+ style="font-weight: bold; color: #ff0000;"><font color=red ><B># Attention! This script has \r
+ been written using the old approach basing on direct usage of SMESH idl \r
+ interface.</B></font></span></B></font></span></p>\r
+\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to check warping. </p>\r
\r
-<p class="whs1">import SMESH</p>\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
\r
-<p class="whs1">import SMESH_mechanic</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">import SMESH</p>\r
\r
-<p class="whs1">smesh = \r
+<p class="whs3">import SMESH_mechanic</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">smesh = \r
SMESH_mechanic.smesh</p>\r
\r
-<p class="whs1">mesh = \r
+<p class="whs3">mesh = \r
SMESH_mechanic.mesh</p>\r
\r
-<p class="whs1">salome = SMESH_mechanic.salome</p>\r
+<p class="whs3">salome = SMESH_mechanic.salome</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>\r
+<p class="whs4"># Criterion : WARP \r
+ ANGLE > 1e-15</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">wa_margin = 1e-15</p>\r
\r
-<p class="whs2"># Criterion : WARP ANGLE \r
- > 1e-15</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">aFilterMgr = smesh.CreateFilterManager()</p>\r
\r
-<p class="whs1">aFunctor = aFilterMgr.CreateWarping()</p>\r
+<p class="whs3">aFunctor = aFilterMgr.CreateWarping()</p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
- aFunctor )</p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
- 1e-15 )</p>\r
+<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aPredicate.SetMargin(wa_margin)</p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
-<p class="whs2"># print the result</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">print "Criterion: \r
- Warp > 1e-15 Nb = ", len( anIds )</p>\r
+<p class="whs4"># print the result</p>\r
\r
-<p class="whs1">for i in range( \r
- len( anIds ) ):</p>\r
+<p class="whs3">print "Criterion: \r
+ Warp > ", wa_margin, " Nb = ", len(anIds)</p>\r
\r
-<p class="whs1"> print \r
- anIds[ i ]</p>\r
+<p class="whs3">j = 1</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">for i in range(len(anIds)):</p>\r
\r
-<p class="whs2"># create a group</p>\r
+<p class="whs3"> if \r
+ j > 20: j = 1; print ""</p>\r
\r
-<p class="whs1">aGroup = mesh.CreateGroup( \r
- SMESH.FACE, "Warp > 1e-15" )</p>\r
+<p class="whs3"> print \r
+ anIds[i],</p>\r
\r
-<p class="whs1">aGroup.Add( anIds \r
- )</p>\r
+<p class="whs3"> j \r
+ = j + 1</p>\r
\r
-<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
+<p class="whs3"> pass</p>\r
+\r
+<p class="whs3">print ""</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"># create a group</p>\r
+\r
+<p class="whs3">aGroup = mesh.CreateGroup(SMESH.FACE, \r
+ "Warp > " + `wa_margin`)</p>\r
+\r
+<p class="whs3">aGroup.Add(anIds)</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">salome.sg.updateObjBrowser(1) \r
</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3"> </p>\r
\r
<h3><a name=bookmark12>Skew</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> \r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B><span \r
+ style="font-weight: bold; color: #ff0000;"><font color=red ><B># Attention! This script has \r
+ been written using the old approach basing on direct usage of SMESH idl \r
+ interface.</B></font></span></B></font></span></p>\r
+\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to check skew. </p>\r
+\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
\r
-<p class="whs1">import SMESH</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">import SMESH_mechanic</p>\r
+<p class="whs3">import SMESH</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">import SMESH_mechanic</p>\r
\r
-<p class="whs1">smesh = \r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">smesh = \r
SMESH_mechanic.smesh</p>\r
\r
-<p class="whs1">mesh = \r
+<p class="whs3">mesh = \r
SMESH_mechanic.mesh</p>\r
\r
-<p class="whs1">salome = SMESH_mechanic.salome</p>\r
+<p class="whs3">salome = SMESH_mechanic.salome</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>\r
+<p class="whs4"># Criterion : Skew \r
+ > 38.</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">skew_margin = 38.</p>\r
\r
-<p class="whs2"># Criterion : Skew > \r
- 18</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aFilterMgr = smesh.CreateFilterManager()</p>\r
\r
-<p class="whs1">aFunctor = aFilterMgr.CreateSkew()</p>\r
+<p class="whs3">aFunctor = aFilterMgr.CreateSkew()</p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
- aFunctor )</p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
- 18 )</p>\r
+<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aPredicate.SetMargin(skew_margin)</p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
-<p class="whs2"># print the result</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">print "Criterion: \r
- Skew > 18 Nb = ", len( anIds )</p>\r
+<p class="whs4"># print the result</p>\r
\r
-<p class="whs1">for i in range( \r
- len( anIds ) ):</p>\r
+<p class="whs3">print "Criterion: \r
+ Skew > ", skew_margin, " Nb = ", len(anIds)</p>\r
\r
-<p class="whs1"> print \r
- anIds[ i ]</p>\r
+<p class="whs3">j = 1</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">for i in range(len(anIds)):</p>\r
\r
-<p class="whs2"># create a group</p>\r
+<p class="whs3"> if \r
+ j > 20: j = 1; print ""</p>\r
\r
-<p class="whs1">aGroup = mesh.CreateGroup( \r
- SMESH.FACE, "Skew > 18" )</p>\r
+<p class="whs3"> print \r
+ anIds[i],</p>\r
\r
-<p class="whs1">aGroup.Add( anIds \r
- )</p>\r
+<p class="whs3"> j \r
+ = j + 1</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> pass</p>\r
\r
-<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
+<p class="whs3">print ""</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"># create a group</p>\r
+\r
+<p class="whs3">aGroup = mesh.CreateGroup(SMESH.FACE, \r
+ "Skew > " + `skew_margin`)</p>\r
+\r
+<p class="whs3">aGroup.Add(anIds)</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">salome.sg.updateObjBrowser(1) \r
</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3"> </p>\r
\r
<h3><a name=bookmark11>Aspect Ratio 3D</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> \r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B><span \r
+ style="font-weight: bold; color: #ff0000;"><font color=red ><B># Attention! This script has \r
+ been written using the old approach basing on direct usage of SMESH idl \r
+ interface.</B></font></span></B></font></span></p>\r
+\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to check aspect ratio 3D. </p>\r
+\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
\r
-<p class="whs1">import SMESH</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">import SMESH_mechanic_tetra</p>\r
+<p class="whs3">import SMESH</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">import SMESH_mechanic_tetra</p>\r
\r
-<p class="whs1">smesh = \r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">smesh = \r
SMESH_mechanic_tetra.smesh</p>\r
\r
-<p class="whs1">mesh = \r
+<p class="whs3">mesh = \r
SMESH_mechanic_tetra.mesh</p>\r
\r
-<p class="whs1">salome = SMESH_mechanic_tetra.salome</p>\r
+<p class="whs3">salome = SMESH_mechanic_tetra.salome</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>\r
+<p class="whs4"># Criterion : ASPECT \r
+ RATIO 3D > 4.5</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">ar_margin = 4.5</p>\r
\r
-<p class="whs2"># Criterion : ASPECT RATIO \r
- 3D > 2.2</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">aFilterMgr = smesh.CreateFilterManager()</p>\r
\r
-<p class="whs1">aFunctor = aFilterMgr.CreateAspectRatio3D()</p>\r
+<p class="whs3">aFunctor = aFilterMgr.CreateAspectRatio3D()</p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
- aFunctor )</p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateMoreThan()</p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
- 2.2 )</p>\r
+<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aPredicate.SetMargin(ar_margin)</p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
-<p class="whs2"># print the result</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">print "Criterion: \r
- Aspect Ratio 3D > 2.2 Nb = ", len( anIds )</p>\r
+<p class="whs4"># print the result</p>\r
\r
-<p class="whs1">for i in range( \r
- len( anIds ) ):</p>\r
+<p class="whs3">print "Criterion: \r
+ Aspect Ratio 3D > ", ar_margin, " Nb = ", len(anIds)</p>\r
\r
-<p class="whs1"> print \r
- anIds[ i ]</p>\r
+<p class="whs3">j = 1</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">for i in range(len(anIds)):</p>\r
\r
-<p class="whs2"># create a group</p>\r
+<p class="whs3"> if \r
+ j > 20: j = 1; print ""</p>\r
\r
-<p class="whs1">aGroup = mesh.CreateGroup( \r
- SMESH.VOLUME, "Aspect Ratio 3D > 2.2" )</p>\r
+<p class="whs3"> print \r
+ anIds[i],</p>\r
\r
-<p class="whs1">aGroup.Add( anIds \r
- )</p>\r
+<p class="whs3"> j \r
+ = j + 1</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> pass</p>\r
\r
-<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
- </p>\r
+<p class="whs3">print ""</p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs4"># create a group</p>\r
+\r
+<p class="whs3">aGroup = mesh.CreateGroup(SMESH.VOLUME, \r
+ "Aspect Ratio 3D > " + `ar_margin`)</p>\r
+\r
+<p class="whs3">aGroup.Add(anIds)</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">salome.sg.updateObjBrowser(1) \r
+ </p>\r
\r
<h3><a name=Volume>Volume</a></h3>\r
\r
-<p class="whs1">import SMESH</p>\r
+<p class="whs1"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B><span \r
+ style="font-weight: bold; color: #ff0000;"><font color=red ><B># Attention! This script has \r
+ been written using the old approach basing on direct usage of SMESH idl \r
+ interface.</B></font></span></B></font></span></p>\r
\r
-<p class="whs1">import SMESH_mechanic_tetra</p>\r
+<p class="whs1"># For the moment smesh package doesn't provide \r
+ methods to check volume. </p>\r
+\r
+<p class="whs1"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
+\r
+<p class="whs2"> </p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">import SMESH</p>\r
\r
-<p class="whs1">smesh = \r
+<p class="whs3">import SMESH_mechanic_tetra</p>\r
+\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs3">smesh = \r
SMESH_mechanic_tetra.smesh</p>\r
\r
-<p class="whs1">mesh = \r
+<p class="whs3">mesh = \r
SMESH_mechanic_tetra.mesh</p>\r
\r
-<p class="whs1">salome = SMESH_mechanic_tetra.salome</p>\r
+<p class="whs3">salome = SMESH_mechanic_tetra.salome</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs2"> </p>\r
\r
-<p class="whs1">aFilterMgr = smesh.CreateFilterManager()</p>\r
+<p class="whs2"># Criterion : VOLUME < \r
+ 7.</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3">volume_margin = \r
+ 7.</p>\r
\r
-<p class="whs2"># Criterion : VOLUME < \r
- 7</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs2"> </p>\r
+<p class="whs3">aFilterMgr = smesh.CreateFilterManager()</p>\r
+\r
+<p class="whs3">aFunctor = aFilterMgr.CreateVolume3D()</p>\r
\r
-<p class="whs1">aFunctor = aFilterMgr.CreateVolume3D()</p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aPredicate = aFilterMgr.CreateLessThan()</p>\r
+<p class="whs3">aPredicate = aFilterMgr.CreateLessThan()</p>\r
\r
-<p class="whs1">aPredicate.SetNumFunctor( \r
- aFunctor )</p>\r
+<p class="whs3">aPredicate.SetNumFunctor(aFunctor)</p>\r
\r
-<p class="whs1">aPredicate.SetMargin( \r
- 7 )</p>\r
+<p class="whs3">aPredicate.SetMargin(volume_margin)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">aFilter = aFilterMgr.CreateFilter()</p>\r
+<p class="whs3">aFilter = aFilterMgr.CreateFilter()</p>\r
\r
-<p class="whs1">aFilter.SetPredicate( \r
- aPredicate )</p>\r
+<p class="whs3">aFilter.SetPredicate(aPredicate)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs1">anIds = aFilter.GetElementsId( \r
- mesh )</p>\r
+<p class="whs3">anIds = aFilter.GetElementsId(mesh)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs2"> </p>\r
\r
<p class="whs2"># print the result</p>\r
\r
-<p class="whs1">print ""</p>\r
+<p class="whs3">print ""</p>\r
+\r
+<p class="whs3">print "Criterion: \r
+ Volume < ", volume_margin, " Nb = ", len(anIds)</p>\r
+\r
+<p class="whs3">j = 1</p>\r
+\r
+<p class="whs3">for i in range(len(anIds)):</p>\r
\r
-<p class="whs1">print "Criterion: \r
- Volume < 7 Nb = ", len( anIds )</p>\r
+<p class="whs3"> if \r
+ j > 20: j = 1; print ""</p>\r
\r
-<p class="whs1">for i in range( \r
- len( anIds ) ):</p>\r
+<p class="whs3"> print \r
+ anIds[i],</p>\r
\r
-<p class="whs1"> print \r
- anIds[ i ]</p>\r
+<p class="whs3"> j \r
+ = j + 1</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> pass</p>\r
+\r
+<p class="whs3">print ""</p>\r
+\r
+<p class="whs2"> </p>\r
\r
<p class="whs2"># create a group</p>\r
\r
-<p class="whs1">aGroup = mesh.CreateGroup( \r
- SMESH.VOLUME, "Volume < 7" )</p>\r
+<p class="whs3">aGroup = mesh.CreateGroup(SMESH.VOLUME, \r
+ "Volume < " + `volume_margin`)</p>\r
\r
-<p class="whs1">aGroup.Add( anIds \r
- )</p>\r
+<p class="whs3">aGroup.Add(anIds)</p>\r
\r
-<p class="whs1"> </p>\r
+<p class="whs3"> </p>\r
\r
<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
</p>\r
h3.whs1 { margin-top:0pt; margin-bottom:0pt; }\r
h4.whs2 { margin-top:0pt; margin-bottom:0pt; }\r
p.whs3 { font-family:'Lucida Console' , monospace; margin-top:0pt; margin-bottom:0pt; }\r
-p.whs4 { margin-top:0pt; margin-bottom:0pt; }\r
+p.whs4 { margin-top:0pt; margin-bottom:0pt; font-weight:bold; color:#ff0000; }\r
p.whs5 { margin-top:0pt; margin-bottom:0pt; font-family:'Lucida Console' , monospace; }\r
+p.whs6 { margin-top:0pt; margin-bottom:0pt; font-family:'Times New Roman' , serif; }\r
+p.whs7 { margin-top:0pt; margin-bottom:0pt; }\r
-->\r
</style><script type="text/javascript" language="JavaScript">\r
<!--\r
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
\r
<p class="whs3"> </p>\r
\r
-<p class="whs3">import SMESH</p>\r
+<p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
\r
-<p class="whs3">import SMESH_mechanic</p>\r
+<p class="whs4"># For the moment smesh package doesn't provide \r
+ methods to translate meshes. </p>\r
\r
-<p class="whs3"> </p>\r
+<p class="whs4"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
\r
-<p class="whs3">mesh = \r
- SMESH_mechanic.mesh</p>\r
+<p class="whs5"> </p>\r
+\r
+<p class="whs5">import SMESH</p>\r
\r
-<p class="whs3">salome = SMESH_mechanic.salome</p>\r
+<p class="whs5">import SMESH_mechanic</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs4"># translate a mesh</p>\r
+<p class="whs5">mesh = SMESH_mechanic.mesh</p>\r
\r
-<p class="whs3">anEditor = mesh.GetMeshEditor()</p>\r
+<p class="whs5">anEditor = mesh.GetMeshEditor()</p>\r
\r
-<p class="whs3">point = SMESH.PointStruct(-150, -150, \r
- 0)</p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs3">vector = SMESH.DirStruct(point) </p>\r
+<p class="whs6"># define translation \r
+ vector</p>\r
\r
-<p class="whs3">anEditor.TranslateObject(mesh, vector, \r
- 1)</p>\r
+<p class="whs5">point = SMESH.PointStruct(-150., \r
+ -150., 0.)</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5">vector = SMESH.DirStruct(point)</p>\r
\r
-<p class="whs4"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
- </p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs6"># translate a mesh</p>\r
+\r
+<p class="whs5">doCopy = 1</p>\r
+\r
+<p class="whs5">anEditor.TranslateObject(mesh, \r
+ vector, doCopy) </p>\r
+\r
+<p class="whs7"> </p>\r
\r
<h4 class="whs2"><a name=bookmark1>Rotation</a></h4>\r
\r
<p class="whs3"> </p>\r
\r
-<p class="whs3">import SMESH</p>\r
+<p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
\r
-<p class="whs3">import SMESH_mechanic</p>\r
+<p class="whs4"># For the moment smesh package doesn't provide \r
+ methods to rotate meshes. </p>\r
+\r
+<p class="whs4"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
\r
<p class="whs3"> </p>\r
\r
<p class="whs3">import math</p>\r
\r
-<p class="whs3">mesh = \r
- SMESH_mechanic.mesh</p>\r
+<p class="whs3">import SMESH</p>\r
\r
-<p class="whs3">salome = SMESH_mechanic.salome</p>\r
+<p class="whs3">import SMESH_mechanic</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs4"># rotate a mesh </p>\r
+<p class="whs3">mesh = SMESH_mechanic.mesh</p>\r
\r
<p class="whs3">anEditor = mesh.GetMeshEditor()</p>\r
\r
-<p class="whs3">axisXYZ = SMESH.AxisStruct(0, 0, 0, 5, \r
- 5, 20)</p>\r
+<p class="whs3"> </p>\r
+\r
+<p class="whs6"># define rotation axis \r
+ and angle</p>\r
\r
-<p class="whs3">angle180 = 1.5*math.pi</p>\r
+<p class="whs3">axisXYZ = SMESH.AxisStruct(0., 0., 0., \r
+ 5., 5., 20.)</p>\r
\r
-<p class="whs3">anEditor.RotateObject(mesh, axisXYZ, angle180, \r
- 1)</p>\r
+<p class="whs3">angle270 = 1.5 * math.pi</p>\r
\r
<p class="whs3"> </p>\r
\r
-<p class="whs5">salome.sg.updateObjBrowser(1)</p>\r
+<p class="whs6"># rotate a mesh</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs3">anEditor.RotateObject(mesh, axisXYZ, angle270, \r
+ 1) </p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs7"> </p>\r
\r
<h4 class="whs2"><a name=bookmark2>Symmetry</a></h4>\r
\r
<p class="whs3"> </p>\r
\r
-<p class="whs3">import SMESH</p>\r
+<p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
\r
-<p class="whs3">import SMESH_mechanic</p>\r
+<p class="whs4"># For the moment smesh package doesn't provide \r
+ methods to create symmetrical copies of meshes. </p>\r
+\r
+<p class="whs4"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
\r
<p class="whs3"> </p>\r
\r
<p class="whs3">import math</p>\r
\r
-<p class="whs3">mesh = \r
- SMESH_mechanic.mesh</p>\r
+<p class="whs3">import SMESH</p>\r
\r
-<p class="whs3">salome = SMESH_mechanic.salome</p>\r
+<p class="whs3">import SMESH_mechanic</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs3"> </p>\r
\r
-<p class="whs4"># create a symmetrical \r
- copy of the mesh mirrored through a point</p>\r
+<p class="whs3">mesh = SMESH_mechanic.mesh</p>\r
\r
<p class="whs3">anEditor = mesh.GetMeshEditor()</p>\r
\r
-<p class="whs3">anEditor.MirrorObject(mesh, SMESH.AxisStruct(0, \r
- 0, 0, 0, 0, 0), SMESH.SMESH_MeshEditor.POINT, 1) </p>\r
-\r
<p class="whs3"> </p>\r
\r
-<p class="whs4"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
- </p>\r
+<p class="whs6"># create a symmetrical \r
+ copy of the mesh mirrored through a point</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs3">axis = SMESH.AxisStruct(0, 0, 0, 0, 0, \r
+ 0)</p>\r
+\r
+<p class="whs3">anEditor.MirrorObject(mesh, axis, SMESH.SMESH_MeshEditor.POINT, \r
+ 1) </p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs7"> </p>\r
\r
<h4 class="whs2"><a name=bookmark3>Merging \r
Nodes</a></h4>\r
\r
<p class="whs3"> </p>\r
\r
-<p class="whs3">import SMESH</p>\r
+<p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
\r
-<p class="whs3">import SMESH_mechanic</p>\r
-\r
-<p class="whs3"> </p>\r
+<p class="whs4"># For the moment smesh package doesn't provide \r
+ methods to merge nodes. </p>\r
\r
-<p class="whs3">smesh = \r
- SMESH_mechanic.smesh</p>\r
+<p class="whs4"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
\r
-<p class="whs3">mesh = \r
- SMESH_mechanic.mesh</p>\r
+<p class="whs6"> </p>\r
\r
-<p class="whs3">salome = SMESH_mechanic.salome</p>\r
+<p class="whs5">import SMESH_mechanic</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5">mesh = SMESH_mechanic.mesh</p>\r
\r
-<p class="whs4"># merge nodes</p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs3">aMeshEditor = mesh.GetMeshEditor()</p>\r
+<p class="whs5">aMeshEditor = mesh.GetMeshEditor()</p>\r
\r
-<p class="whs3">Tolerance = 25.0</p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs3"> </p>\r
+<p class="whs6"># merge nodes</p>\r
\r
-<p class="whs3">GroupsOfNodes = aMeshEditor.FindCoincidentNodes(Tolerance)</p>\r
+<p class="whs5">Tolerance = 25.0</p>\r
\r
-<p class="whs3">aMeshEditor.MergeNodes(GroupsOfNodes)</p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs3"> </p>\r
+<p class="whs5">GroupsOfNodes = \r
+ aMeshEditor.FindCoincidentNodes(Tolerance)</p>\r
\r
-<p class="whs4"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
+<p class="whs7"><span style="font-family: 'Lucida Console', monospace;">aMeshEditor.MergeNodes(GroupsOfNodes)</span> \r
</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs7"> </p>\r
\r
<h4><a name=bookmark8>Merging Elements</a></h4>\r
\r
-<p class="whs5">import geompy</p>\r
+<p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
\r
-<p class="whs5">import smesh</p>\r
+<p class="whs4"># For the moment smesh package doesn't provide \r
+ methods to merge elements. </p>\r
+\r
+<p class="whs4"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
+\r
+<p class="whs6"> </p>\r
\r
<p class="whs5">import salome</p>\r
\r
+<p class="whs5">import geompy</p>\r
+\r
+<p class="whs5">import smesh</p>\r
+\r
<p class="whs5">import SMESH</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs4"># create a face to be meshed</p>\r
+<p class="whs6"># create a face to \r
+ be meshed</p>\r
\r
<p class="whs5">px = geompy.MakeVertex(100., \r
0. , 0. \r
<p class="whs5">id_face1 = geompy.addToStudy(face1, \r
"Face1")</p>\r
\r
-<p class="whs4"> </p>\r
-\r
-<p class="whs4"># create a 2D mesh on the \r
- face</p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs5">trias = smesh.Mesh(face1, \r
- "Face : 2D mesh")</p>\r
+<p class="whs6"># create a circle to \r
+ be an extrusion path</p>\r
\r
-<p class="whs5"> </p>\r
+<p class="whs5">px1 = geompy.MakeVertex( \r
+ 100., 100., \r
+ 0.)</p>\r
\r
-<p class="whs5">algo = trias.Segment()</p>\r
+<p class="whs5">py1 = geompy.MakeVertex(-100., \r
+ -100., 0.)</p>\r
\r
-<p class="whs5">algo.NumberOfSegments(6)</p>\r
+<p class="whs5">pz1 = geompy.MakeVertex( \r
+ 0., \r
+ 0., \r
+ 50.)</p>\r
\r
<p class="whs5"> </p>\r
\r
-<p class="whs5">algo = trias.Triangle()</p>\r
+<p class="whs5">circle = geompy.MakeCircleThreePnt(py1, \r
+ pz1, px1)</p>\r
\r
-<p class="whs5">algo.LengthFromEdges()</p>\r
+<p class="whs5">id_circle = geompy.addToStudy(circle, \r
+ "Path")</p>\r
\r
<p class="whs5"> </p>\r
\r
-<p class="whs5">trias.Compute()</p>\r
-\r
-<p class="whs5"> </p>\r
+<p class="whs6"># create a 2D mesh \r
+ on the face</p>\r
\r
-<p class="whs5">tri_mesh = trias.GetMesh()</p>\r
+<p class="whs5">trias = smesh.Mesh(face1, \r
+ "Face : 2D mesh")</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs4"># create a path mesh</p>\r
+<p class="whs5">algo1D = trias.Segment()</p>\r
\r
-<p class="whs5">px1 = geompy.MakeVertex(100., \r
- 100. , \r
- 0. )</p>\r
+<p class="whs5">algo1D.NumberOfSegments(6)</p>\r
\r
-<p class="whs5">py1 = geompy.MakeVertex(-100. \r
- , -100., \r
- 0. )</p>\r
+<p class="whs5">algo2D = trias.Triangle()</p>\r
\r
-<p class="whs5">pz1 = geompy.MakeVertex(0. \r
- , 0. , \r
- 50.)</p>\r
+<p class="whs5">algo2D.LengthFromEdges()</p>\r
\r
<p class="whs5"> </p>\r
\r
-<p class="whs5">circle = geompy.MakeCircleThreePnt(py1, \r
- pz1, px1)</p>\r
+<p class="whs5">trias.Compute()</p>\r
\r
-<p class="whs5">id_circle = geompy.addToStudy(circle, \r
- "Path")</p>\r
+<p class="whs5">tri_mesh = trias.GetMesh()</p>\r
\r
-<p class="whs5"> </p>\r
+<p class="whs6"> </p>\r
+\r
+<p class="whs6"># create a path mesh</p>\r
\r
<p class="whs5">circlemesh = smesh.Mesh(circle, \r
"Path mesh")</p>\r
\r
-<p class="whs5"> </p>\r
-\r
<p class="whs5">algo = circlemesh.Segment()</p>\r
\r
<p class="whs5">algo.NumberOfSegments(10)</p>\r
\r
-<p class="whs5"> </p>\r
-\r
<p class="whs5">circlemesh.Compute()</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs6"> </p>\r
\r
-<p class="whs4"># extrusion of the mesh</p>\r
+<p class="whs6"># extrusion of the \r
+ mesh</p>\r
\r
<p class="whs5">aMeshEditor = tri_mesh.GetMeshEditor()</p>\r
\r
<p class="whs5">aMeshEditor.ExtrusionAlongPathObject(tri_mesh, \r
- circlemesh.GetMesh(), circle, 1, 0, [], 0, SMESH.PointStruct(0, 0, 0))</p>\r
+ circlemesh.GetMesh(), circle,</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5"> 1, \r
+ 0, [], 0, SMESH.PointStruct(0, 0, 0))</p>\r
\r
-<p class="whs4"># merge nodes</p>\r
+<p class="whs6"># merge nodes</p>\r
\r
<p class="whs5">print "Number \r
of nodes before MergeNodes:", tri_mesh.NbNodes()</p>\r
: \r
", tri_mesh.NbVolumes()</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs6"> </p>\r
\r
-<p class="whs4"># merge elements</p>\r
+<p class="whs6"># merge elements</p>\r
\r
<p class="whs5">aMeshEditor.MergeEqualElements()</p>\r
\r
\r
<p class="whs5"> </p>\r
\r
-<p class="whs4"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
+<p class="whs5">salome.sg.updateObjBrowser(1) \r
</p>\r
\r
+<p class="whs5"> </p>\r
+\r
<h3>Sewing Meshes</h3>\r
\r
<h4><a name=bookmark4>Sew Meshes Border to Border</a></h4>\r
\r
-<p class="whs5">import salome</p>\r
+<p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
+\r
+<p class="whs4"># For the moment smesh package doesn't provide \r
+ methods to sew meshes border to border. </p>\r
+\r
+<p class="whs4"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
+\r
+<p class="whs7"> </p>\r
\r
<p class="whs5">import geompy</p>\r
\r
<p class="whs5">import smesh</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs4"># create two faces of a \r
- box</p>\r
+<p class="whs6"># create two faces \r
+ of a box</p>\r
\r
<p class="whs5">box1 = geompy.MakeBox(0., \r
0., -10., 30., 20., 25.)</p>\r
\r
-<p class="whs5">subShapeList1 = \r
- geompy.SubShapeAll(box1, geompy.ShapeType["FACE"])</p>\r
+<p class="whs5">facesList1 = geompy.SubShapeAll(box1, \r
+ geompy.ShapeType["FACE"])</p>\r
+\r
+<p class="whs5">face1 = facesList1[2]</p>\r
\r
<p class="whs5"> </p>\r
\r
<p class="whs5">box2 = geompy.MakeBox(0., \r
5., 0., 20., 20., 15.)</p>\r
\r
-<p class="whs5">subShapeList2 = \r
- geompy.SubShapeAll(box2, geompy.ShapeType["FACE"])</p>\r
+<p class="whs5">facesList2 = geompy.SubShapeAll(box2, \r
+ geompy.ShapeType["FACE"])</p>\r
\r
-<p class="whs5">EdgesList = geompy.SubShapeAll(subShapeList2[ \r
- 1 ], geompy.ShapeType["EDGE"])</p>\r
+<p class="whs5">face2 = facesList2[1]</p>\r
\r
<p class="whs5"> </p>\r
\r
-<p class="whs5">aComp = geompy.MakeCompound( \r
- [subShapeList1[ 2 ], subShapeList2[ 1 ]] )</p>\r
-\r
-<p class="whs5">idComp = geompy.addToStudy( \r
- aComp, "Two faces" )</p>\r
+<p class="whs5">edgesList = geompy.SubShapeAll(face2, \r
+ geompy.ShapeType["EDGE"])</p>\r
\r
-<p class="whs5">aCompobj = \r
- salome.IDToObject( idComp )</p>\r
+<p class="whs5">edge1 = edgesList[2]</p>\r
\r
<p class="whs5"> </p>\r
\r
-<p class="whs4"># create a mesh on two \r
- faces</p>\r
-\r
-<p class="whs4"> </p>\r
+<p class="whs5">aComp = geompy.MakeCompound([face1, \r
+ face2])</p>\r
\r
-<p class="whs5">mesh = smesh.Mesh(aCompobj, \r
- "Two faces : quadrangle mesh")</p>\r
-\r
-<p class="whs5">algo = mesh.Segment()</p>\r
+<p class="whs5">geompy.addToStudy(aComp, \r
+ "Two faces")</p>\r
\r
<p class="whs5"> </p>\r
\r
-<p class="whs4"># define "NumberOfSegments" \r
- hypothesis to cut an edge in a fixed number of segments</p>\r
+<p class="whs6"># create a mesh on \r
+ two faces</p>\r
+\r
+<p class="whs5">mesh = smesh.Mesh(aComp, \r
+ "Two faces : quadrangle mesh")</p>\r
\r
-<p class="whs5">algo.NumberOfSegments(9)</p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5">algo1D = mesh.Segment()</p>\r
\r
-<p class="whs4"># create a quadrangle 2D \r
- algorithm for faces</p>\r
+<p class="whs5">algo1D.NumberOfSegments(9)</p>\r
\r
-<p class="whs5">mesh.Quadrangle()</p>\r
+<p class="whs5">algo2D = mesh.Quadrangle()</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs4"># create a local hypothesis</p>\r
+<p class="whs5">algo_local = mesh.Segment(edge1)</p>\r
\r
-<p class="whs5">algo = mesh.Segment(EdgesList[2])</p>\r
+<p class="whs5">algo_local.Arithmetic1D(1, \r
+ 4)</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5">algo_local.Propagation()</p>\r
\r
-<p class="whs4"># define "Arithmetic1D" \r
- hypothesis to cut an edge in several segments with increasing arithmetic \r
- length </p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs5">algo.Arithmetic1D(1, \r
- 4)</p>\r
+<p class="whs5">mesh.Compute()</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs4"># define "Propagation" \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">anEditor = mesh.GetMesh().GetMeshEditor()</p>\r
\r
-<p class="whs5">algo.Propagation()</p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs5">mesh.Compute()</p>\r
+<p class="whs6"># sew border to side</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs6"># FirstNodeIDOnFreeBorder, \r
+ SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder,</p>\r
\r
-<p class="whs4"># sew free borders</p>\r
+<p class="whs6"># FirstNodeIDOnSide, \r
+ LastNodeIDOnSide,</p>\r
\r
-<p class="whs5">anEditor = mesh.GetMesh().GetMeshEditor()</p>\r
+<p class="whs6"># CreatePolygons, CreatePolyedrs</p>\r
\r
<p class="whs5">anEditor.SewBorderToSide(5, \r
- 45, 6, 113, 109, 0, 0)</p>\r
+ 45, 6, 113, 109, 0, 0) </p>\r
\r
-<p class="whs5"> </p>\r
+<h4><a name=bookmark5>Sew Conform Free Borders</a></h4>\r
\r
-<p class="whs4"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
- </p>\r
+<p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs4"># For the moment smesh package doesn't provide \r
+ methods to sew conform free borders. </p>\r
\r
-<h4><a name=bookmark5>Sew Conform Free Borders</a></h4>\r
+<p class="whs4"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
\r
-<p class="whs5">import salome</p>\r
+<p class="whs5"> </p>\r
\r
<p class="whs5">import geompy</p>\r
\r
<p class="whs5">import smesh</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs4"># create two faces of the \r
- box</p>\r
+<p class="whs6"># create two faces \r
+ of the box</p>\r
\r
<p class="whs5">box1 = geompy.MakeBox(0., \r
0., -10., 20., 20., 15.)</p>\r
\r
-<p class="whs5">subShapeList1 = \r
- geompy.SubShapeAll(box1, geompy.ShapeType["FACE"])</p>\r
+<p class="whs5">facesList1 = geompy.SubShapeAll(box1, \r
+ geompy.ShapeType["FACE"])</p>\r
+\r
+<p class="whs5">face1 = facesList1[2]</p>\r
\r
<p class="whs5"> </p>\r
\r
<p class="whs5">box2 = geompy.MakeBox(0., \r
5., 0., 20., 20., 15.)</p>\r
\r
-<p class="whs5">subShapeList2 = \r
- geompy.SubShapeAll(box2, geompy.ShapeType["FACE"])</p>\r
+<p class="whs5">facesList2 = geompy.SubShapeAll(box2, \r
+ geompy.ShapeType["FACE"])</p>\r
\r
-<p class="whs5">EdgesList = geompy.SubShapeAll(subShapeList2[ \r
- 1 ], geompy.ShapeType["EDGE"])</p>\r
+<p class="whs5">face2 = facesList2[1]</p>\r
\r
<p class="whs5"> </p>\r
\r
-<p class="whs5">aComp = geompy.MakeCompound( \r
- [subShapeList1[ 2 ], subShapeList2[ 1 ]] )</p>\r
-\r
-<p class="whs5">idComp = geompy.addToStudy( \r
- aComp, "Two faces" )</p>\r
-\r
-<p class="whs5">aCompobj = \r
- salome.IDToObject( idComp )</p>\r
-\r
-<p class="whs4"> </p>\r
-\r
-<p class="whs4"># create a mesh on two \r
- faces</p>\r
+<p class="whs5">edgesList = geompy.SubShapeAll(face2, \r
+ geompy.ShapeType["EDGE"])</p>\r
\r
-<p class="whs5">mesh = smesh.Mesh(aCompobj, \r
- "Two faces : quadrangle mesh")</p>\r
+<p class="whs5">edge1 = edgesList[2]</p>\r
\r
-<p class="whs5">algo = mesh.Segment()</p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5">aComp = geompy.MakeCompound([face1, \r
+ face2])</p>\r
\r
-<p class="whs4"># define "NumberOfSegments" \r
- hypothesis to cut an edge in a fixed number of segments</p>\r
+<p class="whs5">geompy.addToStudy(aComp, \r
+ "Two faces")</p>\r
\r
-<p class="whs5">algo.NumberOfSegments(9)</p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs6"># create a mesh on \r
+ two faces</p>\r
\r
-<p class="whs4"># create a quadrangle 2D \r
- algorithm for faces</p>\r
+<p class="whs5">mesh = smesh.Mesh(aComp, \r
+ "Two faces : quadrangle mesh")</p>\r
\r
-<p class="whs5">mesh.Quadrangle()</p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5">algo1D = mesh.Segment()</p>\r
\r
-<p class="whs4"># create a local hypothesis</p>\r
+<p class="whs5">algo1D.NumberOfSegments(9)</p>\r
\r
-<p class="whs5">algo = mesh.Segment(EdgesList[2])</p>\r
+<p class="whs5">algo2D = mesh.Quadrangle()</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs4"># define "Arithmetic1D" \r
- hypothesis to cut an edge in several segments with increasing arithmetic \r
- length </p>\r
+<p class="whs5">algo_local = mesh.Segment(edge1)</p>\r
\r
-<p class="whs5">algo.Arithmetic1D(1, \r
+<p class="whs5">algo_local.Arithmetic1D(1, \r
4)</p>\r
\r
-<p class="whs4"> </p>\r
-\r
-<p class="whs4"># define "Propagation" \r
- hypothesis that propagate all other hypothesis on all edges on<span style="margin-top: 0pt; margin-bottom: 0pt;"> \r
- the opposite side in case of quadrangular faces</span></p>\r
+<p class="whs5">algo_local.Propagation()</p>\r
\r
-<p class="whs5">algo.Propagation()</p>\r
+<p class="whs5"> </p>\r
\r
<p class="whs5">mesh.Compute()</p>\r
\r
-<p class="whs4"> </p>\r
-\r
-<p class="whs4"># sew free borders</p>\r
+<p class="whs5"> </p>\r
\r
<p class="whs5">anEditor = mesh.GetMesh().GetMeshEditor()</p>\r
\r
-<p class="whs5">anEditor.SewConformFreeBorders(5, \r
- 45, 6, 3, 24)</p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs4"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
- </p>\r
+<p class="whs6"># sew conform free \r
+ borders</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs6"># FirstNodeID1, SecondNodeID1, \r
+ LastNodeID1, FirstNodeID2, SecondNodeID2</p>\r
+\r
+<p class="whs5">anEditor.SewConformFreeBorders(5, \r
+ 45, 6, 3, 24) </p>\r
\r
<h4><a name=bookmark6>Sew Free Borders</a></h4>\r
\r
-<p class="whs5">import salome</p>\r
+<p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
+\r
+<p class="whs4"># For the moment smesh package doesn't provide \r
+ methods to sew free borders. </p>\r
+\r
+<p class="whs4"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
+\r
+<p class="whs7"> </p>\r
\r
<p class="whs5">import geompy</p>\r
\r
<p class="whs5">import smesh</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs4"># create two faces of the \r
- box</p>\r
+<p class="whs6"># create two faces \r
+ of the box</p>\r
\r
<p class="whs5">box1 = geompy.MakeBox(0., \r
0., 0., 20., 20., 15.)</p>\r
\r
-<p class="whs5">subShapeList1 = \r
- geompy.SubShapeAll(box1, geompy.ShapeType["FACE"])</p>\r
+<p class="whs5">facesList1 = geompy.SubShapeAll(box1, \r
+ geompy.ShapeType["FACE"])</p>\r
+\r
+<p class="whs5">face1 = facesList1[2]</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5"> </p>\r
\r
<p class="whs5">box2 = geompy.MakeBox(0., \r
5., 0., 20., 20., 15.)</p>\r
\r
-<p class="whs5">subShapeList2 = \r
- geompy.SubShapeAll(box2, geompy.ShapeType["FACE"])</p>\r
+<p class="whs5">facesList2 = geompy.SubShapeAll(box2, \r
+ geompy.ShapeType["FACE"])</p>\r
\r
-<p class="whs5">EdgesList = geompy.SubShapeAll(subShapeList2[ \r
- 1 ], geompy.ShapeType["EDGE"])</p>\r
+<p class="whs5">face2 = facesList2[1]</p>\r
\r
<p class="whs5"> </p>\r
\r
-<p class="whs5">aComp = geompy.MakeCompound( \r
- [subShapeList1[ 2 ], subShapeList2[ 1 ]] )</p>\r
-\r
-<p class="whs5">idComp = geompy.addToStudy( \r
- aComp, "Two faces" )</p>\r
+<p class="whs5">edgesList = geompy.SubShapeAll(face2, \r
+ geompy.ShapeType["EDGE"])</p>\r
\r
-<p class="whs5">aCompobj = \r
- salome.IDToObject( idComp )</p>\r
+<p class="whs5">edge1 = edgesList[2]</p>\r
\r
<p class="whs5"> </p>\r
\r
-<p class="whs4"># create a mesh on two \r
- faces</p>\r
-\r
-<p class="whs5">mesh = smesh.Mesh(aCompobj, \r
- "Two faces : quadrangle mesh")</p>\r
-\r
-<p class="whs5">algo = mesh.Segment()</p>\r
-\r
-<p class="whs4"> </p>\r
+<p class="whs5">aComp = geompy.MakeCompound([face1, \r
+ face2])</p>\r
\r
-<p class="whs4"># define "NumberOfSegments" \r
- hypothesis to cut an edge in a fixed number of segments</p>\r
+<p class="whs5">geompy.addToStudy(aComp, \r
+ "Two faces")</p>\r
\r
-<p class="whs5">algo.NumberOfSegments(4)</p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs6"># create a mesh on \r
+ two faces</p>\r
\r
-<p class="whs4"># creates a quadrangle \r
- 2D algorithm for faces</p>\r
+<p class="whs5">mesh = smesh.Mesh(aComp, \r
+ "Two faces : quadrangle mesh")</p>\r
\r
-<p class="whs5">mesh.Quadrangle()</p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5">algo1D = mesh.Segment()</p>\r
\r
-<p class="whs4"># create a local hypothesis</p>\r
+<p class="whs5">algo1D.NumberOfSegments(4)</p>\r
\r
-<p class="whs5">algo = mesh.Segment(EdgesList[2])</p>\r
+<p class="whs5">algo2D = mesh.Quadrangle()</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs4"># define "Arithmetic1D" \r
- hypothesis to cut an edge in several segments with increasing \r
- arithmetic length</p>\r
+<p class="whs5">algo_local = mesh.Segment(edge1)</p>\r
\r
-<p class="whs5">algo.Arithmetic1D(1, \r
+<p class="whs5">algo_local.Arithmetic1D(1, \r
4)</p>\r
\r
-<p class="whs4"> </p>\r
-\r
-<p class="whs4"># define "Propagation" \r
- hypothesis that propagate all other hypothesis on all edges on<span style="margin-top: 0pt; margin-bottom: 0pt;"> \r
- the opposite side in case of quadrangular faces</span></p>\r
+<p class="whs5">algo_local.Propagation()</p>\r
\r
-<p class="whs5">algo.Propagation()</p>\r
+<p class="whs5"> </p>\r
\r
<p class="whs5">mesh.Compute()</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs4"># sew free borders</p>\r
+<p class="whs6"># sew free borders</p>\r
\r
-<p class="whs5">anEditor = mesh.GetMesh().GetMeshEditor()</p>\r
+<p class="whs6"># FirstNodeID1, SecondNodeID1, \r
+ LastNodeID1,</p>\r
\r
-<p class="whs5">anEditor.SewFreeBorders(6, \r
- 21, 5, 1, 12, 3, 0, 0)</p>\r
+<p class="whs6"># FirstNodeID2, SecondNodeID2, \r
+ LastNodeID2, CreatePolygons, CreatePolyedrs</p>\r
\r
-<p class="whs5"> </p>\r
-\r
-<p class="whs4"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
- </p>\r
+<p class="whs5">anEditor = mesh.GetMesh().GetMeshEditor()</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs7"><span style="font-family: 'Lucida Console', monospace;">anEditor.SewFreeBorders(6, \r
+ 21, 5, 1, 12, 3, 0, 0)</span> </p>\r
\r
<h4><a name=bookmark7>Sew Side Elements</a></h4>\r
\r
-<p class="whs5">import salome</p>\r
+<p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B># \r
+ Attention! This script has been written using the old approach basing \r
+ on direct usage of SMESH idl interface.</B></font></span></p>\r
+\r
+<p class="whs4"># For the moment smesh package doesn't provide \r
+ methods to sew side elements. </p>\r
+\r
+<p class="whs4"># In the next SALOME version the scripts will \r
+ be updated to use only the commands from smesh package.</p>\r
\r
<p class="whs5">import geompy</p>\r
\r
\r
<p class="whs5"> </p>\r
\r
-<p class="whs4"># create two faces of the \r
- box</p>\r
+<p class="whs6"># create two boxes</p>\r
\r
<p class="whs5">box1 = geompy.MakeBox(0., \r
0., 0., \r
<p class="whs5">box2 = geompy.MakeBox(0., \r
15., 0., 20., 25., 10.)</p>\r
\r
+<p class="whs5"> </p>\r
+\r
<p class="whs5">EdgesList = geompy.SubShapeAll(box2, \r
geompy.ShapeType["EDGE"])</p>\r
\r
-<p class="whs4"> </p>\r
-\r
-<p class="whs5">aComp = geompy.MakeCompound( \r
- [box1, box2] )</p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs5">idComp = geompy.addToStudy( \r
- aComp, "Two faces" )</p>\r
+<p class="whs5">aComp = geompy.MakeCompound([box1, \r
+ box2])</p>\r
\r
-<p class="whs5">aCompobj = \r
- salome.IDToObject( idComp )</p>\r
+<p class="whs5">geompy.addToStudy(aComp, \r
+ "Two boxes")</p>\r
\r
<p class="whs5"> </p>\r
\r
-<p class="whs4"># create a mesh on two \r
- faces</p>\r
+<p class="whs6"># create a mesh on \r
+ two boxes</p>\r
\r
-<p class="whs5">mesh = smesh.Mesh(aCompobj, \r
+<p class="whs5">mesh = smesh.Mesh(aComp, \r
"Two faces : quadrangle mesh")</p>\r
\r
-<p class="whs5">algo = mesh.Segment()</p>\r
-\r
-<p class="whs4"> </p>\r
-\r
-<p class="whs4"># define "NumberOfSegments" \r
- hypothesis to cut an edge in a fixed number of segments</p>\r
-\r
-<p class="whs5">algo.NumberOfSegments(2)</p>\r
-\r
-<p class="whs4"> </p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs4"># create a quadrangle 2D \r
- algorithm for faces</p>\r
+<p class="whs5">algo1D = mesh.Segment()</p>\r
\r
-<p class="whs5">mesh.Quadrangle()</p>\r
+<p class="whs5">algo1D.NumberOfSegments(2)</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5">algo2D = mesh.Quadrangle()</p>\r
\r
-<p class="whs4"># create a local hypothesis</p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs5">algo = mesh.Segment(EdgesList[8])</p>\r
+<p class="whs5">algo_local = mesh.Segment(EdgesList[8])</p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5">algo_local.NumberOfSegments(4)</p>\r
\r
-<p class="whs4"># define "Arithmetic1D" \r
- hypothesis to cut an edge in several segments with increasing arithmetic \r
- length </p>\r
+<p class="whs5">algo_local.Propagation()</p>\r
\r
-<p class="whs5">algo.NumberOfSegments(4)</p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs5">mesh.Compute()</p>\r
\r
-<p class="whs4"># define "Propagation" \r
- hypothesis that propagates all other hypothesis on all edges on <span \r
- style="margin-top: 0pt; margin-bottom: 0pt;">the opposite side in case \r
- of quadrangular faces</span></p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs5">algo.Propagation()</p>\r
+<p class="whs5">anEditor = mesh.GetMesh().GetMeshEditor()</p>\r
\r
-<p class="whs5">mesh.Compute()</p>\r
+<p class="whs5"> </p>\r
\r
-<p class="whs4"> </p>\r
+<p class="whs6"># sew side elements</p>\r
\r
-<p class="whs4"># sew free borders</p>\r
+<p class="whs6"># IDsOfSide1Elements, \r
+ IDsOfSide2Elements,</p>\r
\r
-<p class="whs5">anEditor = mesh.GetMesh().GetMeshEditor()</p>\r
+<p class="whs6"># NodeID1OfSide1ToMerge, \r
+ NodeID1OfSide2ToMerge, NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge</p>\r
\r
<p class="whs5">anEditor.SewSideElements([69, \r
70, 71, 72], [91, 92, 89, 90], 8, 38, 23, 58)</p>\r
\r
-<p class="whs4"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
- </p>\r
-\r
<script type="text/javascript" language="javascript1.2">\r
<!--\r
if (window.writeIntopicBar)\r
\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> \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"> </p>\r
\r
-<p class="whs1">smesh = salome.lcc.FindOrLoadComponent("FactoryServer", \r
- "SMESH")</p>\r
+<p class="whs2"># create a box</p>\r
\r
-<p class="whs1">smesh.SetCurrentStudy(salome.myStudy)</p>\r
-\r
-<p class="whs1"> </p>\r
+<p class="whs1">box = geompy.MakeBox(0., 0., 0., 20., \r
+ 20., 20.)</p>\r
\r
-<p class="whs1">box = \r
- geompy.MakeBox(0., 0., 0., 20., 20., 20.)</p>\r
-\r
-<p class="whs1">idbox = geompy.addToStudy(box, "box")</p>\r
+<p class="whs1">geompy.addToStudy(box, "box")</p>\r
\r
<p class="whs1"> </p>\r
\r
-<p class="whs1">subShapeList = geompy.SubShapeAll(box, \r
- geompy.ShapeType["EDGE"])</p>\r
-\r
-<p class="whs1">edge = \r
- subShapeList[0]</p>\r
+<p class="whs2"># create a mesh</p>\r
\r
-<p class="whs1">name = \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, "MeshBox")</p>\r
\r
<p class="whs1"> </p>\r
\r
-<p class="whs1">box = \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"> </p>\r
\r
-<p class="whs1">hyp1 = smesh.CreateHypothesis("NumberOfSegments", \r
- "libStdMeshersEngine.so")</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("MaxElementArea", \r
- "libStdMeshersEngine.so")</p>\r
-\r
-<p class="whs1">hyp2.SetMaxElementArea(10)</p>\r
-\r
-<p class="whs1">hyp3 = smesh.CreateHypothesis("Arithmetic1D", \r
- "libStdMeshersEngine.so")</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("Propagation", \r
- "libStdMeshersEngine.so")</p>\r
+<p class="whs1">algo2D.MaxElementArea(10.)</p>\r
\r
<p class="whs1"> </p>\r
\r
-<p class="whs1">algo1 = smesh.CreateHypothesis("Regular_1D", \r
- "libStdMeshersEngine.so")</p>\r
-\r
-<p class="whs1">algo2 = smesh.CreateHypothesis("MEFISTO_2D", \r
- "libStdMeshersEngine.so")</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"> </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"> </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"> </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 "Information about mesh:"</p>\r
\r
<p class="whs1">print "Number of faces : \r
", mesh.NbFaces()</p>\r
\r
-<p class="whs1">print "Number of triangles : \r
+<p class="whs1">print " triangles \r
+ : \r
", mesh.NbTriangles()</p>\r
\r
-<p class="whs1">print "Number of quadrangles : ", \r
- mesh.NbQuadrangles()</p>\r
+<p class="whs1">print " quadrangles \r
+ : ", mesh.NbQuadrangles()</p>\r
\r
-<p class="whs1">print "Number of polygons : \r
+<p class="whs1">print " polygons \r
+ : \r
", mesh.NbPolygons()</p>\r
\r
<p class="whs1">print "Number of volumes : \r
", mesh.NbVolumes()</p>\r
\r
-<p class="whs1">print "Number of tetrahedrons: ", \r
- mesh.NbTetras()</p>\r
+<p class="whs1">print " tetrahedrons: \r
+ ", mesh.NbTetras()</p>\r
\r
-<p class="whs1">print "Number of hexahedrons : ", \r
- mesh.NbHexas()</p>\r
+<p class="whs1">print " hexahedrons \r
+ : ", mesh.NbHexas()</p>\r
\r
-<p class="whs1">print "Number of prisms : \r
+<p class="whs1">print " prisms \r
+ : \r
", mesh.NbPrisms()</p>\r
\r
-<p class="whs1">print "Number of pyramids : \r
+<p class="whs1">print " pyramids \r
+ : \r
", mesh.NbPyramids()</p>\r
\r
-<p class="whs1">print "Number of polyhedrons : ", \r
- mesh.NbPolyhedrons()</p>\r
-\r
-<p class="whs1">salome.sg.updateObjBrowser(1) </p>\r
-\r
-<p class="whs1"> </p>\r
+<p class="whs1">print " polyhedrons \r
+ : ", mesh.NbPolyhedrons() </p>\r
\r
<script type="text/javascript" language="javascript1.2">\r
<!--\r