smesh/doc/salome/gui/SMESH/modifying_meshes.htm

1580 lines
40 KiB
HTML
Executable File

<!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: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">&nbsp;</p>
<p class="whs1">smesh &nbsp;=
SMESH_mechanic.smesh</p>
<p class="whs1">mesh &nbsp;&nbsp;=
SMESH_mechanic.mesh</p>
<p class="whs1">salome = SMESH_mechanic.salome</p>
<p class="whs2">&nbsp;</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">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;Node addition is OK!&quot;</p>
<p class="whs1">else:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;KO node addition.&quot;</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p class="whs1">salome.sg.updateObjBrowser(1)
</p>
<p class="whs1">&nbsp;</p>
<h4>Add Edge</h4>
<p class="whs1">import SMESH</p>
<p class="whs1">import SMESH_mechanic</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">smesh &nbsp;=
SMESH_mechanic.smesh</p>
<p class="whs1">mesh &nbsp;&nbsp;=
SMESH_mechanic.mesh</p>
<p class="whs1">salome = SMESH_mechanic.salome</p>
<p class="whs2">&nbsp;</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">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;Node addition is OK!&quot;</p>
<p class="whs1">else:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;KO node addition.&quot;</p>
<p class="whs1">&nbsp;</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">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;Edge addition is OK!&quot;</p>
<p class="whs1">else:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;KO edge addition.&quot;</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">salome.sg.updateObjBrowser(1)
</p>
<p class="whs1">&nbsp;</p>
<h4>Add Triangle</h4>
<p class="whs1">import SMESH</p>
<p class="whs1">import SMESH_mechanic</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">smesh &nbsp;=
SMESH_mechanic.smesh</p>
<p class="whs1">mesh &nbsp;&nbsp;=
SMESH_mechanic.mesh</p>
<p class="whs1">salome = SMESH_mechanic.salome</p>
<p class="whs1">&nbsp;</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">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;Node addition is OK!&quot;</p>
<p class="whs1">else:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;KO node addition.&quot;</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">LastNodeId = mesh.NbNodes()</p>
<p class="whs2">&nbsp;</p>
<p class="whs2"># add triangle</p>
<p class="whs1">if aMeshEditor.AddFace([LastNodeId,
38, 39]) == 1:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;Triangle addition is OK!&quot;</p>
<p class="whs1">else:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;KO triangle addition.&quot;</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p class="whs1">salome.sg.updateObjBrowser(1)
</p>
<p class="whs1">&nbsp;</p>
<h4>Add Quadrangle</h4>
<p class="whs1">import SMESH</p>
<p class="whs1">import SMESH_mechanic</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">smesh &nbsp;=
SMESH_mechanic.smesh</p>
<p class="whs1">mesh &nbsp;&nbsp;=
SMESH_mechanic.mesh</p>
<p class="whs1">salome = SMESH_mechanic.salome</p>
<p class="whs1">&nbsp;</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">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;Node addition is OK!&quot;</p>
<p class="whs1">else:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;KO node addition.&quot;</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">LastNodeId = mesh.NbNodes()</p>
<p class="whs2">&nbsp;</p>
<p class="whs2"># add quadrangle</p>
<p class="whs1">if aMeshEditor.AddNode(40,
20, 0) == 1:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;Node addition is OK!&quot;</p>
<p class="whs1">else:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;KO node addition.&quot;</p>
<p class="whs1">if aMeshEditor.AddFace([mesh.NbNodes(),
LastNodeId, 38, 39]) == 1:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;Quadrangle addition is OK!&quot;</p>
<p class="whs1">else:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;KO quadrangle addition.&quot;</p>
<p class="whs1">&nbsp;</p>
<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
</p>
<p class="whs2">&nbsp;</p>
<h4>Add Tetrahedron</h4>
<p class="whs1">import SMESH</p>
<p class="whs1">import SMESH_mechanic</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">smesh &nbsp;=
SMESH_mechanic.smesh</p>
<p class="whs1">mesh &nbsp;&nbsp;=
SMESH_mechanic.mesh</p>
<p class="whs1">salome = SMESH_mechanic.salome</p>
<p class="whs1">&nbsp;</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">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;Node addition is OK!&quot;</p>
<p class="whs1">else:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;KO node addition.&quot;</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">LastNodeId = mesh.NbNodes()</p>
<p class="whs2">&nbsp;</p>
<p class="whs2"># add tetrahedron</p>
<p class="whs1">if aMeshEditor.AddVolume([LastNodeId,
38, 39, 246]) == 1:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;Tetrahedron addition is OK!&quot;</p>
<p class="whs1">else:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;KO tetrahedron addition.&quot;</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
</p>
<p class="whs2">&nbsp;</p>
<h4>Add Hexahedron</h4>
<p class="whs1">import SMESH</p>
<p class="whs1">import SMESH_mechanic</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">smesh &nbsp;=
SMESH_mechanic.smesh</p>
<p class="whs1">mesh &nbsp;&nbsp;=
SMESH_mechanic.mesh</p>
<p class="whs1">salome = SMESH_mechanic.salome</p>
<p class="whs1">&nbsp;</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">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;Node addition is OK!&quot;</p>
<p class="whs1">else:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;KO node addition.&quot;</p>
<p class="whs1">aNodeId1 = mesh.NbNodes()</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">if aMeshEditor.AddNode(47,
12, 0) == 1:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;Node addition is OK!&quot;</p>
<p class="whs1">else:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;KO node addition.&quot;</p>
<p class="whs1">aNodeId2 = mesh.NbNodes()</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">if aMeshEditor.AddNode(50,
10, 10) == 1:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;Node addition is OK!&quot;</p>
<p class="whs1">else:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;KO node addition.&quot;</p>
<p class="whs1">aNodeId3 = mesh.NbNodes()</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">if aMeshEditor.AddNode(47,
12, 10) == 1:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;Node addition is OK!&quot;</p>
<p class="whs1">else:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;KO node addition.&quot;</p>
<p class="whs1">aNodeId4 = mesh.NbNodes()</p>
<p class="whs1">&nbsp;</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">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;Hexahedron addition is OK!&quot;</p>
<p class="whs1">else:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;KO Hexahedron addition.&quot;</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
</p>
<p class="whs2">&nbsp;</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">&nbsp;</p>
<p class="whs1">import StdMeshers</p>
<p class="whs1">&nbsp;</p>
<p class="whs2"># GEOM module </p>
<p class="whs1">shape_mesh = geompy.MakeCylinderRH(13,
77)</p>
<p class="whs1">geompy.addToStudy(shape_mesh,
&quot;cylinder&quot;)</p>
<p class="whs1">&nbsp;</p>
<p class="whs2"># SMESH module</p>
<p class="whs1">smesh = salome.lcc.FindOrLoadComponent(&quot;FactoryServer&quot;,
&quot;SMESH&quot;)</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">&nbsp;</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">&nbsp;&nbsp;&nbsp;&nbsp;node_start_id
= a_mesh.NbNodes() + 1</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;al
= 2.0 * math.pi / nb_vert</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;node_ids
= []</p>
<p class="whs2">&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p class="whs2"># Create nodes for a polyhedron</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;for
ii in range(nb_vert):</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MeshEditor.AddNode(x0
+ radius * math.cos(ii*al),</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;y0
+ radius * math.sin(ii*al),</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;z0)</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;node_ids.append(node_start_id
+ ii)</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pass</p>
<p class="whs2">&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p class="whs2"># Create a polygon</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;MeshEditor.AddPolygonalFace(node_ids)</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;return
0</p>
<p class="whs1">&nbsp;</p>
<p class="whs2"># Create three polygons</p>
<p class="whs1">MakePolygon(mesh,
0, 0, &nbsp;0,
30, 13)</p>
<p class="whs1">MakePolygon(mesh,
0, 0, 10, 21, &nbsp;9)</p>
<p class="whs1">MakePolygon(mesh,
0, 0, 20, 13, &nbsp;6)</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">salome.sg.updateObjBrowser(1)
&nbsp;</p>
<p class="whs1">&nbsp;</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">&nbsp;</p>
<p class="whs1">#import SMESH</p>
<p class="whs1">import StdMeshers</p>
<p class="whs1">&nbsp;</p>
<p class="whs3"># GEOM</p>
<p class="whs1">shape_mesh = geompy.MakeCylinderRH(13,
77)</p>
<p class="whs1">geompy.addToStudy(shape_mesh,
&quot;cylinder&quot;)</p>
<p class="whs1">&nbsp;</p>
<p class="whs3"># SMESH</p>
<p class="whs1">smesh = salome.lcc.FindOrLoadComponent(&quot;FactoryServer&quot;,
&quot;SMESH&quot;)</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">&nbsp;</p>
<p class="whs3"># Now we are going
to create a 12-hedron:</p>
<p class="whs3">&nbsp;</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">&nbsp;</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">&nbsp;</p>
<p class="whs1">for i in range(5):</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;MeshEditor.AddNode(rr*math.cos(i*al),
rr*math.sin(i*al), &nbsp;0)
<span style="font-family: 'Times New Roman', serif;"># 1,3,5,7, 9 # bottom</span></p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;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">&nbsp;</p>
<p class="whs1">for i in range(5):</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;MeshEditor.AddNode(rr*math.cos(i*al
+ al/2.0),</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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">&nbsp;&nbsp;&nbsp;&nbsp;MeshEditor.AddNode(r1*math.cos(i*al
+ al/2.0),</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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">&nbsp;</p>
<p class="whs3"># Create a polyhedral
volume</p>
<p class="whs1">MeshEditor.AddPolyhedralVolume([
1, &nbsp;3, &nbsp;5,
&nbsp;7, &nbsp;9,
&nbsp;<span style="font-family: 'Times New Roman', serif;">#
bottom</span></p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1,
&nbsp;2, 12,
&nbsp;4, &nbsp;3,
&nbsp;<span style="font-family: 'Times New Roman', serif;">#
.</span></p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3,
&nbsp;4, 14,
&nbsp;6, &nbsp;5,
&nbsp;<span style="font-family: 'Times New Roman', serif;">#
.</span></p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5,
&nbsp;6, 16,
&nbsp;8, &nbsp;7,
&nbsp;<span style="font-family: 'Times New Roman', serif;">#
. above bottom</span></p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;7,
&nbsp;8, 18,
10, &nbsp;9,
&nbsp;<span style="font-family: 'Times New Roman', serif;">#
.</span></p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;9,
10, 20, &nbsp;2,
&nbsp;1, &nbsp;<span
style="font-family: 'Times New Roman', serif;">#
.</span></p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;11,
12, &nbsp;4,
14, 13, &nbsp;<span style="font-family: 'Times New Roman', serif;">#
-</span></p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;13,
14, &nbsp;6,
16, 15, &nbsp;<span style="font-family: 'Times New Roman', serif;">#
-</span></p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;15,
16, &nbsp;8,
18, 17, &nbsp;<span style="font-family: 'Times New Roman', serif;">#
- below top</span></p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;17,
18, 10, 20, 19, &nbsp;<span style="font-family: 'Times New Roman', serif;">#
-</span></p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;19,
20, &nbsp;2,
12, 11, &nbsp;<span style="font-family: 'Times New Roman', serif;">#
-</span></p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;11,
13, 15, 17, 19], <span style="font-family: 'Times New Roman', serif;">#
top</span></p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[5,5,5,5,5,5,5,5,5,5,5,5])</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">salome.sg.updateObjBrowser(1)
&nbsp;</p>
<p class="whs1">&nbsp;</p>
<h3><a name=bookmark1>Removing Nodes and Elements</a></h3>
<h4 class="whs4">Removing Nodes</h4>
<p class="whs2">&nbsp;</p>
<p class="whs1">import SMESH</p>
<p class="whs1">import SMESH_mechanic</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">smesh &nbsp;=
SMESH_mechanic.smesh</p>
<p class="whs1">mesh &nbsp;&nbsp;=
SMESH_mechanic.mesh</p>
<p class="whs1">salome = SMESH_mechanic.salome</p>
<p class="whs2">&nbsp;</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">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;Node removing is OK!&quot;</p>
<p class="whs1">else:</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;print
&quot;KO node removing.&quot;</p>
<p class="whs1">&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
</p>
<p class="whs2">&nbsp;</p>
<h4>Removing Elements</h4>
<p class="whs1">import SMESH</p>
<p class="whs1">import SMESH_mechanic</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">smesh &nbsp;=
SMESH_mechanic.smesh</p>
<p class="whs1">mesh &nbsp;&nbsp;=
SMESH_mechanic.mesh</p>
<p class="whs1">salome = SMESH_mechanic.salome</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">anEditor = mesh.GetMeshEditor()</p>
<p class="whs1">anEditor.RemoveElements([850,
859, 814])</p>
<p class="whs1">&nbsp;</p>
<p class="whs1">salome.sg.updateObjBrowser(1)
</p>
<p class="whs1">&nbsp;</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">&nbsp;</p>
<p class="whs5">mesh &nbsp;&nbsp;=
SMESH_mechanic.mesh</p>
<p class="whs5">salome = SMESH_mechanic.salome</p>
<p class="whs5">&nbsp;</p>
<p class="whs5">anEditor = mesh.GetMeshEditor()</p>
<p class="whs5">anEditor.RenumberNodes()</p>
<p class="whs5">&nbsp;</p>
<p class="whs6"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
</p>
<p class="whs6">&nbsp;</p>
<p>&nbsp;</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">&nbsp;</p>
<p class="whs1">smesh &nbsp;=
SMESH_mechanic.smesh</p>
<p class="whs1">mesh &nbsp;&nbsp;=
SMESH_mechanic.mesh</p>
<p class="whs1">salome = SMESH_mechanic.salome</p>
<p class="whs1">&nbsp;</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">&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
</p>
<p class="whs2">&nbsp;</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">&nbsp;</p>
<p class="whs1">smesh &nbsp;=
SMESH_mechanic.smesh</p>
<p class="whs1">mesh &nbsp;&nbsp;=
SMESH_mechanic.mesh</p>
<p class="whs1">salome = SMESH_mechanic.salome</p>
<p class="whs1">&nbsp;</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">&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
</p>
<p class="whs2">&nbsp;</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">&nbsp;</p>
<p class="whs7">smesh &nbsp;=
SMESH_mechanic.smesh</p>
<p class="whs7">mesh &nbsp;&nbsp;=
SMESH_mechanic.mesh</p>
<p class="whs7">salome = SMESH_mechanic.salome</p>
<p class="whs7">&nbsp;</p>
<p># delete diagonal</p>
<p class="whs7">aMeshEditor = mesh.GetMeshEditor()</p>
<p class="whs7">aMeshEditor.DeleteDiag(700,
642)</p>
<p class="whs7">&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
</p>
<p>&nbsp;</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">&nbsp;</p>
<p class="whs7">smesh &nbsp;=
SMESH_mechanic.smesh</p>
<p class="whs7">mesh &nbsp;&nbsp;=
SMESH_mechanic.mesh</p>
<p class="whs7">salome = SMESH_mechanic.salome</p>
<p class="whs7">&nbsp;</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">&nbsp;</p>
<p class="whs7">aMeshEditor = mesh.GetMeshEditor()</p>
<p class="whs7">aMeshEditor.TriToQuad([1145,
1147, 1159, 1135], aFunctor, 60)</p>
<p class="whs7">&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p class="whs7">salome.sg.updateObjBrowser(1)
</p>
<p class="whs7">&nbsp;</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">&nbsp;</p>
<p class="whs7">import StdMeshers</p>
<p class="whs7">&nbsp;</p>
<p class="whs8"># GEOM module</p>
<p class="whs7">shape_mesh = geompy.MakeCylinderRH(13,
77)</p>
<p class="whs7">geompy.addToStudy(shape_mesh,
&quot;cylinder&quot;)</p>
<p class="whs7">&nbsp;</p>
<p class="whs8"># SMESH module</p>
<p class="whs7">smesh = salome.lcc.FindOrLoadComponent(&quot;FactoryServer&quot;,
&quot;SMESH&quot;)</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">&nbsp;</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">&nbsp;</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">&nbsp;</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">&nbsp;</p>
<p class="whs7">MeshEditor.AddFace([1,
2, &nbsp;8, &nbsp;7])</p>
<p class="whs7">MeshEditor.AddFace([2,
3, &nbsp;9, &nbsp;8])</p>
<p class="whs7">MeshEditor.AddFace([3,
4, 10, &nbsp;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">&nbsp;</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">&nbsp;</p>
<p class="whs7">salome.sg.updateObjBrowser(1)
&nbsp;</p>
<p class="whs7">&nbsp;</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">&nbsp;</p>
<p class="whs7">smesh &nbsp;=
SMESH_mechanic.smesh</p>
<p class="whs7">mesh &nbsp;&nbsp;=
SMESH_mechanic.mesh</p>
<p class="whs7">salome = SMESH_mechanic.salome</p>
<p class="whs7">&nbsp;</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">&nbsp;</p>
<p class="whs7">aMeshEditor = mesh.GetMeshEditor()</p>
<p class="whs7">aMeshEditor.QuadToTri([405,
406], aFunctor)</p>
<p class="whs7">&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p class="whs7">salome.sg.updateObjBrowser(1)
</p>
<p class="whs8">&nbsp;</p>
<h3><a name=bookmark8>Smoothing</a></h3>
<p class="whs7">import SMESH</p>
<p class="whs7">import SMESH_mechanic</p>
<p class="whs7">&nbsp;</p>
<p class="whs7">smesh &nbsp;=
SMESH_mechanic.smesh</p>
<p class="whs7">mesh &nbsp;&nbsp;=
SMESH_mechanic.mesh</p>
<p class="whs7">salome = SMESH_mechanic.salome</p>
<p class="whs7">&nbsp;</p>
<p class="whs8"># smooth</p>
<p class="whs7">FacesSmooth = [911,
931, 950, 864, 932]</p>
<p class="whs7">GroupSmooth = mesh.CreateGroup(SMESH.FACE,&quot;Group
of faces (smooth)&quot;)</p>
<p class="whs7">GroupSmooth.Add(FacesSmooth)</p>
<p class="whs7">&nbsp;</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">&nbsp;</p>
<p class="whs7">salome.sg.updateObjBrowser(1)
</p>
<p class="whs7">&nbsp;</p>
<p class="whs7">&nbsp;</p>
<h3><a name=bookmark9>Extrusion</a></h3>
<p class="whs8">import SMESH</p>
<p class="whs8">import SMESH_mechanic</p>
<p class="whs8">&nbsp;</p>
<p class="whs8">smesh &nbsp;=
SMESH_mechanic.smesh</p>
<p class="whs8">mesh &nbsp;&nbsp;=
SMESH_mechanic.mesh</p>
<p class="whs8">salome = SMESH_mechanic.salome</p>
<p class="whs7">&nbsp;</p>
<p class="whs8"># extrusion of the group</p>
<p class="whs8">point = SMESH.PointStruct(0,
0, 5)</p>
<p class="whs8">vector = SMESH.DirStruct(point)</p>
<p class="whs8">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="whs8">&nbsp;</p>
<p class="whs8">GroupTriToQuad = mesh.CreateGroup(SMESH.FACE,&quot;Group
of faces (quad)&quot;)</p>
<p class="whs8">GroupTriToQuad.Add(FacesTriToQuad)</p>
<p class="whs8">&nbsp;</p>
<p class="whs8">aMeshEditor = mesh.GetMeshEditor()</p>
<p class="whs8">aMeshEditor.ExtrusionSweepObject(GroupTriToQuad,
vector, 5)</p>
<p class="whs8">&nbsp;</p>
<p class="whs8">salome.sg.updateObjBrowser(1)
</p>
<p class="whs8">&nbsp;</p>
<h3><a name=bookmark10>Extrusion along a Path</a></h3>
<p class="whs7">import geompy</p>
<p class="whs7">import smesh</p>
<p class="whs7">import salome</p>
<p class="whs7">import SMESH</p>
<p class="whs7">&nbsp;</p>
<p class="whs8"># create a face to be
meshed</p>
<p class="whs7">px = geompy.MakeVertex(100.,
0. &nbsp;, 0.
&nbsp;)</p>
<p class="whs7">py = geompy.MakeVertex(0.
&nbsp;, 100.,
0. &nbsp;)</p>
<p class="whs7">pz = geompy.MakeVertex(0.
&nbsp;, 0. &nbsp;,
100.)</p>
<p class="whs7">&nbsp;</p>
<p class="whs7">vxy = geompy.MakeVector(px,
py)</p>
<p class="whs7">arc = geompy.MakeArc(py,
pz, px)</p>
<p class="whs7">&nbsp;</p>
<p class="whs7">wire = geompy.MakeWire([vxy,
arc])</p>
<p class="whs7">isPlanarFace = 1</p>
<p class="whs7">&nbsp;</p>
<p class="whs7">face1 = geompy.MakeFace(wire,
isPlanarFace)</p>
<p class="whs7">id_face1 = geompy.addToStudy(face1,
&quot;Face1&quot;)</p>
<p class="whs7">&nbsp;</p>
<p class="whs8"># create a 2D mesh on
the face</p>
<p class="whs7">trias = smesh.Mesh(face1,
&quot;Face : 2D mesh&quot;)</p>
<p class="whs7">&nbsp;</p>
<p class="whs7">algo = trias.Segment()</p>
<p class="whs7">algo.NumberOfSegments(6)</p>
<p class="whs7">&nbsp;</p>
<p class="whs7">algo = trias.Triangle()</p>
<p class="whs7">algo.LengthFromEdges()</p>
<p class="whs7">&nbsp;</p>
<p class="whs7">trias.Compute()</p>
<p class="whs7">&nbsp;</p>
<p class="whs8"># create a path mesh</p>
<p class="whs7">px1 = geompy.MakeVertex(100.,
100. &nbsp;,
0. &nbsp;)</p>
<p class="whs7">py1 = geompy.MakeVertex(-100.
&nbsp;, -100.,
0. &nbsp;)</p>
<p class="whs7">pz1 = geompy.MakeVertex(0.
&nbsp;, 0. &nbsp;,
50.)</p>
<p class="whs7">&nbsp;</p>
<p class="whs7">circle = geompy.MakeCircleThreePnt(py1,
pz1, px1)</p>
<p class="whs7">id_circle = geompy.addToStudy(circle,
&quot;Path&quot;)</p>
<p class="whs7">&nbsp;</p>
<p class="whs7">circlemesh = smesh.Mesh(circle,
&quot;Path mesh&quot;)</p>
<p class="whs7">&nbsp;</p>
<p class="whs7">algo = circlemesh.Segment()</p>
<p class="whs7">algo.NumberOfSegments(10)</p>
<p class="whs7">&nbsp;</p>
<p class="whs7">circlemesh.Compute()</p>
<p class="whs7">&nbsp;</p>
<p class="whs8"># extrusion of the mesh</p>
<p class="whs8"># The mesh &quot;trias&quot;
will be extruded along another mesh, which is a sub-mesh of &quot;circlemesh&quot;,</p>
<p class="whs8"><span style="font-family: 'Times New Roman', serif;">#
corresponding to geometry &quot;circle&quot;. In this particular case
the path mesh will be the whole &quot;circlemesh&quot;</span></p>
<p class="whs8">&nbsp;</p>
<p class="whs7">aMeshEditor = trias.GetMesh().GetMeshEditor()</p>
<p class="whs7">aMeshEditor.ExtrusionAlongPathObject(trias.GetMesh(),
circlemesh.GetMesh(), circle, 1, 0, [], 0, SMESH.PointStruct(0, 0, 0))</p>
<p class="whs7">&nbsp;</p>
<p class="whs8"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
</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">&nbsp;</p>
<p class="whs7">smesh &nbsp;=
SMESH_mechanic.smesh</p>
<p class="whs7">mesh &nbsp;&nbsp;=
SMESH_mechanic.mesh</p>
<p class="whs7">salome = SMESH_mechanic.salome</p>
<p class="whs8">&nbsp;</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,&quot;Group
of faces (rotate)&quot;)</p>
<p class="whs7">GroupRotate.Add(FacesRotate)</p>
<p class="whs7">angle45 = &nbsp;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">&nbsp;</p>
<p class="whs7">aMeshEditor = mesh.GetMeshEditor()</p>
<p class="whs7">aMeshEditor.RotationSweepObject(GroupRotate,
axisXYZ, angle45, 4, 1e-5)</p>
<p class="whs7">&nbsp;</p>
<p class="whs8"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
</p>
<p class="whs8">&nbsp;</p>
<h3><a name=bookmark13>Pattern Mapping</a></h3>
<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.
<br>&nbsp;
<p class="whs7">import salome</p>
<p class="whs7">import geompy</p>
<p class="whs7">import SMESH, smesh</p>
<p class="whs7">&nbsp;</p>
<p class="whs7">geompy.init_geom(salome.myStudy)</p>
<p class="whs7">smesh.smesh.SetCurrentStudy(salome.myStudy)</p>
<p class="whs7">&nbsp;</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,
&quot;Box_1&quot;)</p>
<p class="whs7">&nbsp;</p>
<p class="whs7">faces = geompy.SubShapeAll(Box_1,
geompy.ShapeType[&quot;FACE&quot;])</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, &quot;Face_1&quot;)</p>
<p class="whs7">geompy.addToStudyInFather(Box_1,
Face_2, &quot;Face_2&quot;)</p>
<p class="whs7">&nbsp;</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">&nbsp;</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">&nbsp;</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">&nbsp;</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">&nbsp;</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="whs9">print
'LoadFromFace :', pattern.GetErrorCode()</p>
<p class="whs7">&nbsp;</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="whs9">print
'MakeMesh :', pattern.GetErrorCode()</p>
<p class="whs7">&nbsp;</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>