1 <!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
\r
6 <title>Transforming Meshes</title>
\r
7 <meta http-equiv="content-type" content="text/html; charset=windows-1252">
\r
8 <meta name="generator" content="RoboHelp by eHelp Corporation www.ehelp.com"><style type="text/css">
\r
10 h3.whs1 { margin-top:0pt; margin-bottom:0pt; }
\r
11 h4.whs2 { margin-top:0pt; margin-bottom:0pt; }
\r
12 p.whs3 { font-family:'Lucida Console' , monospace; margin-top:0pt; margin-bottom:0pt; }
\r
13 p.whs4 { margin-top:0pt; margin-bottom:0pt; font-weight:bold; color:#ff0000; }
\r
14 p.whs5 { margin-top:0pt; margin-bottom:0pt; font-family:'Lucida Console' , monospace; }
\r
15 p.whs6 { margin-top:0pt; margin-bottom:0pt; font-family:'Times New Roman' , serif; }
\r
16 p.whs7 { margin-top:0pt; margin-bottom:0pt; }
\r
18 </style><script type="text/javascript" language="JavaScript">
\r
20 if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))
\r
22 var strNSS = "<style type='text/css'>";
\r
23 strNSS += "h3.whs1 {margin-top:1pt;margin-bottom:1pt; }";
\r
24 strNSS += "h4.whs2 {margin-top:1pt;margin-bottom:1pt; }";
\r
25 strNSS += "p.whs3 {margin-top:1pt;margin-bottom:1pt; }";
\r
26 strNSS += "p.whs4 {margin-top:1pt;margin-bottom:1pt; }";
\r
27 strNSS += "p.whs5 {margin-top:1pt;margin-bottom:1pt; }";
\r
28 strNSS += "p.whs6 {margin-top:1pt;margin-bottom:1pt; }";
\r
29 strNSS += "p.whs7 {margin-top:1pt;margin-bottom:1pt; }";
\r
30 strNSS +="</style>";
\r
31 document.write(strNSS);
\r
35 <script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">
\r
38 if (innerWidth != origWidth || innerHeight != origHeight)
\r
41 if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {
\r
42 origWidth = innerWidth;
\r
43 origHeight = innerHeight;
\r
49 <style type="text/css">
\r
51 div.WebHelpPopupMenu { position:absolute; left:0px; top:0px; z-index:4; visibility:hidden; }
\r
52 p.WebHelpNavBar { text-align:right; }
\r
54 </style><script type="text/javascript" language="javascript1.2" src="whmsg.js"></script>
\r
55 <script type="text/javascript" language="javascript" src="whver.js"></script>
\r
56 <script type="text/javascript" language="javascript1.2" src="whproxy.js"></script>
\r
57 <script type="text/javascript" language="javascript1.2" src="whutils.js"></script>
\r
58 <script type="text/javascript" language="javascript1.2" src="whtopic.js"></script>
\r
59 <script type="text/javascript" language="javascript1.2">
\r
61 if (window.gbWhTopic)
\r
63 if (window.setRelStartPage)
\r
65 addTocInfo("MESH module\nTUI Scripts\nTransforming Meshes");
\r
66 addButton("show",BTN_IMG,"Show","","","","",0,0,"whd_show0.gif","whd_show2.gif","whd_show1.gif");
\r
67 addButton("hide",BTN_IMG,"Hide","","","","",0,0,"whd_hide0.gif","whd_hide2.gif","whd_hide1.gif");
\r
72 if (window.setRelStartPage)
\r
74 setRelStartPage("index.htm");
\r
84 document.location.reload();
\r
88 <body><script type="text/javascript" language="javascript1.2">
\r
90 if (window.writeIntopicBar)
\r
94 <h1>Transforming Meshes</h1>
\r
96 <h3 class="whs1">Transforming Meshes</h3>
\r
98 <h4 class="whs2"> </h4>
\r
100 <h4 class="whs2"><a name=bookmark>Translation</a></h4>
\r
102 <p class="whs3"> </p>
\r
104 <p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B>#
\r
105 Attention! This script has been written using the old approach basing
\r
106 on direct usage of SMESH idl interface.</B></font></span></p>
\r
108 <p class="whs4"># For the moment smesh package doesn't provide
\r
109 methods to translate meshes. </p>
\r
111 <p class="whs4"># In the next SALOME version the scripts will
\r
112 be updated to use only the commands from smesh package.</p>
\r
114 <p class="whs5"> </p>
\r
116 <p class="whs5">import SMESH</p>
\r
118 <p class="whs5">import SMESH_mechanic</p>
\r
120 <p class="whs5"> </p>
\r
122 <p class="whs5">mesh = SMESH_mechanic.mesh</p>
\r
124 <p class="whs5">anEditor = mesh.GetMeshEditor()</p>
\r
126 <p class="whs5"> </p>
\r
128 <p class="whs6"># define translation
\r
131 <p class="whs5">point = SMESH.PointStruct(-150.,
\r
134 <p class="whs5">vector = SMESH.DirStruct(point)</p>
\r
136 <p class="whs5"> </p>
\r
138 <p class="whs6"># translate a mesh</p>
\r
140 <p class="whs5">doCopy = 1</p>
\r
142 <p class="whs5">anEditor.TranslateObject(mesh,
\r
143 vector, doCopy) </p>
\r
145 <p class="whs7"> </p>
\r
147 <h4 class="whs2"><a name=bookmark1>Rotation</a></h4>
\r
149 <p class="whs3"> </p>
\r
151 <p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B>#
\r
152 Attention! This script has been written using the old approach basing
\r
153 on direct usage of SMESH idl interface.</B></font></span></p>
\r
155 <p class="whs4"># For the moment smesh package doesn't provide
\r
156 methods to rotate meshes. </p>
\r
158 <p class="whs4"># In the next SALOME version the scripts will
\r
159 be updated to use only the commands from smesh package.</p>
\r
161 <p class="whs3"> </p>
\r
163 <p class="whs3">import math</p>
\r
165 <p class="whs3">import SMESH</p>
\r
167 <p class="whs3">import SMESH_mechanic</p>
\r
169 <p class="whs3"> </p>
\r
171 <p class="whs3">mesh = SMESH_mechanic.mesh</p>
\r
173 <p class="whs3">anEditor = mesh.GetMeshEditor()</p>
\r
175 <p class="whs3"> </p>
\r
177 <p class="whs6"># define rotation axis
\r
180 <p class="whs3">axisXYZ = SMESH.AxisStruct(0., 0., 0.,
\r
183 <p class="whs3">angle270 = 1.5 * math.pi</p>
\r
185 <p class="whs3"> </p>
\r
187 <p class="whs6"># rotate a mesh</p>
\r
189 <p class="whs3">anEditor.RotateObject(mesh, axisXYZ, angle270,
\r
192 <p class="whs7"> </p>
\r
194 <h4 class="whs2"><a name=bookmark2>Symmetry</a></h4>
\r
196 <p class="whs3"> </p>
\r
198 <p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B>#
\r
199 Attention! This script has been written using the old approach basing
\r
200 on direct usage of SMESH idl interface.</B></font></span></p>
\r
202 <p class="whs4"># For the moment smesh package doesn't provide
\r
203 methods to create symmetrical copies of meshes. </p>
\r
205 <p class="whs4"># In the next SALOME version the scripts will
\r
206 be updated to use only the commands from smesh package.</p>
\r
208 <p class="whs3"> </p>
\r
210 <p class="whs3">import math</p>
\r
212 <p class="whs3">import SMESH</p>
\r
214 <p class="whs3">import SMESH_mechanic</p>
\r
216 <p class="whs3"> </p>
\r
218 <p class="whs3">mesh = SMESH_mechanic.mesh</p>
\r
220 <p class="whs3">anEditor = mesh.GetMeshEditor()</p>
\r
222 <p class="whs3"> </p>
\r
224 <p class="whs6"># create a symmetrical
\r
225 copy of the mesh mirrored through a point</p>
\r
227 <p class="whs3">axis = SMESH.AxisStruct(0, 0, 0, 0, 0,
\r
230 <p class="whs3">anEditor.MirrorObject(mesh, axis, SMESH.SMESH_MeshEditor.POINT,
\r
233 <p class="whs7"> </p>
\r
235 <h4 class="whs2"><a name=bookmark3>Merging
\r
238 <p class="whs3"> </p>
\r
240 <p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B>#
\r
241 Attention! This script has been written using the old approach basing
\r
242 on direct usage of SMESH idl interface.</B></font></span></p>
\r
244 <p class="whs4"># For the moment smesh package doesn't provide
\r
245 methods to merge nodes. </p>
\r
247 <p class="whs4"># In the next SALOME version the scripts will
\r
248 be updated to use only the commands from smesh package.</p>
\r
250 <p class="whs6"> </p>
\r
252 <p class="whs5">import SMESH_mechanic</p>
\r
254 <p class="whs5">mesh = SMESH_mechanic.mesh</p>
\r
256 <p class="whs5"> </p>
\r
258 <p class="whs5">aMeshEditor = mesh.GetMeshEditor()</p>
\r
260 <p class="whs5"> </p>
\r
262 <p class="whs6"># merge nodes</p>
\r
264 <p class="whs5">Tolerance = 25.0</p>
\r
266 <p class="whs5"> </p>
\r
268 <p class="whs5">GroupsOfNodes =
\r
269 aMeshEditor.FindCoincidentNodes(Tolerance)</p>
\r
271 <p class="whs7"><span style="font-family: 'Lucida Console', monospace;">aMeshEditor.MergeNodes(GroupsOfNodes)</span>
\r
274 <p class="whs7"> </p>
\r
276 <h4><a name=bookmark8>Merging Elements</a></h4>
\r
278 <p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B>#
\r
279 Attention! This script has been written using the old approach basing
\r
280 on direct usage of SMESH idl interface.</B></font></span></p>
\r
282 <p class="whs4"># For the moment smesh package doesn't provide
\r
283 methods to merge elements. </p>
\r
285 <p class="whs4"># In the next SALOME version the scripts will
\r
286 be updated to use only the commands from smesh package.</p>
\r
288 <p class="whs6"> </p>
\r
290 <p class="whs5">import salome</p>
\r
292 <p class="whs5">import geompy</p>
\r
294 <p class="whs5">import smesh</p>
\r
296 <p class="whs5">import SMESH</p>
\r
298 <p class="whs5"> </p>
\r
300 <p class="whs6"># create a face to
\r
303 <p class="whs5">px = geompy.MakeVertex(100.,
\r
307 <p class="whs5">py = geompy.MakeVertex(0.
\r
311 <p class="whs5">pz = geompy.MakeVertex(0.
\r
312 , 0. ,
\r
315 <p class="whs5"> </p>
\r
317 <p class="whs5">vxy = geompy.MakeVector(px,
\r
320 <p class="whs5">arc = geompy.MakeArc(py,
\r
323 <p class="whs5"> </p>
\r
325 <p class="whs5">wire = geompy.MakeWire([vxy,
\r
328 <p class="whs5">isPlanarFace = 1</p>
\r
330 <p class="whs5"> </p>
\r
332 <p class="whs5">face1 = geompy.MakeFace(wire,
\r
335 <p class="whs5">id_face1 = geompy.addToStudy(face1,
\r
336 "Face1")</p>
\r
338 <p class="whs5"> </p>
\r
340 <p class="whs6"># create a circle to
\r
341 be an extrusion path</p>
\r
343 <p class="whs5">px1 = geompy.MakeVertex(
\r
347 <p class="whs5">py1 = geompy.MakeVertex(-100.,
\r
348 -100., 0.)</p>
\r
350 <p class="whs5">pz1 = geompy.MakeVertex(
\r
352 0.,
\r
355 <p class="whs5"> </p>
\r
357 <p class="whs5">circle = geompy.MakeCircleThreePnt(py1,
\r
360 <p class="whs5">id_circle = geompy.addToStudy(circle,
\r
361 "Path")</p>
\r
363 <p class="whs5"> </p>
\r
365 <p class="whs6"># create a 2D mesh
\r
368 <p class="whs5">trias = smesh.Mesh(face1,
\r
369 "Face : 2D mesh")</p>
\r
371 <p class="whs5"> </p>
\r
373 <p class="whs5">algo1D = trias.Segment()</p>
\r
375 <p class="whs5">algo1D.NumberOfSegments(6)</p>
\r
377 <p class="whs5">algo2D = trias.Triangle()</p>
\r
379 <p class="whs5">algo2D.LengthFromEdges()</p>
\r
381 <p class="whs5"> </p>
\r
383 <p class="whs5">trias.Compute()</p>
\r
385 <p class="whs5">tri_mesh = trias.GetMesh()</p>
\r
387 <p class="whs6"> </p>
\r
389 <p class="whs6"># create a path mesh</p>
\r
391 <p class="whs5">circlemesh = smesh.Mesh(circle,
\r
392 "Path mesh")</p>
\r
394 <p class="whs5">algo = circlemesh.Segment()</p>
\r
396 <p class="whs5">algo.NumberOfSegments(10)</p>
\r
398 <p class="whs5">circlemesh.Compute()</p>
\r
400 <p class="whs6"> </p>
\r
402 <p class="whs6"># extrusion of the
\r
405 <p class="whs5">aMeshEditor = tri_mesh.GetMeshEditor()</p>
\r
407 <p class="whs5">aMeshEditor.ExtrusionAlongPathObject(tri_mesh,
\r
408 circlemesh.GetMesh(), circle,</p>
\r
410 <p class="whs5"> 1,
\r
411 0, [], 0, SMESH.PointStruct(0, 0, 0))</p>
\r
413 <p class="whs6"># merge nodes</p>
\r
415 <p class="whs5">print "Number
\r
416 of nodes before MergeNodes:", tri_mesh.NbNodes()</p>
\r
418 <p class="whs5"> </p>
\r
420 <p class="whs5">tolerance = 0.001</p>
\r
422 <p class="whs5">array_of_nodes_groups
\r
423 = aMeshEditor.FindCoincidentNodes(tolerance)</p>
\r
425 <p class="whs5">aMeshEditor.MergeNodes(array_of_nodes_groups)</p>
\r
427 <p class="whs5"> </p>
\r
429 <p class="whs5">print "Number
\r
430 of nodes after MergeNodes:", tri_mesh.NbNodes()</p>
\r
432 <p class="whs5">print ""</p>
\r
434 <p class="whs5">print "Number
\r
435 of elements before MergeEqualElements:"</p>
\r
437 <p class="whs5">print "Edges
\r
438 :
\r
439 ", tri_mesh.NbEdges()</p>
\r
441 <p class="whs5">print "Triangles
\r
443 tri_mesh.NbTriangles()</p>
\r
445 <p class="whs5">print "Quadrangles:
\r
446 ", tri_mesh.NbQuadrangles()</p>
\r
448 <p class="whs5">print "Volumes
\r
449 :
\r
450 ", tri_mesh.NbVolumes()</p>
\r
452 <p class="whs6"> </p>
\r
454 <p class="whs6"># merge elements</p>
\r
456 <p class="whs5">aMeshEditor.MergeEqualElements()</p>
\r
458 <p class="whs5"> </p>
\r
460 <p class="whs5">print "Number
\r
461 of elements after MergeEqualElements:"</p>
\r
463 <p class="whs5">print "Edges
\r
464 :
\r
465 ", tri_mesh.NbEdges()</p>
\r
467 <p class="whs5">print "Triangles
\r
469 tri_mesh.NbTriangles()</p>
\r
471 <p class="whs5">print "Quadrangles:
\r
472 ", tri_mesh.NbQuadrangles()</p>
\r
474 <p class="whs5">print "Volumes
\r
475 :
\r
476 ", tri_mesh.NbVolumes()</p>
\r
478 <p class="whs5"> </p>
\r
480 <p class="whs5">salome.sg.updateObjBrowser(1)
\r
483 <p class="whs5"> </p>
\r
485 <h3>Sewing Meshes</h3>
\r
487 <h4><a name=bookmark4>Sew Meshes Border to Border</a></h4>
\r
489 <p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B>#
\r
490 Attention! This script has been written using the old approach basing
\r
491 on direct usage of SMESH idl interface.</B></font></span></p>
\r
493 <p class="whs4"># For the moment smesh package doesn't provide
\r
494 methods to sew meshes border to border. </p>
\r
496 <p class="whs4"># In the next SALOME version the scripts will
\r
497 be updated to use only the commands from smesh package.</p>
\r
499 <p class="whs7"> </p>
\r
501 <p class="whs5">import geompy</p>
\r
503 <p class="whs5">import smesh</p>
\r
505 <p class="whs5"> </p>
\r
507 <p class="whs6"># create two faces
\r
510 <p class="whs5">box1 = geompy.MakeBox(0.,
\r
511 0., -10., 30., 20., 25.)</p>
\r
513 <p class="whs5">facesList1 = geompy.SubShapeAll(box1,
\r
514 geompy.ShapeType["FACE"])</p>
\r
516 <p class="whs5">face1 = facesList1[2]</p>
\r
518 <p class="whs5"> </p>
\r
520 <p class="whs5">box2 = geompy.MakeBox(0.,
\r
521 5., 0., 20., 20., 15.)</p>
\r
523 <p class="whs5">facesList2 = geompy.SubShapeAll(box2,
\r
524 geompy.ShapeType["FACE"])</p>
\r
526 <p class="whs5">face2 = facesList2[1]</p>
\r
528 <p class="whs5"> </p>
\r
530 <p class="whs5">edgesList = geompy.SubShapeAll(face2,
\r
531 geompy.ShapeType["EDGE"])</p>
\r
533 <p class="whs5">edge1 = edgesList[2]</p>
\r
535 <p class="whs5"> </p>
\r
537 <p class="whs5">aComp = geompy.MakeCompound([face1,
\r
540 <p class="whs5">geompy.addToStudy(aComp,
\r
541 "Two faces")</p>
\r
543 <p class="whs5"> </p>
\r
545 <p class="whs6"># create a mesh on
\r
548 <p class="whs5">mesh = smesh.Mesh(aComp,
\r
549 "Two faces : quadrangle mesh")</p>
\r
551 <p class="whs5"> </p>
\r
553 <p class="whs5">algo1D = mesh.Segment()</p>
\r
555 <p class="whs5">algo1D.NumberOfSegments(9)</p>
\r
557 <p class="whs5">algo2D = mesh.Quadrangle()</p>
\r
559 <p class="whs5"> </p>
\r
561 <p class="whs5">algo_local = mesh.Segment(edge1)</p>
\r
563 <p class="whs5">algo_local.Arithmetic1D(1,
\r
566 <p class="whs5">algo_local.Propagation()</p>
\r
568 <p class="whs5"> </p>
\r
570 <p class="whs5">mesh.Compute()</p>
\r
572 <p class="whs5"> </p>
\r
574 <p class="whs5">anEditor = mesh.GetMesh().GetMeshEditor()</p>
\r
576 <p class="whs5"> </p>
\r
578 <p class="whs6"># sew border to side</p>
\r
580 <p class="whs6"># FirstNodeIDOnFreeBorder,
\r
581 SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder,</p>
\r
583 <p class="whs6"># FirstNodeIDOnSide,
\r
584 LastNodeIDOnSide,</p>
\r
586 <p class="whs6"># CreatePolygons, CreatePolyedrs</p>
\r
588 <p class="whs5">anEditor.SewBorderToSide(5,
\r
589 45, 6, 113, 109, 0, 0) </p>
\r
591 <h4><a name=bookmark5>Sew Conform Free Borders</a></h4>
\r
593 <p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B>#
\r
594 Attention! This script has been written using the old approach basing
\r
595 on direct usage of SMESH idl interface.</B></font></span></p>
\r
597 <p class="whs4"># For the moment smesh package doesn't provide
\r
598 methods to sew conform free borders. </p>
\r
600 <p class="whs4"># In the next SALOME version the scripts will
\r
601 be updated to use only the commands from smesh package.</p>
\r
603 <p class="whs5"> </p>
\r
605 <p class="whs5">import geompy</p>
\r
607 <p class="whs5">import smesh</p>
\r
609 <p class="whs5"> </p>
\r
611 <p class="whs6"># create two faces
\r
614 <p class="whs5">box1 = geompy.MakeBox(0.,
\r
615 0., -10., 20., 20., 15.)</p>
\r
617 <p class="whs5">facesList1 = geompy.SubShapeAll(box1,
\r
618 geompy.ShapeType["FACE"])</p>
\r
620 <p class="whs5">face1 = facesList1[2]</p>
\r
622 <p class="whs5"> </p>
\r
624 <p class="whs5">box2 = geompy.MakeBox(0.,
\r
625 5., 0., 20., 20., 15.)</p>
\r
627 <p class="whs5">facesList2 = geompy.SubShapeAll(box2,
\r
628 geompy.ShapeType["FACE"])</p>
\r
630 <p class="whs5">face2 = facesList2[1]</p>
\r
632 <p class="whs5"> </p>
\r
634 <p class="whs5">edgesList = geompy.SubShapeAll(face2,
\r
635 geompy.ShapeType["EDGE"])</p>
\r
637 <p class="whs5">edge1 = edgesList[2]</p>
\r
639 <p class="whs5"> </p>
\r
641 <p class="whs5">aComp = geompy.MakeCompound([face1,
\r
644 <p class="whs5">geompy.addToStudy(aComp,
\r
645 "Two faces")</p>
\r
647 <p class="whs5"> </p>
\r
649 <p class="whs6"># create a mesh on
\r
652 <p class="whs5">mesh = smesh.Mesh(aComp,
\r
653 "Two faces : quadrangle mesh")</p>
\r
655 <p class="whs5"> </p>
\r
657 <p class="whs5">algo1D = mesh.Segment()</p>
\r
659 <p class="whs5">algo1D.NumberOfSegments(9)</p>
\r
661 <p class="whs5">algo2D = mesh.Quadrangle()</p>
\r
663 <p class="whs5"> </p>
\r
665 <p class="whs5">algo_local = mesh.Segment(edge1)</p>
\r
667 <p class="whs5">algo_local.Arithmetic1D(1,
\r
670 <p class="whs5">algo_local.Propagation()</p>
\r
672 <p class="whs5"> </p>
\r
674 <p class="whs5">mesh.Compute()</p>
\r
676 <p class="whs5"> </p>
\r
678 <p class="whs5">anEditor = mesh.GetMesh().GetMeshEditor()</p>
\r
680 <p class="whs5"> </p>
\r
682 <p class="whs6"># sew conform free
\r
685 <p class="whs6"># FirstNodeID1, SecondNodeID1,
\r
686 LastNodeID1, FirstNodeID2, SecondNodeID2</p>
\r
688 <p class="whs5">anEditor.SewConformFreeBorders(5,
\r
691 <h4><a name=bookmark6>Sew Free Borders</a></h4>
\r
693 <p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B>#
\r
694 Attention! This script has been written using the old approach basing
\r
695 on direct usage of SMESH idl interface.</B></font></span></p>
\r
697 <p class="whs4"># For the moment smesh package doesn't provide
\r
698 methods to sew free borders. </p>
\r
700 <p class="whs4"># In the next SALOME version the scripts will
\r
701 be updated to use only the commands from smesh package.</p>
\r
703 <p class="whs7"> </p>
\r
705 <p class="whs5">import geompy</p>
\r
707 <p class="whs5">import smesh</p>
\r
709 <p class="whs5"> </p>
\r
711 <p class="whs6"># create two faces
\r
714 <p class="whs5">box1 = geompy.MakeBox(0.,
\r
715 0., 0., 20., 20., 15.)</p>
\r
717 <p class="whs5">facesList1 = geompy.SubShapeAll(box1,
\r
718 geompy.ShapeType["FACE"])</p>
\r
720 <p class="whs5">face1 = facesList1[2]</p>
\r
722 <p class="whs5"> </p>
\r
724 <p class="whs5">box2 = geompy.MakeBox(0.,
\r
725 5., 0., 20., 20., 15.)</p>
\r
727 <p class="whs5">facesList2 = geompy.SubShapeAll(box2,
\r
728 geompy.ShapeType["FACE"])</p>
\r
730 <p class="whs5">face2 = facesList2[1]</p>
\r
732 <p class="whs5"> </p>
\r
734 <p class="whs5">edgesList = geompy.SubShapeAll(face2,
\r
735 geompy.ShapeType["EDGE"])</p>
\r
737 <p class="whs5">edge1 = edgesList[2]</p>
\r
739 <p class="whs5"> </p>
\r
741 <p class="whs5">aComp = geompy.MakeCompound([face1,
\r
744 <p class="whs5">geompy.addToStudy(aComp,
\r
745 "Two faces")</p>
\r
747 <p class="whs5"> </p>
\r
749 <p class="whs6"># create a mesh on
\r
752 <p class="whs5">mesh = smesh.Mesh(aComp,
\r
753 "Two faces : quadrangle mesh")</p>
\r
755 <p class="whs5"> </p>
\r
757 <p class="whs5">algo1D = mesh.Segment()</p>
\r
759 <p class="whs5">algo1D.NumberOfSegments(4)</p>
\r
761 <p class="whs5">algo2D = mesh.Quadrangle()</p>
\r
763 <p class="whs5"> </p>
\r
765 <p class="whs5">algo_local = mesh.Segment(edge1)</p>
\r
767 <p class="whs5">algo_local.Arithmetic1D(1,
\r
770 <p class="whs5">algo_local.Propagation()</p>
\r
772 <p class="whs5"> </p>
\r
774 <p class="whs5">mesh.Compute()</p>
\r
776 <p class="whs5"> </p>
\r
778 <p class="whs6"># sew free borders</p>
\r
780 <p class="whs6"># FirstNodeID1, SecondNodeID1,
\r
783 <p class="whs6"># FirstNodeID2, SecondNodeID2,
\r
784 LastNodeID2, CreatePolygons, CreatePolyedrs</p>
\r
786 <p class="whs5">anEditor = mesh.GetMesh().GetMeshEditor()</p>
\r
788 <p class="whs7"><span style="font-family: 'Lucida Console', monospace;">anEditor.SewFreeBorders(6,
\r
789 21, 5, 1, 12, 3, 0, 0)</span> </p>
\r
791 <h4><a name=bookmark7>Sew Side Elements</a></h4>
\r
793 <p class="whs4"><span style="font-weight: bold; color: #ff0000;"><font color=red ><B>#
\r
794 Attention! This script has been written using the old approach basing
\r
795 on direct usage of SMESH idl interface.</B></font></span></p>
\r
797 <p class="whs4"># For the moment smesh package doesn't provide
\r
798 methods to sew side elements. </p>
\r
800 <p class="whs4"># In the next SALOME version the scripts will
\r
801 be updated to use only the commands from smesh package.</p>
\r
803 <p class="whs5">import geompy</p>
\r
805 <p class="whs5">import smesh</p>
\r
807 <p class="whs5"> </p>
\r
809 <p class="whs6"># create two boxes</p>
\r
811 <p class="whs5">box1 = geompy.MakeBox(0.,
\r
815 <p class="whs5">box2 = geompy.MakeBox(0.,
\r
816 15., 0., 20., 25., 10.)</p>
\r
818 <p class="whs5"> </p>
\r
820 <p class="whs5">EdgesList = geompy.SubShapeAll(box2,
\r
821 geompy.ShapeType["EDGE"])</p>
\r
823 <p class="whs5"> </p>
\r
825 <p class="whs5">aComp = geompy.MakeCompound([box1,
\r
828 <p class="whs5">geompy.addToStudy(aComp,
\r
829 "Two boxes")</p>
\r
831 <p class="whs5"> </p>
\r
833 <p class="whs6"># create a mesh on
\r
836 <p class="whs5">mesh = smesh.Mesh(aComp,
\r
837 "Two faces : quadrangle mesh")</p>
\r
839 <p class="whs5"> </p>
\r
841 <p class="whs5">algo1D = mesh.Segment()</p>
\r
843 <p class="whs5">algo1D.NumberOfSegments(2)</p>
\r
845 <p class="whs5">algo2D = mesh.Quadrangle()</p>
\r
847 <p class="whs5"> </p>
\r
849 <p class="whs5">algo_local = mesh.Segment(EdgesList[8])</p>
\r
851 <p class="whs5">algo_local.NumberOfSegments(4)</p>
\r
853 <p class="whs5">algo_local.Propagation()</p>
\r
855 <p class="whs5"> </p>
\r
857 <p class="whs5">mesh.Compute()</p>
\r
859 <p class="whs5"> </p>
\r
861 <p class="whs5">anEditor = mesh.GetMesh().GetMeshEditor()</p>
\r
863 <p class="whs5"> </p>
\r
865 <p class="whs6"># sew side elements</p>
\r
867 <p class="whs6"># IDsOfSide1Elements,
\r
868 IDsOfSide2Elements,</p>
\r
870 <p class="whs6"># NodeID1OfSide1ToMerge,
\r
871 NodeID1OfSide2ToMerge, NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge</p>
\r
873 <p class="whs5">anEditor.SewSideElements([69,
\r
874 70, 71, 72], [91, 92, 89, 90], 8, 38, 23, 58)</p>
\r
876 <script type="text/javascript" language="javascript1.2">
\r
878 if (window.writeIntopicBar)
\r
879 writeIntopicBar(0);
\r