3 \page tui_quality_controls_page Quality Controls
5 \section tui_free_borders Free Borders
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")
21 mesh = smesh.Mesh(box, "Mesh_free_borders")
23 algo.NumberOfSegments(5)
24 algo = mesh.Triangle()
25 algo.MaxElementArea(20.)
28 # criterion : free borders
29 aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_FreeBorders)
30 anIds = mesh.GetIdsFromFilter(aFilter)
33 print "Criterion: Free borders Nb = ", len(anIds)
35 for i in range(len(anIds)):
36 if j > 20: j = 1; print ""
43 aGroup = mesh.CreateGroup(SMESH.EDGE, "Free borders")
46 salome.sg.updateObjBrowser(1)
49 \section tui_borders_at_multiconnection Borders at Multiconnection
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")
66 mesh = smesh.Mesh(box, "Mesh_borders_at_multi-connections")
68 algo.NumberOfSegments(5)
69 algo = mesh.Triangle()
70 algo.MaxElementArea(20.)
73 # Criterion : Borders at multi-connection
76 aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_MultiConnection, smesh.FT_EqualTo, nb_conn)
77 anIds = mesh.GetIdsFromFilter(aFilter)
80 print "Criterion: Borders at multi-connections Nb = ", len(anIds)
82 for i in range(len(anIds)):
83 if j > 20: j = 1; print ""
90 aGroup = mesh.CreateGroup(SMESH.EDGE, "Borders at multi-connections")
93 salome.sg.updateObjBrowser(1)
96 \section tui_length_1d Length 1D
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")
112 mesh = smesh.Mesh(box, "Mesh_Length_1D")
113 algo = mesh.Segment()
114 algo.NumberOfSegments(5)
115 algo = mesh.Triangle()
116 algo.MaxElementArea(20.)
119 # Criterion : Length > 3.
122 aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_Length, smesh.FT_MoreThan, length_margin)
123 anIds = mesh.GetIdsFromFilter(aFilter)
126 print "Criterion: Edges length > ", length_margin, " Nb = ", len(anIds)
128 for i in range(len(anIds)):
129 if j > 20: j = 1; print ""
136 aGroup = mesh.CreateGroup(SMESH.EDGE, "Edges with length > " + `length_margin`)
139 salome.sg.updateObjBrowser(1)
142 \section tui_free_edges Free Edges
145 import SMESH_mechanic
147 smesh = SMESH_mechanic.smesh
148 mesh = SMESH_mechanic.mesh
149 salome = SMESH_mechanic.salome
151 aFilterMgr = smesh.CreateFilterManager()
153 # Remove some elements to obtain free edges
154 # Criterion : AREA > 95.
157 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, area_margin)
159 anIds = mesh.GetIdsFromFilter(aFilter)
161 mesh.RemoveElements(anIds)
163 # Criterion : Free Edges
164 aBorders = mesh.GetFreeBorders()
167 aGroupF = mesh.CreateGroup(SMESH.FACE, "Faces with free edges")
168 aGroupN = mesh.CreateGroup(SMESH.NODE, "Nodes on free edges")
170 # fill groups with elements, corresponding to the criterion
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, ")"
178 aGroupF.Add([aBorder.myElemId])
179 aGroupN.Add([aBorder.myPnt1, aBorder.myPnt2])
181 salome.sg.updateObjBrowser(1)
184 \section tui_free_nodes Free Nodes
193 box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
194 idbox = geompy.addToStudy(box, "box")
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.)
204 # Remove some elements to obtain free nodes
205 # Criterion : AREA < 80.
208 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, area_margin)
210 anIds = mesh.GetIdsFromFilter(aFilter)
212 mesh.RemoveElements(anIds)
214 # criterion : free nodes
215 aFilter = smesh.GetFilter(smesh.NODE, smesh.FT_FreeNodes)
216 anNodeIds = mesh.GetIdsFromFilter(aFilter)
219 aGroup = mesh.CreateEmptyGroup(smesh.NODE, "Free_nodes")
220 aGroup.Add(anNodeIds)
223 print "Criterion: Free nodes Nb = ", len(anNodeIds)
225 for i in range(len(anNodeIds)):
226 if j > 20: j = 1; print ""
232 salome.sg.updateObjBrowser(1)
235 \section tui_free_faces Free Faces
241 ####### GEOM part ########
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)
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)
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" )
267 ###### SMESH part ######
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()
279 # create a group of free faces
280 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeFaces )
281 aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
283 aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Free_faces")
287 print "Criterion: Free faces Nb = ", len(aFaceIds)
289 for i in range(len(aFaceIds)):
290 if j > 20: j = 1; print ""
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)
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)
305 aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Shared_faces")
308 salome.sg.updateObjBrowser(1)
311 \section tui_bare_border_faces Bare border faces
315 SetCurrentStudy(salome.myStudy)
317 box = geompy.MakeBoxDXDYDZ(100, 100, 100)
318 geompy.addToStudy( box, "box" )
320 mesh = smesh.Mesh(box)
321 mesh.Segment().NumberOfSegments(3)
326 allFaces = mesh.GetElementsByType(FACE)
327 mesh.RemoveElements( allFaces[0:2])
329 bareGroup = mesh.MakeGroup("bare faces", FACE, FT_BareBorderFace)
330 assert(bareGroup.Size() == 3)
333 \section tui_bare_border_volumes Bare border volumes
337 SetCurrentStudy(salome.myStudy)
339 box = geompy.MakeBoxDXDYDZ(100, 30, 10)
340 # the smallest face of the box
341 face = geompy.SubShapeAllSorted( box, geompy.ShapeType["FACE"])[0]
343 geompy.addToStudy( box, "box" )
344 geompy.addToStudyInFather( box, face, "face" )
347 mesh.AutomaticHexahedralization();
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 )
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))
359 \section tui_over_constrained_faces Over-constrained faces
362 SetCurrentStudy(salome.myStudy)
365 faceFilter = GetFilter(FACE,FT_OverConstrainedFace)
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 ))
374 mesh.ExtrusionSweep([edge], MakeDirStruct(0,7,0), 5)
375 assert( 2 == len( mesh.GetIdsFromFilter( faceFilter )))
378 \section tui_over_constrained_volumes Over-constrained volumes
381 SetCurrentStudy(salome.myStudy)
384 volumeFilter = GetFilter(VOLUME,FT_OverConstrainedVolume)
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 )))
395 \section tui_length_2d Length 2D
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")
411 mesh = smesh.Mesh(box, "Mesh_Length_2D")
412 algo = mesh.Segment()
413 algo.NumberOfSegments(5)
414 algo = mesh.Triangle()
415 algo.MaxElementArea(20.)
418 # Criterion : Length 2D > 5.7
421 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Length2D, smesh.FT_MoreThan, length_margin)
423 anIds = mesh.GetIdsFromFilter(aFilter)
426 print "Criterion: Edges length 2D > ", length_margin, " Nb = ", len(anIds)
428 for i in range(len(anIds)):
429 if j > 20: j = 1; print ""
436 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Faces with length 2D > " + `length_margin`)
439 salome.sg.updateObjBrowser(1)
442 \section tui_borders_at_multiconnection_2d Borders at Multiconnection 2D
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")
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.)
465 # Criterion : MULTI-CONNECTION 2D = 3
468 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MultiConnection2D, smesh.FT_EqualTo, nb_conn)
470 anIds = mesh.GetIdsFromFilter(aFilter)
473 print "Criterion: Borders at multi-connection 2D = ", nb_conn, " Nb = ", len(anIds)
475 for i in range(len(anIds)):
476 if j > 20: j = 1; print ""
483 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Borders at multi-connection 2D = " + `nb_conn`)
486 salome.sg.updateObjBrowser(1)
489 \section tui_area Area
492 import SMESH_mechanic
494 smesh = SMESH_mechanic.smesh
495 mesh = SMESH_mechanic.mesh
496 salome = SMESH_mechanic.salome
498 # Criterion : AREA > 100.
501 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, area_margin)
503 anIds = mesh.GetIdsFromFilter(aFilter)
506 print "Criterion: Area > ", area_margin, " Nb = ", len(anIds)
508 for i in range(len(anIds)):
509 if j > 20: j = 1; print ""
516 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Area > " + `area_margin`)
519 salome.sg.updateObjBrowser(1)
522 \section tui_taper Taper
525 import SMESH_mechanic
527 smesh = SMESH_mechanic.smesh
528 mesh = SMESH_mechanic.mesh
529 salome = SMESH_mechanic.salome
531 # Criterion : Taper > 3e-20
534 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Taper, smesh.FT_MoreThan, taper_margin)
536 anIds = mesh.GetIdsFromFilter(aFilter)
539 print "Criterion: Taper > ", taper_margin, " Nb = ", len(anIds)
541 for i in range(len(anIds)):
542 if j > 20: j = 1; print ""
549 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Taper > " + `taper_margin`)
552 salome.sg.updateObjBrowser(1)
555 \section tui_aspect_ratio Aspect Ratio
558 import SMESH_mechanic
560 smesh = SMESH_mechanic.smesh
561 mesh = SMESH_mechanic.mesh
562 salome = SMESH_mechanic.salome
564 # Criterion : ASPECT RATIO > 1.8
567 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, ar_margin)
569 anIds = mesh.GetIdsFromFilter(aFilter)
572 print "Criterion: Aspect Ratio > ", ar_margin, " Nb = ", len(anIds)
574 for i in range(len(anIds)):
575 if j > 20: j = 1; print ""
582 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Aspect Ratio > " + `ar_margin`)
585 salome.sg.updateObjBrowser(1)
588 \section tui_minimum_angle Minimum Angle
591 import SMESH_mechanic
593 smesh = SMESH_mechanic.smesh
594 mesh = SMESH_mechanic.mesh
595 salome = SMESH_mechanic.salome
597 # Criterion : MINIMUM ANGLE < 35.
600 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MinimumAngle, smesh.FT_LessThan, min_angle)
602 anIds = mesh.GetIdsFromFilter(aFilter)
605 print "Criterion: Minimum Angle < ", min_angle, " Nb = ", len(anIds)
607 for i in range(len(anIds)):
608 if j > 20: j = 1; print ""
615 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Minimum Angle < " + `min_angle`)
619 salome.sg.updateObjBrowser(1)
622 \section tui_warping Warping
625 import SMESH_mechanic
627 smesh = SMESH_mechanic.smesh
628 mesh = SMESH_mechanic.mesh
629 salome = SMESH_mechanic.salome
631 # Criterion : WARP ANGLE > 1e-15
634 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Warping, smesh.FT_MoreThan, wa_margin)
636 anIds = mesh.GetIdsFromFilter(aFilter)
639 print "Criterion: Warp > ", wa_margin, " Nb = ", len(anIds)
641 for i in range(len(anIds)):
642 if j > 20: j = 1; print ""
649 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Warp > " + `wa_margin`)
653 salome.sg.updateObjBrowser(1)
656 \section tui_skew Skew
659 import SMESH_mechanic
661 smesh = SMESH_mechanic.smesh
662 mesh = SMESH_mechanic.mesh
663 salome = SMESH_mechanic.salome
665 # Criterion : Skew > 38.
668 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, skew_margin)
670 anIds = mesh.GetIdsFromFilter(aFilter)
673 print "Criterion: Skew > ", skew_margin, " Nb = ", len(anIds)
675 for i in range(len(anIds)):
676 if j > 20: j = 1; print ""
683 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Skew > " + `skew_margin`)
686 salome.sg.updateObjBrowser(1)
689 \section tui_max_element_length_2d Element Diameter 2D
692 import SMESH_mechanic
694 smesh = SMESH_mechanic.smesh
695 mesh = SMESH_mechanic.mesh
696 salome = SMESH_mechanic.salome
698 # Criterion : ELEMENT DIAMETER 2D > 10
701 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength2D, smesh.FT_MoreThan, mel_2d_margin)
703 anIds = mesh.GetIdsFromFilter(aFilter)
706 print "Criterion: Element Diameter 2D Ratio > ", mel_2d_margin, " Nb = ", len(anIds)
708 for i in range(len(anIds)):
709 if j > 20: j = 1; print ""
716 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Element Diameter 2D > " + `mel_2d_margin`)
719 salome.sg.updateObjBrowser(1)
722 \section tui_aspect_ratio_3d Aspect Ratio 3D
725 import SMESH_mechanic_tetra
727 smesh = SMESH_mechanic_tetra.smesh
728 mesh = SMESH_mechanic_tetra.mesh
729 salome = SMESH_mechanic_tetra.salome
731 # Criterion : ASPECT RATIO 3D > 4.5
734 aFilter = smesh.GetFilter(smesh.VOLUME, smesh.FT_AspectRatio3D, smesh.FT_MoreThan, ar_margin)
736 anIds = mesh.GetIdsFromFilter(aFilter)
739 print "Criterion: Aspect Ratio 3D > ", ar_margin, " Nb = ", len(anIds)
741 for i in range(len(anIds)):
742 if j > 20: j = 1; print ""
749 aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, "Aspect Ratio 3D > " + `ar_margin`)
753 salome.sg.updateObjBrowser(1)
756 \section tui_volume Volume
759 import SMESH_mechanic_tetra
761 smesh = SMESH_mechanic_tetra.smesh
762 mesh = SMESH_mechanic_tetra.mesh
763 salome = SMESH_mechanic_tetra.salome
765 # Criterion : VOLUME < 7.
768 aFilter = smesh.GetFilter(smesh.VOLUME, smesh.FT_Volume3D, smesh.FT_LessThan, volume_margin)
770 anIds = mesh.GetIdsFromFilter(aFilter)
774 print "Criterion: Volume < ", volume_margin, " Nb = ", len(anIds)
776 for i in range(len(anIds)):
777 if j > 20: j = 1; print ""
784 aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, "Volume < " + `volume_margin`)
788 salome.sg.updateObjBrowser(1)
791 \section tui_max_element_length_3d Element Diameter 3D
794 import SMESH_mechanic_tetra
796 smesh = SMESH_mechanic_tetra.smesh
797 mesh = SMESH_mechanic_tetra.mesh
798 salome = SMESH_mechanic_tetra.salome
800 # Criterion : ELEMENT DIAMETER 3D > 10
803 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength3D, smesh.FT_MoreThan, mel_3d_margin)
805 anIds = mesh.GetIdsFromFilter(aFilter)
808 print "Criterion: Element Diameter 3D Ratio > ", mel_3d_margin, " Nb = ", len(anIds)
810 for i in range(len(anIds)):
811 if j > 20: j = 1; print ""
818 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Element Diameter 3D > " + `mel_3d_margin`)
821 salome.sg.updateObjBrowser(1)