Salome HOME
bc99172aaec77fceb5ec25b114f2eb7d1caf1939
[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
272 Mesh_1 = smesh.Mesh(Partition_1)
273 Regular_1D = Mesh_1.Segment()
274 Max_Size_1 = Regular_1D.MaxSize(34.641)
275 MEFISTO_2D = Mesh_1.Triangle()
276 Tetrahedronn = Mesh_1.Tetrahedron()
277 isDone = Mesh_1.Compute()
278
279 # create a group of free faces
280 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeFaces )
281 aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
282
283 aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Free_faces")
284 aGroup.Add(aFaceIds)
285
286 # print the result
287 print "Criterion: Free faces Nb = ", len(aFaceIds)
288 j = 1
289 for i in range(len(aFaceIds)):
290   if j > 20: j = 1; print ""
291   print aFaceIds[i],
292   j = j + 1
293   pass
294 print ""
295
296 #filter faces from plane 2
297 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToPlane, Plane_2)
298 aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
299 aGroup.Remove(aFaceIds)
300
301 # create a group of shared faces (located on partition boundary inside box)
302 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToPlane, Plane_1)
303 aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
304
305 aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Shared_faces")
306 aGroup.Add(aFaceIds)
307
308 salome.sg.updateObjBrowser(1)
309 \endcode
310
311 \section tui_bare_border_faces Bare border faces
312
313 \code
314 from smesh import *
315 SetCurrentStudy(salome.myStudy)
316
317 box = geompy.MakeBoxDXDYDZ(100, 100, 100)
318 geompy.addToStudy( box, "box" )
319
320 mesh = smesh.Mesh(box)
321 mesh.Segment().NumberOfSegments(3)
322 mesh.Quadrangle()
323 mesh.Compute()
324
325 # remove 2 faces
326 allFaces = mesh.GetElementsByType(FACE)
327 mesh.RemoveElements( allFaces[0:2])
328
329 bareGroup = mesh.MakeGroup("bare faces", FACE, FT_BareBorderFace)
330 assert(bareGroup.Size() == 3)
331 \endcode
332
333 \section tui_bare_border_volumes Bare border volumes
334
335 \code
336 from smesh import *
337 SetCurrentStudy(salome.myStudy)
338
339 box = geompy.MakeBoxDXDYDZ(100, 30, 10)
340 # the smallest face of the box
341 face = geompy.SubShapeAllSorted( box, geompy.ShapeType["FACE"])[0]
342
343 geompy.addToStudy( box, "box" )
344 geompy.addToStudyInFather( box, face, "face" )
345
346 mesh = Mesh(box)
347 mesh.AutomaticHexahedralization();
348
349 # remove half of mesh faces from the smallest face
350 faceFaces = mesh.GetSubMeshElementsId(face)
351 faceToRemove = faceFaces[: len(faceFaces)/2]
352 mesh.RemoveElements( faceToRemove )
353
354 # make a group of volumes missing the removed faces
355 bareGroup = mesh.MakeGroup("bare volumes", VOLUME, FT_BareBorderVolume)
356 assert(bareGroup.Size() == len( faceToRemove))
357 \endcode
358
359 \section tui_over_constrained_faces Over-constrained faces
360 \code
361 from smesh import *
362 SetCurrentStudy(salome.myStudy)
363
364 mesh = Mesh()
365 faceFilter = GetFilter(FACE,FT_OverConstrainedFace)
366
367 #make an edge
368 n1 = mesh.AddNode(0,0,0)
369 n2 = mesh.AddNode(10,0,0)
370 edge = mesh.AddEdge([n1,n2])
371 assert( not mesh.GetIdsFromFilter( faceFilter ))
372
373 # make faces 
374 mesh.ExtrusionSweep([edge], MakeDirStruct(0,7,0), 5)
375 assert( 2 == len( mesh.GetIdsFromFilter( faceFilter )))
376 \endcode
377
378 \section tui_over_constrained_volumes Over-constrained volumes
379 \code
380 from smesh import *
381 SetCurrentStudy(salome.myStudy)
382
383 mesh = Mesh()
384 volumeFilter = GetFilter(VOLUME,FT_OverConstrainedVolume)
385
386 # make volumes by extrusion of one face
387 n1 = mesh.AddNode(0,0,0)
388 n2 = mesh.AddNode(10,0,0)
389 edge = mesh.AddEdge([n1,n2])
390 mesh.ExtrusionSweep([edge], MakeDirStruct(0,7,0), 1)
391 mesh.ExtrusionSweep( mesh.GetElementsByType(FACE), MakeDirStruct(0,0,5), 7)
392 assert( 2 == len( mesh.GetIdsFromFilter( volumeFilter )))
393 \endcode
394
395 \section tui_length_2d Length 2D
396
397 \code
398 import salome
399 import geompy
400
401 import smesh
402
403 # create open shell: a box without one plane
404 box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
405 FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
406 FaceList.remove(FaceList[5])
407 box = geompy.MakeShell(FaceList)
408 idbox = geompy.addToStudy(box, "box")
409
410 # create a mesh
411 mesh = smesh.Mesh(box, "Mesh_Length_2D")
412 algo = mesh.Segment()
413 algo.NumberOfSegments(5)
414 algo = mesh.Triangle()
415 algo.MaxElementArea(20.)
416 mesh.Compute()
417
418 # Criterion : Length 2D > 5.7
419 length_margin = 5.7
420
421 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Length2D, smesh.FT_MoreThan, length_margin)
422
423 anIds = mesh.GetIdsFromFilter(aFilter)
424
425 # print the result
426 print "Criterion: Edges length 2D > ", length_margin, " Nb = ", len(anIds)
427 j = 1
428 for i in range(len(anIds)):
429   if j > 20: j = 1; print ""
430   print anIds[i],
431   j = j + 1
432   pass
433 print ""
434
435 # create a group
436 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Faces with length 2D > " + `length_margin`)
437 aGroup.Add(anIds)
438
439 salome.sg.updateObjBrowser(1)
440 \endcode
441
442 \section tui_borders_at_multiconnection_2d Borders at Multiconnection 2D
443
444 \code
445 import salome
446 import geompy
447
448 import smesh
449
450 # create a compound of two glued boxes
451 box1 = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
452 box2 = geompy.MakeTranslation(box1, 0., 20., 0)
453 comp = geompy.MakeCompound([box1, box2])
454 box = geompy.MakeGlueFaces(comp, 0.000001)
455 idbox = geompy.addToStudy(box, "box")
456
457 # create a mesh
458 mesh = smesh.Mesh(box, "Box compound : 2D triangle mesh")
459 algo = mesh.Segment()
460 algo.NumberOfSegments(5)
461 algo = mesh.Triangle()
462 algo.MaxElementArea(20.)
463 mesh.Compute() 
464
465 # Criterion : MULTI-CONNECTION 2D = 3
466 nb_conn = 3
467
468 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MultiConnection2D, smesh.FT_EqualTo, nb_conn)
469
470 anIds = mesh.GetIdsFromFilter(aFilter) 
471
472 # print the result
473 print "Criterion: Borders at multi-connection 2D = ", nb_conn, " Nb = ", len(anIds)
474 j = 1
475 for i in range(len(anIds)):
476   if j > 20: j = 1; print ""
477   print anIds[i],
478   j = j + 1
479   pass
480 print ""
481
482 # create a group
483 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Borders at multi-connection 2D = " + `nb_conn`)
484 aGroup.Add(anIds)
485
486 salome.sg.updateObjBrowser(1)
487 \endcode
488
489 \section tui_area Area
490
491 \code
492 import SMESH_mechanic
493
494 smesh  = SMESH_mechanic.smesh
495 mesh   = SMESH_mechanic.mesh
496 salome = SMESH_mechanic.salome
497
498 # Criterion : AREA > 100.
499 area_margin = 100.
500
501 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, area_margin)
502
503 anIds = mesh.GetIdsFromFilter(aFilter) 
504
505 # print the result
506 print "Criterion: Area > ", area_margin, " Nb = ", len(anIds)
507 j = 1
508 for i in range(len(anIds)):
509   if j > 20: j = 1; print ""
510   print anIds[i],
511   j = j + 1
512   pass
513 print ""
514
515 # create a group
516 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Area > " + `area_margin`)
517 aGroup.Add(anIds)
518
519 salome.sg.updateObjBrowser(1)  
520 \endcode
521
522 \section tui_taper Taper
523
524 \code
525 import SMESH_mechanic
526
527 smesh  = SMESH_mechanic.smesh
528 mesh   = SMESH_mechanic.mesh
529 salome = SMESH_mechanic.salome
530
531 # Criterion : Taper > 3e-20
532 taper_margin = 3e-20
533
534 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Taper, smesh.FT_MoreThan, taper_margin)
535
536 anIds = mesh.GetIdsFromFilter(aFilter) 
537
538 # print the result
539 print "Criterion: Taper > ", taper_margin, " Nb = ", len(anIds)
540 j = 1
541 for i in range(len(anIds)):
542   if j > 20: j = 1; print ""
543   print anIds[i],
544   j = j + 1
545   pass
546 print ""
547
548 # create a group
549 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Taper > " + `taper_margin`)
550 aGroup.Add(anIds)
551
552 salome.sg.updateObjBrowser(1)
553 \endcode
554
555 \section tui_aspect_ratio Aspect Ratio
556
557 \code
558 import SMESH_mechanic
559
560 smesh  = SMESH_mechanic.smesh
561 mesh   = SMESH_mechanic.mesh
562 salome = SMESH_mechanic.salome
563
564 # Criterion : ASPECT RATIO > 1.8
565 ar_margin = 1.8
566
567 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, ar_margin)
568
569 anIds = mesh.GetIdsFromFilter(aFilter) 
570
571 # print the result
572 print "Criterion: Aspect Ratio > ", ar_margin, " Nb = ", len(anIds)
573 j = 1
574 for i in range(len(anIds)):
575   if j > 20: j = 1; print ""
576   print anIds[i],
577   j = j + 1
578   pass
579 print ""
580
581 # create a group
582 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Aspect Ratio > " + `ar_margin`)
583 aGroup.Add(anIds)
584
585 salome.sg.updateObjBrowser(1)
586 \endcode
587
588 \section tui_minimum_angle Minimum Angle
589
590 \code
591 import SMESH_mechanic
592
593 smesh  = SMESH_mechanic.smesh
594 mesh   = SMESH_mechanic.mesh
595 salome = SMESH_mechanic.salome
596
597 # Criterion : MINIMUM ANGLE < 35.
598 min_angle = 35.
599
600 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MinimumAngle, smesh.FT_LessThan, min_angle)
601
602 anIds = mesh.GetIdsFromFilter(aFilter) 
603
604 # print the result
605 print "Criterion: Minimum Angle < ", min_angle, " Nb = ", len(anIds)
606 j = 1
607 for i in range(len(anIds)):
608   if j > 20: j = 1; print ""
609   print anIds[i],
610   j = j + 1
611   pass
612 print ""
613
614 # create a group
615 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Minimum Angle < " + `min_angle`)
616
617 aGroup.Add(anIds)
618
619 salome.sg.updateObjBrowser(1)
620 \endcode
621
622 \section tui_warping Warping
623
624 \code
625 import SMESH_mechanic
626
627 smesh  = SMESH_mechanic.smesh
628 mesh   = SMESH_mechanic.mesh
629 salome = SMESH_mechanic.salome
630
631 # Criterion : WARP ANGLE > 1e-15
632 wa_margin = 1e-15
633
634 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Warping, smesh.FT_MoreThan, wa_margin)
635
636 anIds = mesh.GetIdsFromFilter(aFilter) 
637
638 # print the result
639 print "Criterion: Warp > ", wa_margin, " Nb = ", len(anIds)
640 j = 1
641 for i in range(len(anIds)):
642   if j > 20: j = 1; print ""
643   print anIds[i],
644   j = j + 1
645   pass
646 print ""
647
648 # create a group
649 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Warp > " + `wa_margin`)
650
651 aGroup.Add(anIds)
652
653 salome.sg.updateObjBrowser(1) 
654 \endcode
655
656 \section tui_skew Skew
657
658 \code
659 import SMESH_mechanic
660
661 smesh  = SMESH_mechanic.smesh
662 mesh   = SMESH_mechanic.mesh
663 salome = SMESH_mechanic.salome
664
665 # Criterion : Skew > 38.
666 skew_margin = 38.
667
668 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, skew_margin)
669
670 anIds = mesh.GetIdsFromFilter(aFilter)
671
672 # print the result
673 print "Criterion: Skew > ", skew_margin, " Nb = ", len(anIds)
674 j = 1
675 for i in range(len(anIds)):
676   if j > 20: j = 1; print ""
677   print anIds[i],
678   j = j + 1
679   pass
680 print ""
681
682 # create a group
683 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Skew > " + `skew_margin`)
684 aGroup.Add(anIds)
685
686 salome.sg.updateObjBrowser(1)
687 \endcode
688
689 \section tui_max_element_length_2d Element Diameter 2D
690
691 \code
692 import SMESH_mechanic
693
694 smesh  = SMESH_mechanic.smesh
695 mesh   = SMESH_mechanic.mesh
696 salome = SMESH_mechanic.salome
697
698 # Criterion : ELEMENT DIAMETER 2D > 10
699 mel_2d_margin = 10
700
701 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength2D, smesh.FT_MoreThan, mel_2d_margin)
702
703 anIds = mesh.GetIdsFromFilter(aFilter) 
704
705 # print the result
706 print "Criterion: Element Diameter 2D Ratio > ", mel_2d_margin, " Nb = ", len(anIds)
707 j = 1
708 for i in range(len(anIds)):
709   if j > 20: j = 1; print ""
710   print anIds[i],
711   j = j + 1
712   pass
713 print ""
714
715 # create a group
716 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Element Diameter 2D > " + `mel_2d_margin`)
717 aGroup.Add(anIds)
718
719 salome.sg.updateObjBrowser(1)
720 \endcode
721
722 \section tui_aspect_ratio_3d Aspect Ratio 3D
723
724 \code
725 import SMESH_mechanic_tetra 
726
727 smesh  = SMESH_mechanic_tetra.smesh
728 mesh   = SMESH_mechanic_tetra.mesh
729 salome = SMESH_mechanic_tetra.salome
730
731 # Criterion : ASPECT RATIO 3D > 4.5
732 ar_margin = 4.5
733
734 aFilter = smesh.GetFilter(smesh.VOLUME, smesh.FT_AspectRatio3D, smesh.FT_MoreThan, ar_margin)
735
736 anIds = mesh.GetIdsFromFilter(aFilter) 
737
738 # print the result
739 print "Criterion: Aspect Ratio 3D > ", ar_margin, " Nb = ", len(anIds)
740 j = 1
741 for i in range(len(anIds)):
742   if j > 20: j = 1; print ""
743   print anIds[i],
744   j = j + 1
745   pass
746 print ""
747
748 # create a group
749 aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, "Aspect Ratio 3D > " + `ar_margin`)
750
751 aGroup.Add(anIds)
752
753 salome.sg.updateObjBrowser(1)
754 \endcode
755
756 \section tui_volume Volume
757
758 \code
759 import SMESH_mechanic_tetra
760
761 smesh  = SMESH_mechanic_tetra.smesh
762 mesh   = SMESH_mechanic_tetra.mesh
763 salome = SMESH_mechanic_tetra.salome
764
765 # Criterion : VOLUME < 7.
766 volume_margin = 7.
767
768 aFilter = smesh.GetFilter(smesh.VOLUME, smesh.FT_Volume3D, smesh.FT_LessThan, volume_margin)
769
770 anIds = mesh.GetIdsFromFilter(aFilter) 
771
772 # print the result
773 print ""
774 print "Criterion: Volume < ", volume_margin, " Nb = ", len(anIds)
775 j = 1
776 for i in range(len(anIds)):
777   if j > 20: j = 1; print ""
778   print anIds[i],
779   j = j + 1
780   pass
781 print ""
782
783 # create a group
784 aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, "Volume < " + `volume_margin`)
785
786 aGroup.Add(anIds)
787
788 salome.sg.updateObjBrowser(1) 
789 \endcode
790
791 \section tui_max_element_length_3d Element Diameter 3D
792
793 \code
794 import SMESH_mechanic_tetra
795
796 smesh  = SMESH_mechanic_tetra.smesh
797 mesh   = SMESH_mechanic_tetra.mesh
798 salome = SMESH_mechanic_tetra.salome
799
800 # Criterion : ELEMENT DIAMETER 3D > 10
801 mel_3d_margin = 10
802
803 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength3D, smesh.FT_MoreThan, mel_3d_margin)
804
805 anIds = mesh.GetIdsFromFilter(aFilter) 
806
807 # print the result
808 print "Criterion: Element Diameter 3D Ratio > ", mel_3d_margin, " Nb = ", len(anIds)
809 j = 1
810 for i in range(len(anIds)):
811   if j > 20: j = 1; print ""
812   print anIds[i],
813   j = j + 1
814   pass
815 print ""
816
817 # create a group
818 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Element Diameter 3D > " + `mel_3d_margin`)
819 aGroup.Add(anIds)
820
821 salome.sg.updateObjBrowser(1)
822 \endcode
823
824 */