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 ######
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()
280 # create a group of free faces
281 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeFaces )
282 aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
284 aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Free_faces")
288 print "Criterion: Free nodes Nb = ", len(anNodeIds)
290 for i in range(len(aFaceIds)):
291 if j > 20: j = 1; print ""
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)
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)
306 aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Shared_faces")
309 salome.sg.updateObjBrowser(1)
312 \section tui_bare_border_faces Bare border faces
316 SetCurrentStudy(salome.myStudy)
318 box = geompy.MakeBoxDXDYDZ(100, 100, 100)
319 geompy.addToStudy( box, "box" )
321 mesh = smesh.Mesh(box)
322 mesh.Segment().NumberOfSegments(3)
327 allFaces = mesh.GetElementsByType(FACE)
328 mesh.RemoveElements( allFaces[0:2])
330 bareGroup = mesh.MakeGroup("bare faces", FACE, FT_BareBorderFace)
331 assert(bareGroup.Size() == 3)
334 \section tui_bare_border_volumes Bare border volumes
338 SetCurrentStudy(salome.myStudy)
340 box = geompy.MakeBoxDXDYDZ(100, 30, 10)
341 # the smallest face of the box
342 face = geompy.SubShapeAllSorted( box, geompy.ShapeType["FACE"])[0]
344 geompy.addToStudy( box, "box" )
345 geompy.addToStudyInFather( box, face, "face" )
348 mesh.AutomaticHexahedralization();
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 )
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))
360 \section tui_over_constrained_faces Over-constrained faces
363 SetCurrentStudy(salome.myStudy)
366 faceFilter = GetFilter(FACE,FT_OverConstrainedFace)
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 ))
375 mesh.ExtrusionSweep([edge], MakeDirStruct(0,7,0), 5)
376 assert( 2 == len( mesh.GetIdsFromFilter( faceFilter )))
379 \section tui_over_constrained_volumes Over-constrained volumes
382 SetCurrentStudy(salome.myStudy)
385 volumeFilter = GetFilter(VOLUME,FT_OverConstrainedVolume)
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 )))
396 \section tui_length_2d Length 2D
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")
412 mesh = smesh.Mesh(box, "Mesh_Length_2D")
413 algo = mesh.Segment()
414 algo.NumberOfSegments(5)
415 algo = mesh.Triangle()
416 algo.MaxElementArea(20.)
419 # Criterion : Length 2D > 5.7
422 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Length2D, smesh.FT_MoreThan, length_margin)
424 anIds = mesh.GetIdsFromFilter(aFilter)
427 print "Criterion: Edges length 2D > ", length_margin, " Nb = ", len(anIds)
429 for i in range(len(anIds)):
430 if j > 20: j = 1; print ""
437 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Faces with length 2D > " + `length_margin`)
440 salome.sg.updateObjBrowser(1)
443 \section tui_borders_at_multiconnection_2d Borders at Multiconnection 2D
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")
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.)
466 # Criterion : MULTI-CONNECTION 2D = 3
469 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MultiConnection2D, smesh.FT_EqualTo, nb_conn)
471 anIds = mesh.GetIdsFromFilter(aFilter)
474 print "Criterion: Borders at multi-connection 2D = ", nb_conn, " Nb = ", len(anIds)
476 for i in range(len(anIds)):
477 if j > 20: j = 1; print ""
484 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Borders at multi-connection 2D = " + `nb_conn`)
487 salome.sg.updateObjBrowser(1)
490 \section tui_area Area
493 import SMESH_mechanic
495 smesh = SMESH_mechanic.smesh
496 mesh = SMESH_mechanic.mesh
497 salome = SMESH_mechanic.salome
499 # Criterion : AREA > 100.
502 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, area_margin)
504 anIds = mesh.GetIdsFromFilter(aFilter)
507 print "Criterion: Area > ", area_margin, " Nb = ", len(anIds)
509 for i in range(len(anIds)):
510 if j > 20: j = 1; print ""
517 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Area > " + `area_margin`)
520 salome.sg.updateObjBrowser(1)
523 \section tui_taper Taper
526 import SMESH_mechanic
528 smesh = SMESH_mechanic.smesh
529 mesh = SMESH_mechanic.mesh
530 salome = SMESH_mechanic.salome
532 # Criterion : Taper > 3e-20
535 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Taper, smesh.FT_MoreThan, taper_margin)
537 anIds = mesh.GetIdsFromFilter(aFilter)
540 print "Criterion: Taper > ", taper_margin, " Nb = ", len(anIds)
542 for i in range(len(anIds)):
543 if j > 20: j = 1; print ""
550 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Taper > " + `taper_margin`)
553 salome.sg.updateObjBrowser(1)
556 \section tui_aspect_ratio Aspect Ratio
559 import SMESH_mechanic
561 smesh = SMESH_mechanic.smesh
562 mesh = SMESH_mechanic.mesh
563 salome = SMESH_mechanic.salome
565 # Criterion : ASPECT RATIO > 1.8
568 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, ar_margin)
570 anIds = mesh.GetIdsFromFilter(aFilter)
573 print "Criterion: Aspect Ratio > ", ar_margin, " Nb = ", len(anIds)
575 for i in range(len(anIds)):
576 if j > 20: j = 1; print ""
583 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Aspect Ratio > " + `ar_margin`)
586 salome.sg.updateObjBrowser(1)
589 \section tui_minimum_angle Minimum Angle
592 import SMESH_mechanic
594 smesh = SMESH_mechanic.smesh
595 mesh = SMESH_mechanic.mesh
596 salome = SMESH_mechanic.salome
598 # Criterion : MINIMUM ANGLE < 35.
601 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MinimumAngle, smesh.FT_LessThan, min_angle)
603 anIds = mesh.GetIdsFromFilter(aFilter)
606 print "Criterion: Minimum Angle < ", min_angle, " Nb = ", len(anIds)
608 for i in range(len(anIds)):
609 if j > 20: j = 1; print ""
616 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Minimum Angle < " + `min_angle`)
620 salome.sg.updateObjBrowser(1)
623 \section tui_warping Warping
626 import SMESH_mechanic
628 smesh = SMESH_mechanic.smesh
629 mesh = SMESH_mechanic.mesh
630 salome = SMESH_mechanic.salome
632 # Criterion : WARP ANGLE > 1e-15
635 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Warping, smesh.FT_MoreThan, wa_margin)
637 anIds = mesh.GetIdsFromFilter(aFilter)
640 print "Criterion: Warp > ", wa_margin, " Nb = ", len(anIds)
642 for i in range(len(anIds)):
643 if j > 20: j = 1; print ""
650 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Warp > " + `wa_margin`)
654 salome.sg.updateObjBrowser(1)
657 \section tui_skew Skew
660 import SMESH_mechanic
662 smesh = SMESH_mechanic.smesh
663 mesh = SMESH_mechanic.mesh
664 salome = SMESH_mechanic.salome
666 # Criterion : Skew > 38.
669 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, skew_margin)
671 anIds = mesh.GetIdsFromFilter(aFilter)
674 print "Criterion: Skew > ", skew_margin, " Nb = ", len(anIds)
676 for i in range(len(anIds)):
677 if j > 20: j = 1; print ""
684 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Skew > " + `skew_margin`)
687 salome.sg.updateObjBrowser(1)
690 \section tui_max_element_length_2d Element Diameter 2D
693 import SMESH_mechanic
695 smesh = SMESH_mechanic.smesh
696 mesh = SMESH_mechanic.mesh
697 salome = SMESH_mechanic.salome
699 # Criterion : ELEMENT DIAMETER 2D > 10
702 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength2D, smesh.FT_MoreThan, mel_2d_margin)
704 anIds = mesh.GetIdsFromFilter(aFilter)
707 print "Criterion: Element Diameter 2D Ratio > ", mel_2d_margin, " Nb = ", len(anIds)
709 for i in range(len(anIds)):
710 if j > 20: j = 1; print ""
717 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Element Diameter 2D > " + `mel_2d_margin`)
720 salome.sg.updateObjBrowser(1)
723 \section tui_aspect_ratio_3d Aspect Ratio 3D
726 import SMESH_mechanic_tetra
728 smesh = SMESH_mechanic_tetra.smesh
729 mesh = SMESH_mechanic_tetra.mesh
730 salome = SMESH_mechanic_tetra.salome
732 # Criterion : ASPECT RATIO 3D > 4.5
735 aFilter = smesh.GetFilter(smesh.VOLUME, smesh.FT_AspectRatio3D, smesh.FT_MoreThan, ar_margin)
737 anIds = mesh.GetIdsFromFilter(aFilter)
740 print "Criterion: Aspect Ratio 3D > ", ar_margin, " Nb = ", len(anIds)
742 for i in range(len(anIds)):
743 if j > 20: j = 1; print ""
750 aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, "Aspect Ratio 3D > " + `ar_margin`)
754 salome.sg.updateObjBrowser(1)
757 \section tui_volume Volume
760 import SMESH_mechanic_tetra
762 smesh = SMESH_mechanic_tetra.smesh
763 mesh = SMESH_mechanic_tetra.mesh
764 salome = SMESH_mechanic_tetra.salome
766 # Criterion : VOLUME < 7.
769 aFilter = smesh.GetFilter(smesh.VOLUME, smesh.FT_Volume3D, smesh.FT_LessThan, volume_margin)
771 anIds = mesh.GetIdsFromFilter(aFilter)
775 print "Criterion: Volume < ", volume_margin, " Nb = ", len(anIds)
777 for i in range(len(anIds)):
778 if j > 20: j = 1; print ""
785 aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, "Volume < " + `volume_margin`)
789 salome.sg.updateObjBrowser(1)
792 \section tui_max_element_length_3d Element Diameter 3D
795 import SMESH_mechanic_tetra
797 smesh = SMESH_mechanic_tetra.smesh
798 mesh = SMESH_mechanic_tetra.mesh
799 salome = SMESH_mechanic_tetra.salome
801 # Criterion : ELEMENT DIAMETER 3D > 10
804 aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength3D, smesh.FT_MoreThan, mel_3d_margin)
806 anIds = mesh.GetIdsFromFilter(aFilter)
809 print "Criterion: Element Diameter 3D Ratio > ", mel_3d_margin, " Nb = ", len(anIds)
811 for i in range(len(anIds)):
812 if j > 20: j = 1; print ""
819 aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Element Diameter 3D > " + `mel_3d_margin`)
822 salome.sg.updateObjBrowser(1)