Salome HOME
Merge from PHASE_25_BR 09/12/2010
[modules/smesh.git] / doc / salome / gui / SMESH / input / tui_quality_controls.doc
1 /*!
2
3 \page tui_quality_controls_page Quality Controls
4
5 \section tui_free_borders Free Borders
6
7 \code
8 import salome
9 import geompy
10
11 import smesh
12
13 # create open shell: a box without one plane
14 box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
15 FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
16 FaceList.remove(FaceList[5])
17 box = geompy.MakeShell(FaceList)
18 idbox = geompy.addToStudy(box, "box")
19
20 # create a mesh
21 mesh = smesh.Mesh(box, "Mesh_free_borders")
22 algo = mesh.Segment()
23 algo.NumberOfSegments(5)
24 algo = mesh.Triangle()
25 algo.MaxElementArea(20.)
26 mesh.Compute() 
27
28 # criterion : free borders
29 aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_FreeBorders) 
30 anIds = mesh.GetIdsFromFilter(aFilter)
31
32 # print the result
33 print "Criterion: Free borders Nb = ", len(anIds)
34 j = 1
35 for i in range(len(anIds)):
36   if j > 20: j = 1; print ""
37   print anIds[i],
38   j = j + 1
39   pass
40 print ""
41
42 # create a group
43 aGroup = mesh.CreateGroup(SMESH.EDGE, "Free borders")
44 aGroup.Add(anIds)
45
46 salome.sg.updateObjBrowser(1)
47 \endcode
48
49 \section tui_borders_at_multiconnection Borders at Multiconnection
50
51 \code
52 import salome
53 import geompy
54
55 import smesh
56 import SMESH
57
58 # create open shell: a box without one plane
59 box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
60 FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
61 FaceList.remove(FaceList[5])
62 box = geompy.MakeShell(FaceList)
63 idbox = geompy.addToStudy(box, "box")
64
65 # create a mesh
66 mesh = smesh.Mesh(box, "Mesh_borders_at_multi-connections")
67 algo = mesh.Segment()
68 algo.NumberOfSegments(5)
69 algo = mesh.Triangle()
70 algo.MaxElementArea(20.)
71 mesh.Compute() 
72
73 # Criterion : Borders at multi-connection
74 nb_conn = 2
75
76 aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_MultiConnection, smesh.FT_EqualTo, nb_conn)
77 anIds = mesh.GetIdsFromFilter(aFilter)
78
79 # print the result
80 print "Criterion: Borders at multi-connections Nb = ", len(anIds)
81 j = 1
82 for i in range(len(anIds)):
83   if j > 20: j = 1; print ""
84   print anIds[i],
85   j = j + 1
86   pass
87 print ""
88
89 # create a group
90 aGroup = mesh.CreateGroup(SMESH.EDGE, "Borders at multi-connections")
91 aGroup.Add(anIds)
92
93 salome.sg.updateObjBrowser(1)
94 \endcode
95
96 \section tui_length_1d Length 1D
97
98 \code
99 import salome
100 import geompy
101
102 import smesh
103
104 # create open shell: a box without one plane
105 box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
106 FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
107 FaceList.remove(FaceList[5])
108 box = geompy.MakeShell(FaceList)
109 idbox = geompy.addToStudy(box, "box")
110
111 # create a mesh
112 mesh = smesh.Mesh(box, "Mesh_Length_1D")
113 algo = mesh.Segment()
114 algo.NumberOfSegments(5)
115 algo = mesh.Triangle()
116 algo.MaxElementArea(20.)
117 mesh.Compute() 
118
119 # Criterion : Length > 3.
120 length_margin = 3.
121
122 aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_Length, smesh.FT_MoreThan, length_margin)
123 anIds = mesh.GetIdsFromFilter(aFilter) 
124
125 # print the result
126 print "Criterion: Edges length > ", length_margin, " Nb = ", len(anIds)
127 j = 1
128 for i in range(len(anIds)):
129   if j > 20: j = 1; print ""
130   print anIds[i],
131   j = j + 1
132   pass
133 print ""
134
135 # create a group
136 aGroup = mesh.CreateGroup(SMESH.EDGE, "Edges with length > " + `length_margin`)
137 aGroup.Add(anIds)
138
139 salome.sg.updateObjBrowser(1)
140 \endcode
141
142 \section tui_free_edges Free Edges
143
144 \code
145 import SMESH_mechanic
146
147 smesh  = SMESH_mechanic.smesh
148 mesh   = SMESH_mechanic.mesh
149 salome = SMESH_mechanic.salome
150
151 aFilterMgr = smesh.CreateFilterManager()
152
153 # Remove some elements to obtain free edges
154 # Criterion : AREA > 95.
155 area_margin = 95.
156
157 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, area_margin)
158
159 anIds = mesh.GetIdsFromFilter(aFilter)
160
161 mesh.RemoveElements(anIds)
162
163 # Criterion : Free Edges
164 aBorders = mesh.GetFreeBorders() 
165
166 # create groups
167 aGroupF = mesh.CreateGroup(SMESH.FACE, "Faces with free edges")
168 aGroupN = mesh.CreateGroup(SMESH.NODE, "Nodes on free edges")
169
170 # fill groups with elements, corresponding to the criterion
171 print ""
172 print "Criterion: Free edges Nb = ", len(aBorders)
173 for i in range(len(aBorders)):
174   aBorder = aBorders[i]
175   print "Face # ", aBorder.myElemId, " : Edge between nodes (",
176   print aBorder.myPnt1, ", ", aBorder.myPnt2, ")"
177
178   aGroupF.Add([aBorder.myElemId])
179   aGroupN.Add([aBorder.myPnt1, aBorder.myPnt2])
180
181 salome.sg.updateObjBrowser(1)
182 \endcode
183
184 \section tui_free_nodes Free Nodes
185
186 \code
187 import salome
188 import geompy
189
190 import smesh
191
192 # create box
193 box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
194 idbox = geompy.addToStudy(box, "box")
195
196 # create a mesh
197 mesh = smesh.Mesh(box, "Mesh_free_nodes")
198 algo = mesh.Segment()
199 algo.NumberOfSegments(10)
200 algo = mesh.Triangle(smesh.MEFISTO)
201 algo.MaxElementArea(150.)
202 mesh.Compute() 
203
204 # Remove some elements to obtain free nodes
205 # Criterion : AREA < 80.
206 area_margin = 80.
207
208 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, area_margin)
209
210 anIds = mesh.GetIdsFromFilter(aFilter)
211
212 mesh.RemoveElements(anIds)
213
214 # criterion : free nodes
215 aFilter = smesh.GetFilter(smesh.NODE, smesh.FT_FreeNodes) 
216 anNodeIds = mesh.GetIdsFromFilter(aFilter)
217
218 # create a group
219 aGroup = mesh.CreateEmptyGroup(smesh.NODE, "Free_nodes")
220 aGroup.Add(anNodeIds)
221
222 # print the result
223 print "Criterion: Free nodes Nb = ", len(anNodeIds)
224 j = 1
225 for i in range(len(anNodeIds)):
226   if j > 20: j = 1; print ""
227   print anNodeIds[i],
228   j = j + 1
229   pass
230 print ""
231
232 salome.sg.updateObjBrowser(1)
233 \endcode
234
235 \section tui_free_faces Free Faces
236
237 \code
238 import salome
239 import geompy
240
241 ####### GEOM part ########
242
243 Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
244 Box_1_vertex_6 = geompy.GetSubShape(Box_1, [6])
245 Box_1 = geompy.GetMainShape(Box_1_vertex_6)
246 Box_1_vertex_16 = geompy.GetSubShape(Box_1, [16])
247 Box_1 = geompy.GetMainShape(Box_1_vertex_16)
248 Box_1_vertex_11 = geompy.GetSubShape(Box_1, [11])
249 Box_1 = geompy.GetMainShape(Box_1_vertex_11)
250 Plane_1 = geompy.MakePlaneThreePnt(Box_1_vertex_6, Box_1_vertex_16, Box_1_vertex_11, 2000)
251 Partition_1 = geompy.MakePartition([Box_1], [Plane_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
252
253 Box_1_vertex_19 = geompy.GetSubShape(Box_1, [19])
254 Box_1_vertex_21 = geompy.GetSubShape(Box_1, [21])
255 Plane_2 = geompy.MakePlaneThreePnt(Box_1_vertex_16, Box_1_vertex_19, Box_1_vertex_21, 2000)
256
257 geompy.addToStudy( Box_1, "Box_1" )
258 geompy.addToStudyInFather( Box_1, Box_1_vertex_6, "Box_1:vertex_6" )
259 geompy.addToStudyInFather( Box_1, Box_1_vertex_16, "Box_1:vertex_16" )
260 geompy.addToStudyInFather( Box_1, Box_1_vertex_11, "Box_1:vertex_11" )
261 geompy.addToStudy( Plane_1, "Plane_1" )
262 geompy.addToStudy( Partition_1, "Partition_1" )
263 geompy.addToStudyInFather( Box_1, Box_1_vertex_19, "Box_1:vertex_19" )
264 geompy.addToStudyInFather( Box_1, Box_1_vertex_21, "Box_1:vertex_21" )
265 geompy.addToStudy( Plane_2, "Plane_2" )
266
267 ###### SMESH part ######
268 import smesh
269
270 import StdMeshers
271 import NETGENPlugin
272
273 Mesh_1 = smesh.Mesh(Partition_1)
274 Regular_1D = Mesh_1.Segment()
275 Max_Size_1 = Regular_1D.MaxSize(34.641)
276 MEFISTO_2D = Mesh_1.Triangle()
277 Tetrahedron_Netgen = Mesh_1.Tetrahedron(algo=smesh.NETGEN)
278 isDone = Mesh_1.Compute()
279
280 # create a group of free faces
281 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeFaces )
282 aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
283
284 aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Free_faces")
285 aGroup.Add(aFaceIds)
286
287 # print the result
288 print "Criterion: Free nodes Nb = ", len(anNodeIds)
289 j = 1
290 for i in range(len(aFaceIds)):
291   if j > 20: j = 1; print ""
292   print anNodeIds[i],
293   j = j + 1
294   pass
295 print ""
296
297 #filter faces from plane 2
298 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToPlane, Plane_2)
299 aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
300 aGroup.Remove(aFaceIds)
301
302 # create a group of shared faces (located on partition boundary inside box)
303 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToPlane, Plane_1)
304 aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
305
306 aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Shared_faces")
307 aGroup.Add(aFaceIds)
308
309 salome.sg.updateObjBrowser(1)
310 \endcode
311
312 \section tui_bare_border_faces Bare border faces
313
314 \code
315 from smesh import *
316 SetCurrentStudy(salome.myStudy)
317
318 box = geompy.MakeBoxDXDYDZ(100, 100, 100)
319 geompy.addToStudy( box, "box" )
320
321 mesh = smesh.Mesh(box)
322 mesh.Segment().NumberOfSegments(3)
323 mesh.Quadrangle()
324 mesh.Compute()
325
326 # remove 2 faces
327 allFaces = mesh.GetElementsByType(FACE)
328 mesh.RemoveElements( allFaces[0:2])
329
330 bareGroup = mesh.MakeGroup("bare faces", FACE, FT_BareBorderFace)
331 assert(bareGroup.Size() == 3)
332 \endcode
333
334 \section tui_bare_border_volumes Bare border volumes
335
336 \code
337 from smesh import *
338 SetCurrentStudy(salome.myStudy)
339
340 box = geompy.MakeBoxDXDYDZ(100, 30, 10)
341 # the smallest face of the box
342 face = geompy.SubShapeAllSorted( box, geompy.ShapeType["FACE"])[0]
343
344 geompy.addToStudy( box, "box" )
345 geompy.addToStudyInFather( box, face, "face" )
346
347 mesh = Mesh(box)
348 mesh.AutomaticHexahedralization();
349
350 # remove half of mesh faces from the smallest face
351 faceFaces = mesh.GetSubMeshElementsId(face)
352 faceToRemove = faceFaces[: len(faceFaces)/2]
353 mesh.RemoveElements( faceToRemove )
354
355 # make a group of volumes missing the removed faces
356 bareGroup = mesh.MakeGroup("bare volumes", VOLUME, FT_BareBorderVolume)
357 assert(bareGroup.Size() == len( faceToRemove))
358 \endcode
359
360 \section tui_over_constrained_faces Over-constrained faces
361 \code
362 from smesh import *
363 SetCurrentStudy(salome.myStudy)
364
365 mesh = Mesh()
366 faceFilter = GetFilter(FACE,FT_OverConstrainedFace)
367
368 #make an edge
369 n1 = mesh.AddNode(0,0,0)
370 n2 = mesh.AddNode(10,0,0)
371 edge = mesh.AddEdge([n1,n2])
372 assert( not mesh.GetIdsFromFilter( faceFilter ))
373
374 # make faces 
375 mesh.ExtrusionSweep([edge], MakeDirStruct(0,7,0), 5)
376 assert( 2 == len( mesh.GetIdsFromFilter( faceFilter )))
377 \endcode
378
379 \section tui_over_constrained_volumes Over-constrained volumes
380 \code
381 from smesh import *
382 SetCurrentStudy(salome.myStudy)
383
384 mesh = Mesh()
385 volumeFilter = GetFilter(VOLUME,FT_OverConstrainedVolume)
386
387 # make volumes by extrusion of one face
388 n1 = mesh.AddNode(0,0,0)
389 n2 = mesh.AddNode(10,0,0)
390 edge = mesh.AddEdge([n1,n2])
391 mesh.ExtrusionSweep([edge], MakeDirStruct(0,7,0), 1)
392 mesh.ExtrusionSweep( mesh.GetElementsByType(FACE), MakeDirStruct(0,0,5), 7)
393 assert( 2 == len( mesh.GetIdsFromFilter( volumeFilter )))
394 \endcode
395
396 \section tui_length_2d Length 2D
397
398 \code
399 import salome
400 import geompy
401
402 import smesh
403
404 # create open shell: a box without one plane
405 box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
406 FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
407 FaceList.remove(FaceList[5])
408 box = geompy.MakeShell(FaceList)
409 idbox = geompy.addToStudy(box, "box")
410
411 # create a mesh
412 mesh = smesh.Mesh(box, "Mesh_Length_2D")
413 algo = mesh.Segment()
414 algo.NumberOfSegments(5)
415 algo = mesh.Triangle()
416 algo.MaxElementArea(20.)
417 mesh.Compute()
418
419 # Criterion : Length 2D > 5.7
420 length_margin = 5.7
421
422 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Length2D, smesh.FT_MoreThan, length_margin)
423
424 anIds = mesh.GetIdsFromFilter(aFilter)
425
426 # print the result
427 print "Criterion: Edges length 2D > ", length_margin, " Nb = ", len(anIds)
428 j = 1
429 for i in range(len(anIds)):
430   if j > 20: j = 1; print ""
431   print anIds[i],
432   j = j + 1
433   pass
434 print ""
435
436 # create a group
437 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Faces with length 2D > " + `length_margin`)
438 aGroup.Add(anIds)
439
440 salome.sg.updateObjBrowser(1)
441 \endcode
442
443 \section tui_borders_at_multiconnection_2d Borders at Multiconnection 2D
444
445 \code
446 import salome
447 import geompy
448
449 import smesh
450
451 # create a compound of two glued boxes
452 box1 = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
453 box2 = geompy.MakeTranslation(box1, 0., 20., 0)
454 comp = geompy.MakeCompound([box1, box2])
455 box = geompy.MakeGlueFaces(comp, 0.000001)
456 idbox = geompy.addToStudy(box, "box")
457
458 # create a mesh
459 mesh = smesh.Mesh(box, "Box compound : 2D triangle mesh")
460 algo = mesh.Segment()
461 algo.NumberOfSegments(5)
462 algo = mesh.Triangle()
463 algo.MaxElementArea(20.)
464 mesh.Compute() 
465
466 # Criterion : MULTI-CONNECTION 2D = 3
467 nb_conn = 3
468
469 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MultiConnection2D, smesh.FT_EqualTo, nb_conn)
470
471 anIds = mesh.GetIdsFromFilter(aFilter) 
472
473 # print the result
474 print "Criterion: Borders at multi-connection 2D = ", nb_conn, " Nb = ", len(anIds)
475 j = 1
476 for i in range(len(anIds)):
477   if j > 20: j = 1; print ""
478   print anIds[i],
479   j = j + 1
480   pass
481 print ""
482
483 # create a group
484 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Borders at multi-connection 2D = " + `nb_conn`)
485 aGroup.Add(anIds)
486
487 salome.sg.updateObjBrowser(1)
488 \endcode
489
490 \section tui_area Area
491
492 \code
493 import SMESH_mechanic
494
495 smesh  = SMESH_mechanic.smesh
496 mesh   = SMESH_mechanic.mesh
497 salome = SMESH_mechanic.salome
498
499 # Criterion : AREA > 100.
500 area_margin = 100.
501
502 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, area_margin)
503
504 anIds = mesh.GetIdsFromFilter(aFilter) 
505
506 # print the result
507 print "Criterion: Area > ", area_margin, " Nb = ", len(anIds)
508 j = 1
509 for i in range(len(anIds)):
510   if j > 20: j = 1; print ""
511   print anIds[i],
512   j = j + 1
513   pass
514 print ""
515
516 # create a group
517 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Area > " + `area_margin`)
518 aGroup.Add(anIds)
519
520 salome.sg.updateObjBrowser(1)  
521 \endcode
522
523 \section tui_taper Taper
524
525 \code
526 import SMESH_mechanic
527
528 smesh  = SMESH_mechanic.smesh
529 mesh   = SMESH_mechanic.mesh
530 salome = SMESH_mechanic.salome
531
532 # Criterion : Taper > 3e-20
533 taper_margin = 3e-20
534
535 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Taper, smesh.FT_MoreThan, taper_margin)
536
537 anIds = mesh.GetIdsFromFilter(aFilter) 
538
539 # print the result
540 print "Criterion: Taper > ", taper_margin, " Nb = ", len(anIds)
541 j = 1
542 for i in range(len(anIds)):
543   if j > 20: j = 1; print ""
544   print anIds[i],
545   j = j + 1
546   pass
547 print ""
548
549 # create a group
550 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Taper > " + `taper_margin`)
551 aGroup.Add(anIds)
552
553 salome.sg.updateObjBrowser(1)
554 \endcode
555
556 \section tui_aspect_ratio Aspect Ratio
557
558 \code
559 import SMESH_mechanic
560
561 smesh  = SMESH_mechanic.smesh
562 mesh   = SMESH_mechanic.mesh
563 salome = SMESH_mechanic.salome
564
565 # Criterion : ASPECT RATIO > 1.8
566 ar_margin = 1.8
567
568 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, ar_margin)
569
570 anIds = mesh.GetIdsFromFilter(aFilter) 
571
572 # print the result
573 print "Criterion: Aspect Ratio > ", ar_margin, " Nb = ", len(anIds)
574 j = 1
575 for i in range(len(anIds)):
576   if j > 20: j = 1; print ""
577   print anIds[i],
578   j = j + 1
579   pass
580 print ""
581
582 # create a group
583 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Aspect Ratio > " + `ar_margin`)
584 aGroup.Add(anIds)
585
586 salome.sg.updateObjBrowser(1)
587 \endcode
588
589 \section tui_minimum_angle Minimum Angle
590
591 \code
592 import SMESH_mechanic
593
594 smesh  = SMESH_mechanic.smesh
595 mesh   = SMESH_mechanic.mesh
596 salome = SMESH_mechanic.salome
597
598 # Criterion : MINIMUM ANGLE < 35.
599 min_angle = 35.
600
601 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MinimumAngle, smesh.FT_LessThan, min_angle)
602
603 anIds = mesh.GetIdsFromFilter(aFilter) 
604
605 # print the result
606 print "Criterion: Minimum Angle < ", min_angle, " Nb = ", len(anIds)
607 j = 1
608 for i in range(len(anIds)):
609   if j > 20: j = 1; print ""
610   print anIds[i],
611   j = j + 1
612   pass
613 print ""
614
615 # create a group
616 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Minimum Angle < " + `min_angle`)
617
618 aGroup.Add(anIds)
619
620 salome.sg.updateObjBrowser(1)
621 \endcode
622
623 \section tui_warping Warping
624
625 \code
626 import SMESH_mechanic
627
628 smesh  = SMESH_mechanic.smesh
629 mesh   = SMESH_mechanic.mesh
630 salome = SMESH_mechanic.salome
631
632 # Criterion : WARP ANGLE > 1e-15
633 wa_margin = 1e-15
634
635 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Warping, smesh.FT_MoreThan, wa_margin)
636
637 anIds = mesh.GetIdsFromFilter(aFilter) 
638
639 # print the result
640 print "Criterion: Warp > ", wa_margin, " Nb = ", len(anIds)
641 j = 1
642 for i in range(len(anIds)):
643   if j > 20: j = 1; print ""
644   print anIds[i],
645   j = j + 1
646   pass
647 print ""
648
649 # create a group
650 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Warp > " + `wa_margin`)
651
652 aGroup.Add(anIds)
653
654 salome.sg.updateObjBrowser(1) 
655 \endcode
656
657 \section tui_skew Skew
658
659 \code
660 import SMESH_mechanic
661
662 smesh  = SMESH_mechanic.smesh
663 mesh   = SMESH_mechanic.mesh
664 salome = SMESH_mechanic.salome
665
666 # Criterion : Skew > 38.
667 skew_margin = 38.
668
669 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, skew_margin)
670
671 anIds = mesh.GetIdsFromFilter(aFilter)
672
673 # print the result
674 print "Criterion: Skew > ", skew_margin, " Nb = ", len(anIds)
675 j = 1
676 for i in range(len(anIds)):
677   if j > 20: j = 1; print ""
678   print anIds[i],
679   j = j + 1
680   pass
681 print ""
682
683 # create a group
684 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Skew > " + `skew_margin`)
685 aGroup.Add(anIds)
686
687 salome.sg.updateObjBrowser(1)
688 \endcode
689
690 \section tui_max_element_length_2d Element Diameter 2D
691
692 \code
693 import SMESH_mechanic
694
695 smesh  = SMESH_mechanic.smesh
696 mesh   = SMESH_mechanic.mesh
697 salome = SMESH_mechanic.salome
698
699 # Criterion : ELEMENT DIAMETER 2D > 10
700 mel_2d_margin = 10
701
702 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength2D, smesh.FT_MoreThan, mel_2d_margin)
703
704 anIds = mesh.GetIdsFromFilter(aFilter) 
705
706 # print the result
707 print "Criterion: Element Diameter 2D Ratio > ", mel_2d_margin, " Nb = ", len(anIds)
708 j = 1
709 for i in range(len(anIds)):
710   if j > 20: j = 1; print ""
711   print anIds[i],
712   j = j + 1
713   pass
714 print ""
715
716 # create a group
717 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Element Diameter 2D > " + `mel_2d_margin`)
718 aGroup.Add(anIds)
719
720 salome.sg.updateObjBrowser(1)
721 \endcode
722
723 \section tui_aspect_ratio_3d Aspect Ratio 3D
724
725 \code
726 import SMESH_mechanic_tetra 
727
728 smesh  = SMESH_mechanic_tetra.smesh
729 mesh   = SMESH_mechanic_tetra.mesh
730 salome = SMESH_mechanic_tetra.salome
731
732 # Criterion : ASPECT RATIO 3D > 4.5
733 ar_margin = 4.5
734
735 aFilter = smesh.GetFilter(smesh.VOLUME, smesh.FT_AspectRatio3D, smesh.FT_MoreThan, ar_margin)
736
737 anIds = mesh.GetIdsFromFilter(aFilter) 
738
739 # print the result
740 print "Criterion: Aspect Ratio 3D > ", ar_margin, " Nb = ", len(anIds)
741 j = 1
742 for i in range(len(anIds)):
743   if j > 20: j = 1; print ""
744   print anIds[i],
745   j = j + 1
746   pass
747 print ""
748
749 # create a group
750 aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, "Aspect Ratio 3D > " + `ar_margin`)
751
752 aGroup.Add(anIds)
753
754 salome.sg.updateObjBrowser(1)
755 \endcode
756
757 \section tui_volume Volume
758
759 \code
760 import SMESH_mechanic_tetra
761
762 smesh  = SMESH_mechanic_tetra.smesh
763 mesh   = SMESH_mechanic_tetra.mesh
764 salome = SMESH_mechanic_tetra.salome
765
766 # Criterion : VOLUME < 7.
767 volume_margin = 7.
768
769 aFilter = smesh.GetFilter(smesh.VOLUME, smesh.FT_Volume3D, smesh.FT_LessThan, volume_margin)
770
771 anIds = mesh.GetIdsFromFilter(aFilter) 
772
773 # print the result
774 print ""
775 print "Criterion: Volume < ", volume_margin, " Nb = ", len(anIds)
776 j = 1
777 for i in range(len(anIds)):
778   if j > 20: j = 1; print ""
779   print anIds[i],
780   j = j + 1
781   pass
782 print ""
783
784 # create a group
785 aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, "Volume < " + `volume_margin`)
786
787 aGroup.Add(anIds)
788
789 salome.sg.updateObjBrowser(1) 
790 \endcode
791
792 \section tui_max_element_length_3d Element Diameter 3D
793
794 \code
795 import SMESH_mechanic_tetra
796
797 smesh  = SMESH_mechanic_tetra.smesh
798 mesh   = SMESH_mechanic_tetra.mesh
799 salome = SMESH_mechanic_tetra.salome
800
801 # Criterion : ELEMENT DIAMETER 3D > 10
802 mel_3d_margin = 10
803
804 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength3D, smesh.FT_MoreThan, mel_3d_margin)
805
806 anIds = mesh.GetIdsFromFilter(aFilter) 
807
808 # print the result
809 print "Criterion: Element Diameter 3D Ratio > ", mel_3d_margin, " Nb = ", len(anIds)
810 j = 1
811 for i in range(len(anIds)):
812   if j > 20: j = 1; print ""
813   print anIds[i],
814   j = j + 1
815   pass
816 print ""
817
818 # create a group
819 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Element Diameter 3D > " + `mel_3d_margin`)
820 aGroup.Add(anIds)
821
822 salome.sg.updateObjBrowser(1)
823 \endcode
824
825 */