-<!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-family:'Lucida Console' , monospace; }\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
-h4.whs4 { margin-top:0pt; margin-bottom:0pt; }\r
-p.whs5 { margin-top:0.5pt; margin-bottom:0pt; font-family:'Lucida Console' , monospace; }\r
-p.whs6 { margin-top:0.5pt; margin-bottom:0pt; }\r
-p.whs7 { font-family:'Lucida Console' , monospace; }\r
-p.whs8 { font-family:'Times New Roman' , serif; }\r
-p.whs9 { margin-left:40px; font-family:'Lucida Console' , monospace; }\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 += "h4.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 +="</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
-<h4>Add Node</h4>\r
-\r
-<p class="whs1">import SMESH</p>\r
-\r
-<p class="whs1">import SMESH_mechanic</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">smesh = \r
- SMESH_mechanic.smesh</p>\r
-\r
-<p class="whs1">mesh = \r
- SMESH_mechanic.mesh</p>\r
-\r
-<p class="whs1">salome = SMESH_mechanic.salome</p>\r
-\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs2"># add node</p>\r
-\r
-<p class="whs1">aMeshEditor = mesh.GetMeshEditor()</p>\r
-\r
-<p class="whs1">if aMeshEditor.AddNode(50, \r
- 10, 0) == 1:</p>\r
-\r
-<p class="whs1"> print \r
- "Node addition is OK!"</p>\r
-\r
-<p class="whs1">else:</p>\r
-\r
-<p class="whs1"> print \r
- "KO node addition."</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">salome.sg.updateObjBrowser(1) \r
- </p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<h4>Add Edge</h4>\r
-\r
-<p class="whs1">import SMESH</p>\r
-\r
-<p class="whs1">import SMESH_mechanic</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">smesh = \r
- SMESH_mechanic.smesh</p>\r
-\r
-<p class="whs1">mesh = \r
- SMESH_mechanic.mesh</p>\r
-\r
-<p class="whs1">salome = SMESH_mechanic.salome</p>\r
-\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs2"># add node</p>\r
-\r
-<p class="whs1">aMeshEditor = mesh.GetMeshEditor()</p>\r
-\r
-<p class="whs1">if aMeshEditor.AddNode(50, \r
- 10, 0) == 1:</p>\r
-\r
-<p class="whs1"> print \r
- "Node addition is OK!"</p>\r
-\r
-<p class="whs1">else:</p>\r
-\r
-<p class="whs1"> print \r
- "KO node addition."</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs2"># add edge</p>\r
-\r
-<p class="whs1">LastNodeId = mesh.NbNodes()</p>\r
-\r
-<p class="whs1">if aMeshEditor.AddEdge([LastNodeId, \r
- 38]) == 1:</p>\r
-\r
-<p class="whs1"> print \r
- "Edge addition is OK!"</p>\r
-\r
-<p class="whs1">else:</p>\r
-\r
-<p class="whs1"> print \r
- "KO edge addition."</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">salome.sg.updateObjBrowser(1) \r
- </p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<h4>Add Triangle</h4>\r
-\r
-<p class="whs1">import SMESH</p>\r
-\r
-<p class="whs1">import SMESH_mechanic</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">smesh = \r
- SMESH_mechanic.smesh</p>\r
-\r
-<p class="whs1">mesh = \r
- SMESH_mechanic.mesh</p>\r
-\r
-<p class="whs1">salome = SMESH_mechanic.salome</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs2"># add node</p>\r
-\r
-<p class="whs1">aMeshEditor = mesh.GetMeshEditor()</p>\r
-\r
-<p class="whs1">if aMeshEditor.AddNode(50, \r
- 10, 0) == 1:</p>\r
-\r
-<p class="whs1"> print \r
- "Node addition is OK!"</p>\r
-\r
-<p class="whs1">else:</p>\r
-\r
-<p class="whs1"> print \r
- "KO node addition."</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">LastNodeId = mesh.NbNodes()</p>\r
-\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs2"># add triangle</p>\r
-\r
-<p class="whs1">if aMeshEditor.AddFace([LastNodeId, \r
- 38, 39]) == 1:</p>\r
-\r
-<p class="whs1"> print \r
- "Triangle addition is OK!"</p>\r
-\r
-<p class="whs1">else:</p>\r
-\r
-<p class="whs1"> print \r
- "KO triangle addition."</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">salome.sg.updateObjBrowser(1) \r
- </p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<h4>Add Quadrangle</h4>\r
-\r
-<p class="whs1">import SMESH</p>\r
-\r
-<p class="whs1">import SMESH_mechanic</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">smesh = \r
- SMESH_mechanic.smesh</p>\r
-\r
-<p class="whs1">mesh = \r
- SMESH_mechanic.mesh</p>\r
-\r
-<p class="whs1">salome = SMESH_mechanic.salome</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs2"># add node</p>\r
-\r
-<p class="whs1">aMeshEditor = mesh.GetMeshEditor()</p>\r
-\r
-<p class="whs1">if aMeshEditor.AddNode(50, \r
- 10, 0) == 1:</p>\r
-\r
-<p class="whs1"> print \r
- "Node addition is OK!"</p>\r
-\r
-<p class="whs1">else:</p>\r
-\r
-<p class="whs1"> print \r
- "KO node addition."</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">LastNodeId = mesh.NbNodes()</p>\r
-\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs2"># add quadrangle</p>\r
-\r
-<p class="whs1">if aMeshEditor.AddNode(40, \r
- 20, 0) == 1:</p>\r
-\r
-<p class="whs1"> print \r
- "Node addition is OK!"</p>\r
-\r
-<p class="whs1">else:</p>\r
-\r
-<p class="whs1"> print \r
- "KO node addition."</p>\r
-\r
-<p class="whs1">if aMeshEditor.AddFace([mesh.NbNodes(), \r
- LastNodeId, 38, 39]) == 1:</p>\r
-\r
-<p class="whs1"> print \r
- "Quadrangle addition is OK!"</p>\r
-\r
-<p class="whs1">else:</p>\r
-\r
-<p class="whs1"> print \r
- "KO quadrangle addition."</p>\r
-\r
-<p class="whs1"> </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
-<h4>Add Tetrahedron</h4>\r
-\r
-<p class="whs1">import SMESH</p>\r
-\r
-<p class="whs1">import SMESH_mechanic</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">smesh = \r
- SMESH_mechanic.smesh</p>\r
-\r
-<p class="whs1">mesh = \r
- SMESH_mechanic.mesh</p>\r
-\r
-<p class="whs1">salome = SMESH_mechanic.salome</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs2"># add node</p>\r
-\r
-<p class="whs1">aMeshEditor = mesh.GetMeshEditor()</p>\r
-\r
-<p class="whs1">if aMeshEditor.AddNode(50, \r
- 10, 0) == 1:</p>\r
-\r
-<p class="whs1"> print \r
- "Node addition is OK!"</p>\r
-\r
-<p class="whs1">else:</p>\r
-\r
-<p class="whs1"> print \r
- "KO node addition."</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">LastNodeId = mesh.NbNodes()</p>\r
-\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs2"># add tetrahedron</p>\r
-\r
-<p class="whs1">if aMeshEditor.AddVolume([LastNodeId, \r
- 38, 39, 246]) == 1:</p>\r
-\r
-<p class="whs1"> print \r
- "Tetrahedron addition is OK!"</p>\r
-\r
-<p class="whs1">else:</p>\r
-\r
-<p class="whs1"> print \r
- "KO tetrahedron addition."</p>\r
-\r
-<p class="whs1"> </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
-<h4>Add Hexahedron</h4>\r
-\r
-<p class="whs1">import SMESH</p>\r
-\r
-<p class="whs1">import SMESH_mechanic</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">smesh = \r
- SMESH_mechanic.smesh</p>\r
-\r
-<p class="whs1">mesh = \r
- SMESH_mechanic.mesh</p>\r
-\r
-<p class="whs1">salome = SMESH_mechanic.salome</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs2"># add nodes</p>\r
-\r
-<p class="whs1">aMeshEditor = mesh.GetMeshEditor()</p>\r
-\r
-<p class="whs1">if aMeshEditor.AddNode(50, \r
- 10, 0) == 1:</p>\r
-\r
-<p class="whs1"> print \r
- "Node addition is OK!"</p>\r
-\r
-<p class="whs1">else:</p>\r
-\r
-<p class="whs1"> print \r
- "KO node addition."</p>\r
-\r
-<p class="whs1">aNodeId1 = mesh.NbNodes()</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">if aMeshEditor.AddNode(47, \r
- 12, 0) == 1:</p>\r
-\r
-<p class="whs1"> print \r
- "Node addition is OK!"</p>\r
-\r
-<p class="whs1">else:</p>\r
-\r
-<p class="whs1"> print \r
- "KO node addition."</p>\r
-\r
-<p class="whs1">aNodeId2 = mesh.NbNodes()</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">if aMeshEditor.AddNode(50, \r
- 10, 10) == 1:</p>\r
-\r
-<p class="whs1"> print \r
- "Node addition is OK!"</p>\r
-\r
-<p class="whs1">else:</p>\r
-\r
-<p class="whs1"> print \r
- "KO node addition."</p>\r
-\r
-<p class="whs1">aNodeId3 = mesh.NbNodes()</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">if aMeshEditor.AddNode(47, \r
- 12, 10) == 1:</p>\r
-\r
-<p class="whs1"> print \r
- "Node addition is OK!"</p>\r
-\r
-<p class="whs1">else:</p>\r
-\r
-<p class="whs1"> print \r
- "KO node addition."</p>\r
-\r
-<p class="whs1">aNodeId4 = mesh.NbNodes()</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs2"># add hexahedron</p>\r
-\r
-<p class="whs1">if aMeshEditor.AddVolume([aNodeId2, \r
- aNodeId1, 38, 39, aNodeId4, aNodeId3, 245, 246]) == 1:</p>\r
-\r
-<p class="whs1"> print \r
- "Hexahedron addition is OK!"</p>\r
-\r
-<p class="whs1">else:</p>\r
-\r
-<p class="whs1"> print \r
- "KO Hexahedron addition."</p>\r
-\r
-<p class="whs1"> </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
-<h4>Add Polygon</h4>\r
-\r
-<p class="whs1">import salome</p>\r
-\r
-<p class="whs1">import geompy</p>\r
-\r
-<p class="whs1">import math</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">import StdMeshers</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs2"># GEOM module </p>\r
-\r
-<p class="whs1">shape_mesh = geompy.MakeCylinderRH(13, \r
- 77)</p>\r
-\r
-<p class="whs1">geompy.addToStudy(shape_mesh, \r
- "cylinder")</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs2"># SMESH module</p>\r
-\r
-<p class="whs1">smesh = salome.lcc.FindOrLoadComponent("FactoryServer", \r
- "SMESH")</p>\r
-\r
-<p class="whs1">smesh.SetCurrentStudy(salome.myStudy)</p>\r
-\r
-<p class="whs1">mesh = smesh.CreateMesh(shape_mesh)</p>\r
-\r
-<p class="whs1">MeshEditor = mesh.GetMeshEditor()</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs2"># a method to build a polygonal \r
- mesh element with nb_vert angles:</p>\r
-\r
-<p class="whs1">def MakePolygon \r
- (a_mesh, x0, y0, z0, radius, nb_vert):</p>\r
-\r
-<p class="whs1"> node_start_id \r
- = a_mesh.NbNodes() + 1</p>\r
-\r
-<p class="whs1"> al \r
- = 2.0 * math.pi / nb_vert</p>\r
-\r
-<p class="whs1"> node_ids \r
- = []</p>\r
-\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs2"># Create nodes for a polyhedron</p>\r
-\r
-<p class="whs1"> for \r
- ii in range(nb_vert):</p>\r
-\r
-<p class="whs1"> MeshEditor.AddNode(x0 \r
- + radius * math.cos(ii*al),</p>\r
-\r
-<p class="whs1"> y0 \r
- + radius * math.sin(ii*al),</p>\r
-\r
-<p class="whs1"> z0)</p>\r
-\r
-<p class="whs1"> node_ids.append(node_start_id \r
- + ii)</p>\r
-\r
-<p class="whs1"> pass</p>\r
-\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs2"># Create a polygon</p>\r
-\r
-<p class="whs1"> MeshEditor.AddPolygonalFace(node_ids)</p>\r
-\r
-<p class="whs1"> return \r
- 0</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs2"># Create three polygons</p>\r
-\r
-<p class="whs1">MakePolygon(mesh, \r
- 0, 0, 0, \r
- 30, 13)</p>\r
-\r
-<p class="whs1">MakePolygon(mesh, \r
- 0, 0, 10, 21, 9)</p>\r
-\r
-<p class="whs1">MakePolygon(mesh, \r
- 0, 0, 20, 13, 6)</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">salome.sg.updateObjBrowser(1) \r
- </p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<h4>Add polyhedron</h4>\r
-\r
-<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">import \r
- salome</span></p>\r
-\r
-<p class="whs1">import geompy</p>\r
-\r
-<p class="whs1">import math</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">#import SMESH</p>\r
-\r
-<p class="whs1">import StdMeshers</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs3"># GEOM</p>\r
-\r
-<p class="whs1">shape_mesh = geompy.MakeCylinderRH(13, \r
- 77)</p>\r
-\r
-<p class="whs1">geompy.addToStudy(shape_mesh, \r
- "cylinder")</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs3"># SMESH</p>\r
-\r
-<p class="whs1">smesh = salome.lcc.FindOrLoadComponent("FactoryServer", \r
- "SMESH")</p>\r
-\r
-<p class="whs1">smesh.SetCurrentStudy(salome.myStudy)</p>\r
-\r
-<p class="whs1">mesh = smesh.CreateMesh(shape_mesh)</p>\r
-\r
-<p class="whs1">MeshEditor = mesh.GetMeshEditor()</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs3"># Now we are going \r
- to create a 12-hedron:</p>\r
-\r
-<p class="whs3"> </p>\r
-\r
-<p class="whs3"># Create nodes for \r
- polyhedron</p>\r
-\r
-<p class="whs1">al = 2 * math.pi \r
- / 5.0</p>\r
-\r
-<p class="whs1">cosal = math.cos(al)</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">aa = 13</p>\r
-\r
-<p class="whs1">rr = aa / (2.0 * \r
- math.sin(al/2.0))</p>\r
-\r
-<p class="whs1">dr = 2.0 * rr * \r
- cosal</p>\r
-\r
-<p class="whs1">r1 = rr + dr</p>\r
-\r
-<p class="whs1">dh = rr * math.sqrt(2.0 \r
- * (1.0 - cosal * (1.0 + 2.0 * cosal)))</p>\r
-\r
-<p class="whs1">hh = 2.0 * dh - \r
- dr * (rr*(cosal - 1) + (rr + dr)*(math.cos(al/2) - 1)) / dh</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">for i in range(5):</p>\r
-\r
-<p class="whs1"> MeshEditor.AddNode(rr*math.cos(i*al), \r
- rr*math.sin(i*al), 0) \r
- <span style="font-family: 'Times New Roman', serif;"># 1,3,5,7, 9 # bottom</span></p>\r
-\r
-<p class="whs1"> MeshEditor.AddNode(r1*math.cos(i*al), \r
- r1*math.sin(i*al), dh) <span style="font-family: 'Times New Roman', serif;"># \r
- 2,4,6,8,10 # above bottom</span></p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">for i in range(5):</p>\r
-\r
-<p class="whs1"> MeshEditor.AddNode(rr*math.cos(i*al \r
- + al/2.0),</p>\r
-\r
-<p class="whs1"> rr*math.sin(i*al \r
- + al/2.0), hh) # 11,13,15,17,19 <span style="font-family: 'Times New Roman', serif;"># \r
- top</span></p>\r
-\r
-<p class="whs1"> MeshEditor.AddNode(r1*math.cos(i*al \r
- + al/2.0),</p>\r
-\r
-<p class="whs1"> r1*math.sin(i*al \r
- + al/2.0), hh - dh) # 12,14,16,18,20 <span style="font-family: 'Times New Roman', serif;"># \r
- below top</span></p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs3"># Create a polyhedral \r
- volume</p>\r
-\r
-<p class="whs1">MeshEditor.AddPolyhedralVolume([ \r
- 1, 3, 5, \r
- 7, 9, \r
- <span style="font-family: 'Times New Roman', serif;"># \r
- bottom</span></p>\r
-\r
-<p class="whs1"> 1, \r
- 2, 12, \r
- 4, 3, \r
- <span style="font-family: 'Times New Roman', serif;"># \r
- .</span></p>\r
-\r
-<p class="whs1"> 3, \r
- 4, 14, \r
- 6, 5, \r
- <span style="font-family: 'Times New Roman', serif;"># \r
- .</span></p>\r
-\r
-<p class="whs1"> 5, \r
- 6, 16, \r
- 8, 7, \r
- <span style="font-family: 'Times New Roman', serif;"># \r
- . above bottom</span></p>\r
-\r
-<p class="whs1"> 7, \r
- 8, 18, \r
- 10, 9, \r
- <span style="font-family: 'Times New Roman', serif;"># \r
- .</span></p>\r
-\r
-<p class="whs1"> 9, \r
- 10, 20, 2, \r
- 1, <span \r
- style="font-family: 'Times New Roman', serif;"># \r
- .</span></p>\r
-\r
-<p class="whs1"> 11, \r
- 12, 4, \r
- 14, 13, <span style="font-family: 'Times New Roman', serif;"># \r
- -</span></p>\r
-\r
-<p class="whs1"> 13, \r
- 14, 6, \r
- 16, 15, <span style="font-family: 'Times New Roman', serif;"># \r
- -</span></p>\r
-\r
-<p class="whs1"> 15, \r
- 16, 8, \r
- 18, 17, <span style="font-family: 'Times New Roman', serif;"># \r
- - below top</span></p>\r
-\r
-<p class="whs1"> 17, \r
- 18, 10, 20, 19, <span style="font-family: 'Times New Roman', serif;"># \r
- -</span></p>\r
-\r
-<p class="whs1"> 19, \r
- 20, 2, \r
- 12, 11, <span style="font-family: 'Times New Roman', serif;"># \r
- -</span></p>\r
-\r
-<p class="whs1"> 11, \r
- 13, 15, 17, 19], <span style="font-family: 'Times New Roman', serif;"># \r
- top</span></p>\r
-\r
-<p class="whs1"> [5,5,5,5,5,5,5,5,5,5,5,5])</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">salome.sg.updateObjBrowser(1) \r
- </p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<h3><a name=bookmark1>Removing Nodes and Elements</a></h3>\r
-\r
-<h4 class="whs4">Removing Nodes</h4>\r
-\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs1">import SMESH</p>\r
-\r
-<p class="whs1">import SMESH_mechanic</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">smesh = \r
- SMESH_mechanic.smesh</p>\r
-\r
-<p class="whs1">mesh = \r
- SMESH_mechanic.mesh</p>\r
-\r
-<p class="whs1">salome = SMESH_mechanic.salome</p>\r
-\r
-<p class="whs2"> </p>\r
-\r
-<p class="whs2"># add node</p>\r
-\r
-<p class="whs1">aMeshEditor = mesh.GetMeshEditor()</p>\r
-\r
-<p class="whs1">if aMeshEditor.RemoveNodes([246, \r
- 255]) == 1:</p>\r
-\r
-<p class="whs1"> print \r
- "Node removing is OK!"</p>\r
-\r
-<p class="whs1">else:</p>\r
-\r
-<p class="whs1"> print \r
- "KO node removing."</p>\r
-\r
-<p class="whs1"> </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
-<h4>Removing Elements</h4>\r
-\r
-<p class="whs1">import SMESH</p>\r
-\r
-<p class="whs1">import SMESH_mechanic</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">smesh = \r
- SMESH_mechanic.smesh</p>\r
-\r
-<p class="whs1">mesh = \r
- SMESH_mechanic.mesh</p>\r
-\r
-<p class="whs1">salome = SMESH_mechanic.salome</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">anEditor = mesh.GetMeshEditor()</p>\r
-\r
-<p class="whs1">anEditor.RemoveElements([850, \r
- 859, 814])</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">salome.sg.updateObjBrowser(1) \r
- </p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<h3><a name=bookmark2>Renumbering Nodes and Elements</a></h3>\r
-\r
-<p class="whs5">import SMESH</p>\r
-\r
-<p class="whs5">import SMESH_mechanic</p>\r
-\r
-<p class="whs5"> </p>\r
-\r
-<p class="whs5">mesh = \r
- SMESH_mechanic.mesh</p>\r
-\r
-<p class="whs5">salome = SMESH_mechanic.salome</p>\r
-\r
-<p class="whs5"> </p>\r
-\r
-<p class="whs5">anEditor = mesh.GetMeshEditor()</p>\r
-\r
-<p class="whs5">anEditor.RenumberNodes()</p>\r
-\r
-<p class="whs5"> </p>\r
-\r
-<p class="whs6"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
- </p>\r
-\r
-<p class="whs6"> </p>\r
-\r
-<p> </p>\r
-\r
-<h3><a name=bookmark3>Moving Nodes</a></h3>\r
-\r
-<p class="whs1">import SMESH</p>\r
-\r
-<p class="whs1">import SMESH_mechanic</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">smesh = \r
- SMESH_mechanic.smesh</p>\r
-\r
-<p class="whs1">mesh = \r
- SMESH_mechanic.mesh</p>\r
-\r
-<p class="whs1">salome = SMESH_mechanic.salome</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs2"># move node</p>\r
-\r
-<p class="whs1">aMeshEditor = mesh.GetMeshEditor()</p>\r
-\r
-<p class="whs1">aMeshEditor.MoveNode(38, \r
- 20, 10, 0)</p>\r
-\r
-<p class="whs1"> </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=bookmark4>Diagonal Inversion</a></h3>\r
-\r
-<p class="whs1">import SMESH</p>\r
-\r
-<p class="whs1">import SMESH_mechanic</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs1">smesh = \r
- SMESH_mechanic.smesh</p>\r
-\r
-<p class="whs1">mesh = \r
- SMESH_mechanic.mesh</p>\r
-\r
-<p class="whs1">salome = SMESH_mechanic.salome</p>\r
-\r
-<p class="whs1"> </p>\r
-\r
-<p class="whs2"># inverse diagonal</p>\r
-\r
-<p class="whs1">aMeshEditor = mesh.GetMeshEditor()</p>\r
-\r
-<p class="whs1">aMeshEditor.InverseDiag(700, \r
- 642)</p>\r
-\r
-<p class="whs1"> </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=bookmark5>Uniting two Triangles</a></h3>\r
-\r
-<p class="whs7">import SMESH</p>\r
-\r
-<p class="whs7">import SMESH_mechanic</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">smesh = \r
- SMESH_mechanic.smesh</p>\r
-\r
-<p class="whs7">mesh = \r
- SMESH_mechanic.mesh</p>\r
-\r
-<p class="whs7">salome = SMESH_mechanic.salome</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p># delete diagonal</p>\r
-\r
-<p class="whs7">aMeshEditor = mesh.GetMeshEditor()</p>\r
-\r
-<p class="whs7">aMeshEditor.DeleteDiag(700, \r
- 642)</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
- </p>\r
-\r
-<p> </p>\r
-\r
-<h3><a name=bookmark6>Uniting a Set of Triangles</a></h3>\r
-\r
-<p class="whs7">import SMESH</p>\r
-\r
-<p class="whs7">import SMESH_mechanic</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">smesh = \r
- SMESH_mechanic.smesh</p>\r
-\r
-<p class="whs7">mesh = \r
- SMESH_mechanic.mesh</p>\r
-\r
-<p class="whs7">salome = SMESH_mechanic.salome</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p># unite a set of triangles</p>\r
-\r
-<p class="whs7">aFilterMgr = smesh.CreateFilterManager()</p>\r
-\r
-<p class="whs7">aFunctor = aFilterMgr.CreateMinimumAngle()</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">aMeshEditor = mesh.GetMeshEditor()</p>\r
-\r
-<p class="whs7">aMeshEditor.TriToQuad([1145, \r
- 1147, 1159, 1135], aFunctor, 60)</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">salome.sg.updateObjBrowser(1) \r
- </p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<h3><a name=bookmark12>Orientation</a></h3>\r
-\r
-<p class="whs7"><span style="font-family: 'Lucida Console', monospace;">import \r
- salome</span></p>\r
-\r
-<p class="whs7">import geompy</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">import StdMeshers</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs8"># GEOM module</p>\r
-\r
-<p class="whs7">shape_mesh = geompy.MakeCylinderRH(13, \r
- 77)</p>\r
-\r
-<p class="whs7">geompy.addToStudy(shape_mesh, \r
- "cylinder")</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs8"># SMESH module</p>\r
-\r
-<p class="whs7">smesh = salome.lcc.FindOrLoadComponent("FactoryServer", \r
- "SMESH")</p>\r
-\r
-<p class="whs7">smesh.SetCurrentStudy(salome.myStudy)</p>\r
-\r
-<p class="whs7">mesh = smesh.CreateMesh(shape_mesh)</p>\r
-\r
-<p class="whs7">MeshEditor = mesh.GetMeshEditor()</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs8"># build five quadrangles:</p>\r
-\r
-<p class="whs7">node_start_id = mesh.NbNodes() \r
- + 1</p>\r
-\r
-<p class="whs7">dx = 10</p>\r
-\r
-<p class="whs7">dy = 20</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">MeshEditor.AddNode(0.0 \r
- * dx, 0, 0) # 1</p>\r
-\r
-<p class="whs7">MeshEditor.AddNode(1.0 \r
- * dx, 0, 0) # 2</p>\r
-\r
-<p class="whs7">MeshEditor.AddNode(2.0 \r
- * dx, 0, 0) # 3</p>\r
-\r
-<p class="whs7">MeshEditor.AddNode(3.0 \r
- * dx, 0, 0) # 4</p>\r
-\r
-<p class="whs7">MeshEditor.AddNode(4.0 \r
- * dx, 0, 0) # 5</p>\r
-\r
-<p class="whs7">MeshEditor.AddNode(5.0 \r
- * dx, 0, 0) # 6</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">MeshEditor.AddNode(0.0 \r
- * dx, dy, 0) # 7</p>\r
-\r
-<p class="whs7">MeshEditor.AddNode(1.0 \r
- * dx, dy, 0) # 8</p>\r
-\r
-<p class="whs7">MeshEditor.AddNode(2.0 \r
- * dx, dy, 0) # 9</p>\r
-\r
-<p class="whs7">MeshEditor.AddNode(3.0 \r
- * dx, dy, 0) # 10</p>\r
-\r
-<p class="whs7">MeshEditor.AddNode(4.0 \r
- * dx, dy, 0) # 11</p>\r
-\r
-<p class="whs7">MeshEditor.AddNode(5.0 \r
- * dx, dy, 0) # 12</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">MeshEditor.AddFace([1, \r
- 2, 8, 7])</p>\r
-\r
-<p class="whs7">MeshEditor.AddFace([2, \r
- 3, 9, 8])</p>\r
-\r
-<p class="whs7">MeshEditor.AddFace([3, \r
- 4, 10, 9])</p>\r
-\r
-<p class="whs7">MeshEditor.AddFace([4, \r
- 5, 11, 10])</p>\r
-\r
-<p class="whs7">MeshEditor.AddFace([5, \r
- 6, 12, 11])</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs8"># Change orientation \r
- of the second and the fourth faces.</p>\r
-\r
-<p class="whs7">MeshEditor.Reorient([2, \r
- 4])</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">salome.sg.updateObjBrowser(1) \r
- </p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<h3><a name=bookmark7>Cutting Quadrangles</a></h3>\r
-\r
-<p class="whs7">import SMESH</p>\r
-\r
-<p class="whs7">import SMESH_mechanic</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">smesh = \r
- SMESH_mechanic.smesh</p>\r
-\r
-<p class="whs7">mesh = \r
- SMESH_mechanic.mesh</p>\r
-\r
-<p class="whs7">salome = SMESH_mechanic.salome</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs8"># unite a set of triangles</p>\r
-\r
-<p class="whs7">aFilterMgr = smesh.CreateFilterManager()</p>\r
-\r
-<p class="whs7">aFunctor = aFilterMgr.CreateMinimumAngle()</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">aMeshEditor = mesh.GetMeshEditor()</p>\r
-\r
-<p class="whs7">aMeshEditor.QuadToTri([405, \r
- 406], aFunctor)</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">salome.sg.updateObjBrowser(1) \r
- </p>\r
-\r
-<p class="whs8"> </p>\r
-\r
-<h3><a name=bookmark8>Smoothing</a></h3>\r
-\r
-<p class="whs7">import SMESH</p>\r
-\r
-<p class="whs7">import SMESH_mechanic</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">smesh = \r
- SMESH_mechanic.smesh</p>\r
-\r
-<p class="whs7">mesh = \r
- SMESH_mechanic.mesh</p>\r
-\r
-<p class="whs7">salome = SMESH_mechanic.salome</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs8"># smooth</p>\r
-\r
-<p class="whs7">FacesSmooth = [911, \r
- 931, 950, 864, 932]</p>\r
-\r
-<p class="whs7">GroupSmooth = mesh.CreateGroup(SMESH.FACE,"Group \r
- of faces (smooth)")</p>\r
-\r
-<p class="whs7">GroupSmooth.Add(FacesSmooth)</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">aMeshEditor = mesh.GetMeshEditor()</p>\r
-\r
-<p class="whs7">aMeshEditor.SmoothObject(GroupSmooth, \r
- [], 20, 2, SMESH.SMESH_MeshEditor.CENTROIDAL_SMOOTH)</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">salome.sg.updateObjBrowser(1) \r
- </p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<h3><a name=bookmark9>Extrusion</a></h3>\r
-\r
-<p class="whs8">import SMESH</p>\r
-\r
-<p class="whs8">import SMESH_mechanic</p>\r
-\r
-<p class="whs8"> </p>\r
-\r
-<p class="whs8">smesh = \r
- SMESH_mechanic.smesh</p>\r
-\r
-<p class="whs8">mesh = \r
- SMESH_mechanic.mesh</p>\r
-\r
-<p class="whs8">salome = SMESH_mechanic.salome</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs8"># extrusion of the group</p>\r
-\r
-<p class="whs8">point = SMESH.PointStruct(0, \r
- 0, 5)</p>\r
-\r
-<p class="whs8">vector = SMESH.DirStruct(point)</p>\r
-\r
-<p class="whs8">FacesTriToQuad = [2381, \r
- 2382, 2383, 2384, 2385, 2386, 2387, 2388, 2389, 2390, 2391, 2392, 2393, \r
- 2394, 2395, 2396, 2397, 2398, 2399, 2400, 2401, 2402, 2403, 2404, 2405, \r
- 2406, 2407, 2408, 2409, 2410, 2411, 2412, 2413, 2414, 2415, 2416, 2417, \r
- 2418, 2419, 2420, 2421, 2422]</p>\r
-\r
-<p class="whs8"> </p>\r
-\r
-<p class="whs8">GroupTriToQuad = mesh.CreateGroup(SMESH.FACE,"Group \r
- of faces (quad)")</p>\r
-\r
-<p class="whs8">GroupTriToQuad.Add(FacesTriToQuad)</p>\r
-\r
-<p class="whs8"> </p>\r
-\r
-<p class="whs8">aMeshEditor = mesh.GetMeshEditor()</p>\r
-\r
-<p class="whs8">aMeshEditor.ExtrusionSweepObject(GroupTriToQuad, \r
- vector, 5)</p>\r
-\r
-<p class="whs8"> </p>\r
-\r
-<p class="whs8">salome.sg.updateObjBrowser(1) \r
- </p>\r
-\r
-<p class="whs8"> </p>\r
-\r
-<h3><a name=bookmark10>Extrusion along a Path</a></h3>\r
-\r
-<p class="whs7">import geompy</p>\r
-\r
-<p class="whs7">import smesh</p>\r
-\r
-<p class="whs7">import salome</p>\r
-\r
-<p class="whs7">import SMESH</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs8"># create a face to be \r
- meshed</p>\r
-\r
-<p class="whs7">px = geompy.MakeVertex(100., \r
- 0. , 0. \r
- )</p>\r
-\r
-<p class="whs7">py = geompy.MakeVertex(0. \r
- , 100., \r
- 0. )</p>\r
-\r
-<p class="whs7">pz = geompy.MakeVertex(0. \r
- , 0. , \r
- 100.)</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">vxy = geompy.MakeVector(px, \r
- py)</p>\r
-\r
-<p class="whs7">arc = geompy.MakeArc(py, \r
- pz, px)</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">wire = geompy.MakeWire([vxy, \r
- arc])</p>\r
-\r
-<p class="whs7">isPlanarFace = 1</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">face1 = geompy.MakeFace(wire, \r
- isPlanarFace)</p>\r
-\r
-<p class="whs7">id_face1 = geompy.addToStudy(face1, \r
- "Face1")</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs8"># create a 2D mesh on \r
- the face</p>\r
-\r
-<p class="whs7">trias = smesh.Mesh(face1, \r
- "Face : 2D mesh")</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">algo = trias.Segment()</p>\r
-\r
-<p class="whs7">algo.NumberOfSegments(6)</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">algo = trias.Triangle()</p>\r
-\r
-<p class="whs7">algo.LengthFromEdges()</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">trias.Compute()</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs8"># create a path mesh</p>\r
-\r
-<p class="whs7">px1 = geompy.MakeVertex(100., \r
- 100. , \r
- 0. )</p>\r
-\r
-<p class="whs7">py1 = geompy.MakeVertex(-100. \r
- , -100., \r
- 0. )</p>\r
-\r
-<p class="whs7">pz1 = geompy.MakeVertex(0. \r
- , 0. , \r
- 50.)</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">circle = geompy.MakeCircleThreePnt(py1, \r
- pz1, px1)</p>\r
-\r
-<p class="whs7">id_circle = geompy.addToStudy(circle, \r
- "Path")</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">circlemesh = smesh.Mesh(circle, \r
- "Path mesh")</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">algo = circlemesh.Segment()</p>\r
-\r
-<p class="whs7">algo.NumberOfSegments(10)</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">circlemesh.Compute()</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs8"># extrusion of the mesh</p>\r
-\r
-<p class="whs8"># The mesh "trias" \r
- will be extruded along another mesh, which is a sub-mesh of "circlemesh",</p>\r
-\r
-<p class="whs8"><span style="font-family: 'Times New Roman', serif;"># \r
- corresponding to geometry "circle". In this particular case \r
- the path mesh will be the whole "circlemesh"</span></p>\r
-\r
-<p class="whs8"> </p>\r
-\r
-<p class="whs7">aMeshEditor = trias.GetMesh().GetMeshEditor()</p>\r
-\r
-<p class="whs7">aMeshEditor.ExtrusionAlongPathObject(trias.GetMesh(), \r
- circlemesh.GetMesh(), circle, 1, 0, [], 0, SMESH.PointStruct(0, 0, 0))</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs8"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
- </p>\r
-\r
-<h3><a name=bookmark11>Revolution</a></h3>\r
-\r
-<p class="whs7">import SMESH</p>\r
-\r
-<p class="whs7">import SMESH_mechanic</p>\r
-\r
-<p class="whs7">import math</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">smesh = \r
- SMESH_mechanic.smesh</p>\r
-\r
-<p class="whs7">mesh = \r
- SMESH_mechanic.mesh</p>\r
-\r
-<p class="whs7">salome = SMESH_mechanic.salome</p>\r
-\r
-<p class="whs8"> </p>\r
-\r
-<p class="whs8"># rotate a sweep object</p>\r
-\r
-<p class="whs7">FacesRotate = [492, \r
- 493, 502, 503]</p>\r
-\r
-<p class="whs7">GroupRotate = mesh.CreateGroup(SMESH.FACE,"Group \r
- of faces (rotate)")</p>\r
-\r
-<p class="whs7">GroupRotate.Add(FacesRotate)</p>\r
-\r
-<p class="whs7">angle45 = 45*math.pi/180</p>\r
-\r
-<p class="whs7">axisXYZ = SMESH.AxisStruct(-38.3128, \r
- -73.3658, -23.321, -13.3402, -13.3265, 6.66632)</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">aMeshEditor = mesh.GetMeshEditor()</p>\r
-\r
-<p class="whs7">aMeshEditor.RotationSweepObject(GroupRotate, \r
- axisXYZ, angle45, 4, 1e-5)</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs8"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> \r
- </p>\r
-\r
-<p class="whs8"> </p>\r
-\r
-<h3><a name=bookmark13>Pattern Mapping</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="whs7">import salome</p>\r
-\r
-<p class="whs7">import geompy</p>\r
-\r
-<p class="whs7">import SMESH, smesh</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">geompy.init_geom(salome.myStudy)</p>\r
-\r
-<p class="whs7">smesh.smesh.SetCurrentStudy(salome.myStudy)</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs8"># define geometry</p>\r
-\r
-<p class="whs7">Box_1 = geompy.MakeBoxDXDYDZ(200, \r
- 200, 200)</p>\r
-\r
-<p class="whs7">geompy.addToStudy(Box_1, \r
- "Box_1")</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">faces = geompy.SubShapeAll(Box_1, \r
- geompy.ShapeType["FACE"])</p>\r
-\r
-<p class="whs7">Face_1 = faces[0]</p>\r
-\r
-<p class="whs7">Face_2 = faces[1]</p>\r
-\r
-<p class="whs7">geompy.addToStudyInFather(Box_1, \r
- Face_1, "Face_1")</p>\r
-\r
-<p class="whs7">geompy.addToStudyInFather(Box_1, \r
- Face_2, "Face_2")</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs8"># build quadrangle mesh \r
- 3x3 on Face_1</p>\r
-\r
-<p class="whs7">Mesh_1 = smesh.Mesh(Face_1)</p>\r
-\r
-<p class="whs7">Wire_discretisation \r
- = Mesh_1.Segment()</p>\r
-\r
-<p class="whs7">Wire_discretisation.NumberOfSegments(3)</p>\r
-\r
-<p class="whs7">Mesh_1.Quadrangle()</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">isDone = Mesh_1.Compute()</p>\r
-\r
-<p class="whs7">if not isDone: print \r
- 'Mesh Mesh_1 : computation failed'</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs8"># pattern the mesh</p>\r
-\r
-<p class="whs7">Mesh_2 = smesh.Mesh(Face_2)</p>\r
-\r
-<p class="whs7">Nb_Segments_1 = smesh.smesh.CreateHypothesis('NumberOfSegments', \r
- 'libStdMeshersEngine.so')</p>\r
-\r
-<p class="whs7">Nb_Segments_1.SetNumberOfSegments(1)</p>\r
-\r
-<p class="whs7">status = Mesh_2.GetMesh().AddHypothesis(Face_2, \r
- Nb_Segments_1)</p>\r
-\r
-<p class="whs7">status = Mesh_2.GetMesh().AddHypothesis(Face_2, \r
- Wire_discretisation.GetAlgorithm())</p>\r
-\r
-<p class="whs7">Triangle_Mefisto = \r
- Mesh_2.Triangle()</p>\r
-\r
-<p class="whs7">Max_Element_Area = \r
- Triangle_Mefisto.MaxElementArea(240)</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs7">isDone = Mesh_2.Compute()</p>\r
-\r
-<p class="whs7">if not isDone: print \r
- 'Mesh Mesh_2 : computation failed'</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs8"># create a pattern</p>\r
-\r
-<p class="whs7">pattern = smesh.smesh.GetPattern()</p>\r
-\r
-<p class="whs7">isDone = pattern.LoadFromFace(Mesh_2.GetMesh(), \r
- Face_2, 0)</p>\r
-\r
-<p class="whs7">if (isDone != 1):</p>\r
-\r
-<p class="whs9">print \r
- 'LoadFromFace :', pattern.GetErrorCode()</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs8"># apply the pattern to \r
- a face of the first mesh</p>\r
-\r
-<p class="whs7">pattern.ApplyToMeshFaces(Mesh_1.GetMesh(), \r
- [17], 0, 0)</p>\r
-\r
-<p class="whs7">isDone = pattern.MakeMesh(Mesh_1.GetMesh(), \r
- 0, 0)</p>\r
-\r
-<p class="whs7">if (isDone != 1):</p>\r
-\r
-<p class="whs9">print \r
- 'MakeMesh :', pattern.GetErrorCode()</p>\r
-\r
-<p class="whs7"> </p>\r
-\r
-<p class="whs8"><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
- writeIntopicBar(0);\r
-//-->\r
-</script>\r
-</body>\r
-</html>\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>