Salome HOME
Merge from BR_DEBUG_3_2_0b1
[modules/smesh.git] / doc / salome / gui / SMESH / transforming_meshes.htm
1 <!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
2
3 <html>
4
5 <head>
6 <title>Transforming Meshes</title>
7 <meta http-equiv="content-type" content="text/html; charset=windows-1252">
8 <meta name="generator" content="RoboHelp by eHelp Corporation www.ehelp.com"><style type="text/css">
9 <!--
10 h3.whs1 { margin-top:0pt; margin-bottom:0pt; }
11 h4.whs2 { margin-top:0pt; margin-bottom:0pt; }
12 p.whs3 { font-family:'Lucida Console' , monospace; margin-top:0pt; margin-bottom:0pt; }
13 p.whs4 { margin-top:0pt; margin-bottom:0pt; }
14 p.whs5 { margin-top:0pt; margin-bottom:0pt; font-family:'Lucida Console' , monospace; }
15 -->
16 </style><script type="text/javascript" language="JavaScript">
17 <!--
18 if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))
19 {
20   var strNSS = "<style type='text/css'>";
21   strNSS += "h3.whs1 {margin-top:1pt;margin-bottom:1pt; }";
22   strNSS += "h4.whs2 {margin-top:1pt;margin-bottom:1pt; }";
23   strNSS += "p.whs3 {margin-top:1pt;margin-bottom:1pt; }";
24   strNSS += "p.whs4 {margin-top:1pt;margin-bottom:1pt; }";
25   strNSS += "p.whs5 {margin-top:1pt;margin-bottom:1pt; }";
26   strNSS +="</style>";
27   document.write(strNSS);
28 }
29 //-->
30 </script>
31 <script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">
32 <!--
33 function reDo() {
34   if (innerWidth != origWidth || innerHeight != origHeight)
35      location.reload();
36 }
37 if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {
38         origWidth = innerWidth;
39         origHeight = innerHeight;
40         onresize = reDo;
41 }
42 onerror = null; 
43 //-->
44 </script>
45 <style type="text/css">
46 <!--
47 div.WebHelpPopupMenu { position:absolute; left:0px; top:0px; z-index:4; visibility:hidden; }
48 p.WebHelpNavBar { text-align:right; }
49 -->
50 </style><script type="text/javascript" language="javascript1.2" src="whmsg.js"></script>
51 <script type="text/javascript" language="javascript" src="whver.js"></script>
52 <script type="text/javascript" language="javascript1.2" src="whproxy.js"></script>
53 <script type="text/javascript" language="javascript1.2" src="whutils.js"></script>
54 <script type="text/javascript" language="javascript1.2" src="whtopic.js"></script>
55 <script type="text/javascript" language="javascript1.2">
56 <!--
57 if (window.gbWhTopic)
58 {
59         if (window.setRelStartPage)
60         {
61         addTocInfo("MESH module\nTUI Scripts\nTransforming Meshes");
62 addButton("show",BTN_IMG,"Show","","","","",0,0,"whd_show0.gif","whd_show2.gif","whd_show1.gif");
63 addButton("hide",BTN_IMG,"Hide","","","","",0,0,"whd_hide0.gif","whd_hide2.gif","whd_hide1.gif");
64
65         }
66
67
68         if (window.setRelStartPage)
69         {
70         setRelStartPage("index.htm");
71
72                 autoSync(1);
73                 sendSyncInfo();
74                 sendAveInfoOut();
75         }
76
77 }
78 else
79         if (window.gbIE4)
80                 document.location.reload();
81 //-->
82 </script>
83 </head>
84 <body><script type="text/javascript" language="javascript1.2">
85 <!--
86 if (window.writeIntopicBar)
87         writeIntopicBar(4);
88 //-->
89 </script>
90 <h1>Transforming Meshes</h1>
91
92 <h3 class="whs1">Transforming Meshes</h3>
93
94 <h4 class="whs2">&nbsp;</h4>
95
96 <h4 class="whs2"><a name=bookmark>Translation</a></h4>
97
98 <p class="whs3">&nbsp;</p>
99
100 <p class="whs3">import SMESH</p>
101
102 <p class="whs3">import SMESH_mechanic</p>
103
104 <p class="whs3">&nbsp;</p>
105
106 <p class="whs3">mesh &nbsp;&nbsp;= 
107  SMESH_mechanic.mesh</p>
108
109 <p class="whs3">salome = SMESH_mechanic.salome</p>
110
111 <p class="whs4">&nbsp;</p>
112
113 <p class="whs4"># translate a mesh</p>
114
115 <p class="whs3">anEditor = mesh.GetMeshEditor()</p>
116
117 <p class="whs3">point = SMESH.PointStruct(-150, -150, 
118  0)</p>
119
120 <p class="whs3">vector = SMESH.DirStruct(point) </p>
121
122 <p class="whs3">anEditor.TranslateObject(mesh, vector, 
123  1)</p>
124
125 <p class="whs4">&nbsp;</p>
126
127 <p class="whs4"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> 
128  </p>
129
130 <p class="whs4">&nbsp;</p>
131
132 <h4 class="whs2"><a name=bookmark1>Rotation</a></h4>
133
134 <p class="whs3">&nbsp;</p>
135
136 <p class="whs3">import SMESH</p>
137
138 <p class="whs3">import SMESH_mechanic</p>
139
140 <p class="whs3">&nbsp;</p>
141
142 <p class="whs3">import math</p>
143
144 <p class="whs3">mesh &nbsp;&nbsp;= 
145  SMESH_mechanic.mesh</p>
146
147 <p class="whs3">salome = SMESH_mechanic.salome</p>
148
149 <p class="whs4">&nbsp;</p>
150
151 <p class="whs4"># rotate a mesh </p>
152
153 <p class="whs3">anEditor = mesh.GetMeshEditor()</p>
154
155 <p class="whs3">axisXYZ = SMESH.AxisStruct(0, 0, 0, 5, 
156  5, 20)</p>
157
158 <p class="whs3">angle180 = &nbsp;1.5*math.pi</p>
159
160 <p class="whs3">anEditor.RotateObject(mesh, axisXYZ, angle180, 
161  1)</p>
162
163 <p class="whs3">&nbsp;</p>
164
165 <p class="whs5">salome.sg.updateObjBrowser(1)</p>
166
167 <p class="whs4">&nbsp;</p>
168
169 <p class="whs4">&nbsp;</p>
170
171 <h4 class="whs2"><a name=bookmark2>Symmetry</a></h4>
172
173 <p class="whs3">&nbsp;</p>
174
175 <p class="whs3">import SMESH</p>
176
177 <p class="whs3">import SMESH_mechanic</p>
178
179 <p class="whs3">&nbsp;</p>
180
181 <p class="whs3">import math</p>
182
183 <p class="whs3">mesh &nbsp;&nbsp;= 
184  SMESH_mechanic.mesh</p>
185
186 <p class="whs3">salome = SMESH_mechanic.salome</p>
187
188 <p class="whs4">&nbsp;</p>
189
190 <p class="whs4"># create a symmetrical 
191  copy of the mesh mirrored through a point</p>
192
193 <p class="whs3">anEditor = mesh.GetMeshEditor()</p>
194
195 <p class="whs3">anEditor.MirrorObject(mesh, SMESH.AxisStruct(0, 
196  0, 0, 0, 0, 0), SMESH.SMESH_MeshEditor.POINT, 1) </p>
197
198 <p class="whs3">&nbsp;</p>
199
200 <p class="whs4"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> 
201  </p>
202
203 <p class="whs4">&nbsp;</p>
204
205 <p class="whs4">&nbsp;</p>
206
207 <h4 class="whs2"><a name=bookmark3>Merging 
208  Nodes</a></h4>
209
210 <p class="whs3">&nbsp;</p>
211
212 <p class="whs3">import SMESH</p>
213
214 <p class="whs3">import SMESH_mechanic</p>
215
216 <p class="whs3">&nbsp;</p>
217
218 <p class="whs3">smesh &nbsp;= 
219  SMESH_mechanic.smesh</p>
220
221 <p class="whs3">mesh &nbsp;&nbsp;= 
222  SMESH_mechanic.mesh</p>
223
224 <p class="whs3">salome = SMESH_mechanic.salome</p>
225
226 <p class="whs4">&nbsp;</p>
227
228 <p class="whs4"># merge nodes</p>
229
230 <p class="whs3">aMeshEditor = mesh.GetMeshEditor()</p>
231
232 <p class="whs3">Tolerance = 25.0</p>
233
234 <p class="whs3">&nbsp;</p>
235
236 <p class="whs3">GroupsOfNodes = aMeshEditor.FindCoincidentNodes(Tolerance)</p>
237
238 <p class="whs3">aMeshEditor.MergeNodes(GroupsOfNodes)</p>
239
240 <p class="whs3">&nbsp;&nbsp;&nbsp;&nbsp;</p>
241
242 <p class="whs4"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> 
243  </p>
244
245 <p class="whs4">&nbsp;</p>
246
247 <h4><a name=bookmark8>Merging Elements</a></h4>
248
249 <p class="whs5">import geompy</p>
250
251 <p class="whs5">import smesh</p>
252
253 <p class="whs5">import salome</p>
254
255 <p class="whs5">import SMESH</p>
256
257 <p class="whs4">&nbsp;</p>
258
259 <p class="whs4"># create a face to be meshed</p>
260
261 <p class="whs5">px = geompy.MakeVertex(100., 
262  0. &nbsp;, 0. 
263  &nbsp;)</p>
264
265 <p class="whs5">py = geompy.MakeVertex(0. 
266  &nbsp;, 100., 
267  0. &nbsp;)</p>
268
269 <p class="whs5">pz = geompy.MakeVertex(0. 
270  &nbsp;, 0. &nbsp;, 
271  100.)</p>
272
273 <p class="whs5">&nbsp;</p>
274
275 <p class="whs5">vxy = geompy.MakeVector(px, 
276  py)</p>
277
278 <p class="whs5">arc = geompy.MakeArc(py, 
279  pz, px)</p>
280
281 <p class="whs5">&nbsp;</p>
282
283 <p class="whs5">wire = geompy.MakeWire([vxy, 
284  arc])</p>
285
286 <p class="whs5">isPlanarFace = 1</p>
287
288 <p class="whs5">&nbsp;</p>
289
290 <p class="whs5">face1 = geompy.MakeFace(wire, 
291  isPlanarFace)</p>
292
293 <p class="whs5">id_face1 = geompy.addToStudy(face1, 
294  &quot;Face1&quot;)</p>
295
296 <p class="whs4">&nbsp;</p>
297
298 <p class="whs4"># create a 2D mesh on the 
299  face</p>
300
301 <p class="whs5">trias = smesh.Mesh(face1, 
302  &quot;Face : 2D mesh&quot;)</p>
303
304 <p class="whs5">&nbsp;</p>
305
306 <p class="whs5">algo = trias.Segment()</p>
307
308 <p class="whs5">algo.NumberOfSegments(6)</p>
309
310 <p class="whs5">&nbsp;</p>
311
312 <p class="whs5">algo = trias.Triangle()</p>
313
314 <p class="whs5">algo.LengthFromEdges()</p>
315
316 <p class="whs5">&nbsp;</p>
317
318 <p class="whs5">trias.Compute()</p>
319
320 <p class="whs5">&nbsp;</p>
321
322 <p class="whs5">tri_mesh = trias.GetMesh()</p>
323
324 <p class="whs4">&nbsp;</p>
325
326 <p class="whs4"># create a path mesh</p>
327
328 <p class="whs5">px1 = geompy.MakeVertex(100., 
329  100. &nbsp;, 
330  0. &nbsp;)</p>
331
332 <p class="whs5">py1 = geompy.MakeVertex(-100. 
333  &nbsp;, -100., 
334  0. &nbsp;)</p>
335
336 <p class="whs5">pz1 = geompy.MakeVertex(0. 
337  &nbsp;, 0. &nbsp;, 
338  50.)</p>
339
340 <p class="whs5">&nbsp;</p>
341
342 <p class="whs5">circle = geompy.MakeCircleThreePnt(py1, 
343  pz1, px1)</p>
344
345 <p class="whs5">id_circle = geompy.addToStudy(circle, 
346  &quot;Path&quot;)</p>
347
348 <p class="whs5">&nbsp;</p>
349
350 <p class="whs5">circlemesh = smesh.Mesh(circle, 
351  &quot;Path mesh&quot;)</p>
352
353 <p class="whs5">&nbsp;</p>
354
355 <p class="whs5">algo = circlemesh.Segment()</p>
356
357 <p class="whs5">algo.NumberOfSegments(10)</p>
358
359 <p class="whs5">&nbsp;</p>
360
361 <p class="whs5">circlemesh.Compute()</p>
362
363 <p class="whs4">&nbsp;</p>
364
365 <p class="whs4"># extrusion of the mesh</p>
366
367 <p class="whs5">aMeshEditor = tri_mesh.GetMeshEditor()</p>
368
369 <p class="whs5">aMeshEditor.ExtrusionAlongPathObject(tri_mesh, 
370  circlemesh.GetMesh(), circle, 1, 0, [], 0, SMESH.PointStruct(0, 0, 0))</p>
371
372 <p class="whs4">&nbsp;</p>
373
374 <p class="whs4"># merge nodes</p>
375
376 <p class="whs5">print &quot;Number 
377  of nodes before MergeNodes:&quot;, tri_mesh.NbNodes()</p>
378
379 <p class="whs5">&nbsp;</p>
380
381 <p class="whs5">tolerance = 0.001</p>
382
383 <p class="whs5">array_of_nodes_groups 
384  = aMeshEditor.FindCoincidentNodes(tolerance)</p>
385
386 <p class="whs5">aMeshEditor.MergeNodes(array_of_nodes_groups)</p>
387
388 <p class="whs5">&nbsp;</p>
389
390 <p class="whs5">print &quot;Number 
391  of nodes after MergeNodes:&quot;, tri_mesh.NbNodes()</p>
392
393 <p class="whs5">print &quot;&quot;</p>
394
395 <p class="whs5">print &quot;Number 
396  of elements before MergeEqualElements:&quot;</p>
397
398 <p class="whs5">print &quot;Edges 
399  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 
400  &quot;, tri_mesh.NbEdges()</p>
401
402 <p class="whs5">print &quot;Triangles 
403  &nbsp;: &quot;, 
404  tri_mesh.NbTriangles()</p>
405
406 <p class="whs5">print &quot;Quadrangles: 
407  &quot;, tri_mesh.NbQuadrangles()</p>
408
409 <p class="whs5">print &quot;Volumes 
410  &nbsp;&nbsp;&nbsp;: 
411  &quot;, tri_mesh.NbVolumes()</p>
412
413 <p class="whs4">&nbsp;</p>
414
415 <p class="whs4"># merge elements</p>
416
417 <p class="whs5">aMeshEditor.MergeEqualElements()</p>
418
419 <p class="whs5">&nbsp;</p>
420
421 <p class="whs5">print &quot;Number 
422  of elements after MergeEqualElements:&quot;</p>
423
424 <p class="whs5">print &quot;Edges 
425  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 
426  &quot;, tri_mesh.NbEdges()</p>
427
428 <p class="whs5">print &quot;Triangles 
429  &nbsp;: &quot;, 
430  tri_mesh.NbTriangles()</p>
431
432 <p class="whs5">print &quot;Quadrangles: 
433  &quot;, tri_mesh.NbQuadrangles()</p>
434
435 <p class="whs5">print &quot;Volumes 
436  &nbsp;&nbsp;&nbsp;: 
437  &quot;, tri_mesh.NbVolumes()</p>
438
439 <p class="whs5">&nbsp;</p>
440
441 <p class="whs4"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> 
442  </p>
443
444 <h3>Sewing Meshes</h3>
445
446 <h4><a name=bookmark4>Sew Meshes Border to Border</a></h4>
447
448 <p class="whs5">import salome</p>
449
450 <p class="whs5">import geompy</p>
451
452 <p class="whs5">import smesh</p>
453
454 <p class="whs4">&nbsp;</p>
455
456 <p class="whs4"># create two faces of a 
457  box</p>
458
459 <p class="whs5">box1 = geompy.MakeBox(0., 
460  0., -10., 30., 20., 25.)</p>
461
462 <p class="whs5">subShapeList1 = 
463  geompy.SubShapeAll(box1, geompy.ShapeType[&quot;FACE&quot;])</p>
464
465 <p class="whs5">&nbsp;</p>
466
467 <p class="whs5">box2 = geompy.MakeBox(0., 
468  5., 0., 20., 20., 15.)</p>
469
470 <p class="whs5">subShapeList2 = 
471  geompy.SubShapeAll(box2, geompy.ShapeType[&quot;FACE&quot;])</p>
472
473 <p class="whs5">EdgesList = geompy.SubShapeAll(subShapeList2[ 
474  1 ], geompy.ShapeType[&quot;EDGE&quot;])</p>
475
476 <p class="whs5">&nbsp;</p>
477
478 <p class="whs5">aComp = geompy.MakeCompound( 
479  [subShapeList1[ 2 ], subShapeList2[ 1 ]] )</p>
480
481 <p class="whs5">idComp = geompy.addToStudy( 
482  aComp, &quot;Two faces&quot; )</p>
483
484 <p class="whs5">aCompobj &nbsp;= 
485  salome.IDToObject( idComp )</p>
486
487 <p class="whs5">&nbsp;</p>
488
489 <p class="whs4"># create a mesh on two 
490  faces</p>
491
492 <p class="whs4">&nbsp;</p>
493
494 <p class="whs5">mesh = smesh.Mesh(aCompobj, 
495  &quot;Two faces : quadrangle mesh&quot;)</p>
496
497 <p class="whs5">algo = mesh.Segment()</p>
498
499 <p class="whs5">&nbsp;</p>
500
501 <p class="whs4"># define &quot;NumberOfSegments&quot; 
502  hypothesis to cut an edge in a fixed number of segments</p>
503
504 <p class="whs5">algo.NumberOfSegments(9)</p>
505
506 <p class="whs4">&nbsp;</p>
507
508 <p class="whs4"># create a quadrangle 2D 
509  algorithm for faces</p>
510
511 <p class="whs5">mesh.Quadrangle()</p>
512
513 <p class="whs4">&nbsp;</p>
514
515 <p class="whs4"># create a local hypothesis</p>
516
517 <p class="whs5">algo = mesh.Segment(EdgesList[2])</p>
518
519 <p class="whs4">&nbsp;</p>
520
521 <p class="whs4"># define &quot;Arithmetic1D&quot; 
522  hypothesis to cut an edge in several segments with increasing arithmetic 
523  length </p>
524
525 <p class="whs5">algo.Arithmetic1D(1, 
526  4)</p>
527
528 <p class="whs4">&nbsp;</p>
529
530 <p class="whs4"># define &quot;Propagation&quot; 
531  hypothesis that propagates all other hypothesis on all edges on the opposite 
532  side in case of quadrangular faces</p>
533
534 <p class="whs5">algo.Propagation()</p>
535
536 <p class="whs5">mesh.Compute()</p>
537
538 <p class="whs4">&nbsp;</p>
539
540 <p class="whs4"># sew free borders</p>
541
542 <p class="whs5">anEditor = mesh.GetMesh().GetMeshEditor()</p>
543
544 <p class="whs5">anEditor.SewBorderToSide(5, 
545  45, 6, 113, 109, 0, 0)</p>
546
547 <p class="whs5">&nbsp;</p>
548
549 <p class="whs4"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> 
550  </p>
551
552 <p class="whs4">&nbsp;</p>
553
554 <h4><a name=bookmark5>Sew Conform Free Borders</a></h4>
555
556 <p class="whs5">import salome</p>
557
558 <p class="whs5">import geompy</p>
559
560 <p class="whs5">import smesh</p>
561
562 <p class="whs4">&nbsp;</p>
563
564 <p class="whs4"># create two faces of the 
565  box</p>
566
567 <p class="whs5">box1 = geompy.MakeBox(0., 
568  0., -10., 20., 20., 15.)</p>
569
570 <p class="whs5">subShapeList1 = 
571  geompy.SubShapeAll(box1, geompy.ShapeType[&quot;FACE&quot;])</p>
572
573 <p class="whs5">&nbsp;</p>
574
575 <p class="whs5">box2 = geompy.MakeBox(0., 
576  5., 0., 20., 20., 15.)</p>
577
578 <p class="whs5">subShapeList2 = 
579  geompy.SubShapeAll(box2, geompy.ShapeType[&quot;FACE&quot;])</p>
580
581 <p class="whs5">EdgesList = geompy.SubShapeAll(subShapeList2[ 
582  1 ], geompy.ShapeType[&quot;EDGE&quot;])</p>
583
584 <p class="whs5">&nbsp;</p>
585
586 <p class="whs5">aComp = geompy.MakeCompound( 
587  [subShapeList1[ 2 ], subShapeList2[ 1 ]] )</p>
588
589 <p class="whs5">idComp = geompy.addToStudy( 
590  aComp, &quot;Two faces&quot; )</p>
591
592 <p class="whs5">aCompobj &nbsp;= 
593  salome.IDToObject( idComp )</p>
594
595 <p class="whs4">&nbsp;</p>
596
597 <p class="whs4"># create a mesh on two 
598  faces</p>
599
600 <p class="whs5">mesh = smesh.Mesh(aCompobj, 
601  &quot;Two faces : quadrangle mesh&quot;)</p>
602
603 <p class="whs5">algo = mesh.Segment()</p>
604
605 <p class="whs4">&nbsp;</p>
606
607 <p class="whs4"># define &quot;NumberOfSegments&quot; 
608  hypothesis to cut an edge in a fixed number of segments</p>
609
610 <p class="whs5">algo.NumberOfSegments(9)</p>
611
612 <p class="whs4">&nbsp;</p>
613
614 <p class="whs4"># create a quadrangle 2D 
615  algorithm for faces</p>
616
617 <p class="whs5">mesh.Quadrangle()</p>
618
619 <p class="whs4">&nbsp;</p>
620
621 <p class="whs4"># create a local hypothesis</p>
622
623 <p class="whs5">algo = mesh.Segment(EdgesList[2])</p>
624
625 <p class="whs4">&nbsp;</p>
626
627 <p class="whs4"># define &quot;Arithmetic1D&quot; 
628  hypothesis to cut an edge in several segments with increasing arithmetic 
629  length </p>
630
631 <p class="whs5">algo.Arithmetic1D(1, 
632  4)</p>
633
634 <p class="whs4">&nbsp;</p>
635
636 <p class="whs4"># define &quot;Propagation&quot; 
637  hypothesis that propagate all other hypothesis on all edges on<span style="margin-top: 0pt; margin-bottom: 0pt;"> 
638  the opposite side in case of quadrangular faces</span></p>
639
640 <p class="whs5">algo.Propagation()</p>
641
642 <p class="whs5">mesh.Compute()</p>
643
644 <p class="whs4">&nbsp;</p>
645
646 <p class="whs4"># sew free borders</p>
647
648 <p class="whs5">anEditor = mesh.GetMesh().GetMeshEditor()</p>
649
650 <p class="whs5">anEditor.SewConformFreeBorders(5, 
651  45, 6, 3, 24)</p>
652
653 <p class="whs4"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> 
654  </p>
655
656 <p class="whs4">&nbsp;</p>
657
658 <h4><a name=bookmark6>Sew Free Borders</a></h4>
659
660 <p class="whs5">import salome</p>
661
662 <p class="whs5">import geompy</p>
663
664 <p class="whs5">import smesh</p>
665
666 <p class="whs4">&nbsp;</p>
667
668 <p class="whs4"># create two faces of the 
669  box</p>
670
671 <p class="whs5">box1 = geompy.MakeBox(0., 
672  0., 0., 20., 20., 15.)</p>
673
674 <p class="whs5">subShapeList1 = 
675  geompy.SubShapeAll(box1, geompy.ShapeType[&quot;FACE&quot;])</p>
676
677 <p class="whs4">&nbsp;</p>
678
679 <p class="whs5">box2 = geompy.MakeBox(0., 
680  5., 0., 20., 20., 15.)</p>
681
682 <p class="whs5">subShapeList2 = 
683  geompy.SubShapeAll(box2, geompy.ShapeType[&quot;FACE&quot;])</p>
684
685 <p class="whs5">EdgesList = geompy.SubShapeAll(subShapeList2[ 
686  1 ], geompy.ShapeType[&quot;EDGE&quot;])</p>
687
688 <p class="whs5">&nbsp;</p>
689
690 <p class="whs5">aComp = geompy.MakeCompound( 
691  [subShapeList1[ 2 ], subShapeList2[ 1 ]] )</p>
692
693 <p class="whs5">idComp = geompy.addToStudy( 
694  aComp, &quot;Two faces&quot; )</p>
695
696 <p class="whs5">aCompobj &nbsp;= 
697  salome.IDToObject( idComp )</p>
698
699 <p class="whs5">&nbsp;</p>
700
701 <p class="whs4"># create a mesh on two 
702  faces</p>
703
704 <p class="whs5">mesh = smesh.Mesh(aCompobj, 
705  &quot;Two faces : quadrangle mesh&quot;)</p>
706
707 <p class="whs5">algo = mesh.Segment()</p>
708
709 <p class="whs4">&nbsp;</p>
710
711 <p class="whs4"># define &quot;NumberOfSegments&quot; 
712  hypothesis to cut an edge in a fixed number of segments</p>
713
714 <p class="whs5">algo.NumberOfSegments(4)</p>
715
716 <p class="whs4">&nbsp;</p>
717
718 <p class="whs4"># creates a quadrangle 
719  2D algorithm for faces</p>
720
721 <p class="whs5">mesh.Quadrangle()</p>
722
723 <p class="whs4">&nbsp;</p>
724
725 <p class="whs4"># create a local hypothesis</p>
726
727 <p class="whs5">algo = mesh.Segment(EdgesList[2])</p>
728
729 <p class="whs4">&nbsp;</p>
730
731 <p class="whs4"># define &quot;Arithmetic1D&quot; 
732  hypothesis to cut an edge in several segments with &nbsp;increasing 
733  arithmetic length</p>
734
735 <p class="whs5">algo.Arithmetic1D(1, 
736  4)</p>
737
738 <p class="whs4">&nbsp;</p>
739
740 <p class="whs4"># define &quot;Propagation&quot; 
741  hypothesis that propagate all other hypothesis on all edges on<span style="margin-top: 0pt; margin-bottom: 0pt;"> 
742  the opposite side in case of quadrangular faces</span></p>
743
744 <p class="whs5">algo.Propagation()</p>
745
746 <p class="whs5">mesh.Compute()</p>
747
748 <p class="whs4">&nbsp;</p>
749
750 <p class="whs4"># sew free borders</p>
751
752 <p class="whs5">anEditor = mesh.GetMesh().GetMeshEditor()</p>
753
754 <p class="whs5">anEditor.SewFreeBorders(6, 
755  21, 5, 1, 12, 3, 0, 0)</p>
756
757 <p class="whs5">&nbsp;</p>
758
759 <p class="whs4"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> 
760  </p>
761
762 <p class="whs4">&nbsp;</p>
763
764 <h4><a name=bookmark7>Sew Side Elements</a></h4>
765
766 <p class="whs5">import salome</p>
767
768 <p class="whs5">import geompy</p>
769
770 <p class="whs5">import smesh</p>
771
772 <p class="whs5">&nbsp;</p>
773
774 <p class="whs4"># create two faces of the 
775  box</p>
776
777 <p class="whs5">box1 = geompy.MakeBox(0., 
778  &nbsp;0., 0., 
779  10., 10., 10.)</p>
780
781 <p class="whs5">box2 = geompy.MakeBox(0., 
782  15., 0., 20., 25., 10.)</p>
783
784 <p class="whs5">EdgesList = geompy.SubShapeAll(box2, 
785  geompy.ShapeType[&quot;EDGE&quot;])</p>
786
787 <p class="whs4">&nbsp;</p>
788
789 <p class="whs5">aComp = geompy.MakeCompound( 
790  [box1, box2] )</p>
791
792 <p class="whs5">idComp = geompy.addToStudy( 
793  aComp, &quot;Two faces&quot; )</p>
794
795 <p class="whs5">aCompobj &nbsp;= 
796  salome.IDToObject( idComp )</p>
797
798 <p class="whs5">&nbsp;</p>
799
800 <p class="whs4"># create a mesh on two 
801  faces</p>
802
803 <p class="whs5">mesh = smesh.Mesh(aCompobj, 
804  &quot;Two faces : quadrangle mesh&quot;)</p>
805
806 <p class="whs5">algo = mesh.Segment()</p>
807
808 <p class="whs4">&nbsp;</p>
809
810 <p class="whs4"># define &quot;NumberOfSegments&quot; 
811  hypothesis to cut an edge in a fixed number of segments</p>
812
813 <p class="whs5">algo.NumberOfSegments(2)</p>
814
815 <p class="whs4">&nbsp;</p>
816
817 <p class="whs4"># create a quadrangle 2D 
818  algorithm for faces</p>
819
820 <p class="whs5">mesh.Quadrangle()</p>
821
822 <p class="whs4">&nbsp;</p>
823
824 <p class="whs4"># create a local hypothesis</p>
825
826 <p class="whs5">algo = mesh.Segment(EdgesList[8])</p>
827
828 <p class="whs4">&nbsp;</p>
829
830 <p class="whs4"># define &quot;Arithmetic1D&quot; 
831  hypothesis to cut an edge in several segments with increasing arithmetic 
832  length </p>
833
834 <p class="whs5">algo.NumberOfSegments(4)</p>
835
836 <p class="whs4">&nbsp;</p>
837
838 <p class="whs4"># define &quot;Propagation&quot; 
839  hypothesis that propagates all other hypothesis on all edges on <span 
840  style="margin-top: 0pt; margin-bottom: 0pt;">the opposite side in case 
841  of quadrangular faces</span></p>
842
843 <p class="whs5">algo.Propagation()</p>
844
845 <p class="whs5">mesh.Compute()</p>
846
847 <p class="whs4">&nbsp;</p>
848
849 <p class="whs4"># sew free borders</p>
850
851 <p class="whs5">anEditor = mesh.GetMesh().GetMeshEditor()</p>
852
853 <p class="whs5">anEditor.SewSideElements([69, 
854  70, 71, 72], [91, 92, 89, 90], 8, 38, 23, 58)</p>
855
856 <p class="whs4"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span> 
857  </p>
858
859 <script type="text/javascript" language="javascript1.2">
860 <!--
861 if (window.writeIntopicBar)
862         writeIntopicBar(0);
863 //-->
864 </script>
865 </body>
866 </html>