Version: 8.3.0
 All Classes Namespaces Files Functions Variables Groups Pages
Quality Controls

Free Borders

1 # Free Borders
2 
3 
4 import salome
5 salome.salome_init()
6 import GEOM
7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
9 
10 import SMESH, SALOMEDS
11 from salome.smesh import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
13 
14 # create open shell: a box without one plane
15 box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
16 FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
17 FaceList.remove(FaceList[5])
18 box = geompy.MakeShell(FaceList)
19 idbox = geompy.addToStudy(box, "box")
20 
21 # create a mesh
22 mesh = smesh.Mesh(box, "Mesh_free_borders")
23 algo = mesh.Segment()
24 algo.NumberOfSegments(5)
25 algo = mesh.Triangle()
26 algo.MaxElementArea(20.)
27 mesh.Compute()
28 
29 # criterion : free borders
30 aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_FreeBorders)
31 anIds = mesh.GetIdsFromFilter(aFilter)
32 
33 # print the result
34 print "Criterion: Free borders Nb = ", len(anIds)
35 j = 1
36 for i in range(len(anIds)):
37  if j > 20: j = 1; print ""
38  print anIds[i],
39  j = j + 1
40  pass
41 print ""
42 
43 # create a group
44 aGroup = mesh.GetMesh().CreateGroup(SMESH.EDGE, "Free borders")
45 aGroup.Add(anIds)
46 
47 salome.sg.updateObjBrowser(True)

Download this script

Borders at Multiconnection

1 # Borders at Multiconnection
2 
3 
4 import salome
5 salome.salome_init()
6 import GEOM
7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
9 
10 import SMESH, SALOMEDS
11 from salome.smesh import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
13 
14 # create open shell: a box without one plane
15 box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
16 FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
17 FaceList.remove(FaceList[5])
18 box = geompy.MakeShell(FaceList)
19 idbox = geompy.addToStudy(box, "box")
20 
21 # create a mesh
22 mesh = smesh.Mesh(box, "Mesh_borders_at_multi-connections")
23 algo = mesh.Segment()
24 algo.NumberOfSegments(5)
25 algo = mesh.Triangle()
26 algo.MaxElementArea(20.)
27 mesh.Compute()
28 
29 # Criterion : Borders at multi-connection
30 nb_conn = 2
31 
32 aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_MultiConnection, SMESH.FT_EqualTo, nb_conn)
33 anIds = mesh.GetIdsFromFilter(aFilter)
34 
35 # print the result
36 print "Criterion: Borders at multi-connections Nb = ", len(anIds)
37 j = 1
38 for i in range(len(anIds)):
39  if j > 20: j = 1; print ""
40  print anIds[i],
41  j = j + 1
42  pass
43 print ""
44 
45 # create a group
46 aGroup = mesh.GetMesh().CreateGroup(SMESH.EDGE, "Borders at multi-connections")
47 aGroup.Add(anIds)
48 
49 salome.sg.updateObjBrowser(True)

Download this script

Length 1D

1 # Length 1D
2 
3 
4 import salome
5 salome.salome_init()
6 import GEOM
7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
9 
10 import SMESH, SALOMEDS
11 from salome.smesh import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
13 
14 # create open shell: a box without one plane
15 box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
16 FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
17 FaceList.remove(FaceList[5])
18 box = geompy.MakeShell(FaceList)
19 idbox = geompy.addToStudy(box, "box")
20 
21 # create a mesh
22 mesh = smesh.Mesh(box, "Mesh_Length_1D")
23 algo = mesh.Segment()
24 algo.NumberOfSegments(5)
25 algo = mesh.Triangle()
26 algo.MaxElementArea(20.)
27 mesh.Compute()
28 
29 # Criterion : Length > 3.
30 length_margin = 3.
31 
32 aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_Length, SMESH.FT_MoreThan, length_margin)
33 anIds = mesh.GetIdsFromFilter(aFilter)
34 
35 # print the result
36 print "Criterion: Edges length > ", length_margin, " Nb = ", len(anIds)
37 j = 1
38 for i in range(len(anIds)):
39  if j > 20: j = 1; print ""
40  print anIds[i],
41  j = j + 1
42  pass
43 print ""
44 
45 # create a group
46 aGroup = mesh.GetMesh().CreateGroup(SMESH.EDGE, "Edges with length > " + `length_margin`)
47 aGroup.Add(anIds)
48 
49 salome.sg.updateObjBrowser(True)

Download this script

Free Edges

1 # Free Edges
2 
3 import SMESH_mechanic
4 import SMESH
5 
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
9 
10 aFilterMgr = smesh.CreateFilterManager()
11 
12 # Remove some elements to obtain free edges
13 # Criterion : AREA > 95.
14 area_margin = 95.
15 
16 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, area_margin)
17 
18 anIds = mesh.GetIdsFromFilter(aFilter)
19 
20 mesh.RemoveElements(anIds)
21 
22 # Criterion : Free Edges
23 aBorders = mesh.GetFreeBorders()
24 
25 # create groups
26 aGroupF = mesh.CreateEmptyGroup(SMESH.FACE, "Faces with free edges")
27 aGroupN = mesh.CreateEmptyGroup(SMESH.NODE, "Nodes on free edges")
28 
29 # fill groups with elements, corresponding to the criterion
30 print ""
31 print "Criterion: Free edges Nb = ", len(aBorders)
32 for i in range(len(aBorders)):
33  aBorder = aBorders[i]
34  print "Face # ", aBorder.myElemId, " : Edge between nodes (",
35  print aBorder.myPnt1, ", ", aBorder.myPnt2, ")"
36 
37  aGroupF.Add([aBorder.myElemId])
38  aGroupN.Add([aBorder.myPnt1, aBorder.myPnt2])
39 
40 salome.sg.updateObjBrowser(True)

Download this script

Free Nodes

1 # Free Nodes
2 
3 
4 import salome
5 salome.salome_init()
6 import GEOM
7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
9 
10 import SMESH, SALOMEDS
11 from salome.smesh import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
13 
14 # create box
15 box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
16 idbox = geompy.addToStudy(box, "box")
17 
18 # create a mesh
19 mesh = smesh.Mesh(box, "Mesh_free_nodes")
20 algo = mesh.Segment()
21 algo.NumberOfSegments(10)
22 algo = mesh.Triangle(smeshBuilder.MEFISTO)
23 algo.MaxElementArea(150.)
24 mesh.Compute()
25 
26 # Remove some elements to obtain free nodes
27 # Criterion : AREA < 80.
28 area_margin = 80.
29 
30 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, area_margin)
31 
32 anIds = mesh.GetIdsFromFilter(aFilter)
33 
34 mesh.RemoveElements(anIds)
35 
36 # criterion : free nodes
37 aFilter = smesh.GetFilter(SMESH.NODE, SMESH.FT_FreeNodes)
38 anNodeIds = mesh.GetIdsFromFilter(aFilter)
39 
40 # create a group
41 aGroup = mesh.CreateEmptyGroup(SMESH.NODE, "Free_nodes")
42 aGroup.Add(anNodeIds)
43 
44 # print the result
45 print "Criterion: Free nodes Nb = ", len(anNodeIds)
46 j = 1
47 for i in range(len(anNodeIds)):
48  if j > 20: j = 1; print ""
49  print anNodeIds[i],
50  j = j + 1
51  pass
52 print ""
53 
54 salome.sg.updateObjBrowser(True)

Download this script

Free Faces

1 # Free Faces
2 
3 
4 import salome
5 salome.salome_init()
6 import GEOM
7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
9 
10 import SMESH, SALOMEDS
11 from salome.smesh import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
13 
14 ####### GEOM part ########
15 
16 Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
17 Box_1_vertex_6 = geompy.GetSubShape(Box_1, [6])
18 Box_1 = geompy.GetMainShape(Box_1_vertex_6)
19 Box_1_vertex_16 = geompy.GetSubShape(Box_1, [16])
20 Box_1 = geompy.GetMainShape(Box_1_vertex_16)
21 Box_1_vertex_11 = geompy.GetSubShape(Box_1, [11])
22 Box_1 = geompy.GetMainShape(Box_1_vertex_11)
23 Plane_1 = geompy.MakePlaneThreePnt(Box_1_vertex_6, Box_1_vertex_16, Box_1_vertex_11, 2000)
24 Partition_1 = geompy.MakePartition([Box_1], [Plane_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
25 
26 Box_1_vertex_19 = geompy.GetSubShape(Box_1, [19])
27 Box_1_vertex_21 = geompy.GetSubShape(Box_1, [21])
28 Plane_2 = geompy.MakePlaneThreePnt(Box_1_vertex_16, Box_1_vertex_19, Box_1_vertex_21, 2000)
29 
30 geompy.addToStudy( Box_1, "Box_1" )
31 geompy.addToStudyInFather( Box_1, Box_1_vertex_6, "Box_1:vertex_6" )
32 geompy.addToStudyInFather( Box_1, Box_1_vertex_16, "Box_1:vertex_16" )
33 geompy.addToStudyInFather( Box_1, Box_1_vertex_11, "Box_1:vertex_11" )
34 geompy.addToStudy( Plane_1, "Plane_1" )
35 geompy.addToStudy( Partition_1, "Partition_1" )
36 geompy.addToStudyInFather( Box_1, Box_1_vertex_19, "Box_1:vertex_19" )
37 geompy.addToStudyInFather( Box_1, Box_1_vertex_21, "Box_1:vertex_21" )
38 geompy.addToStudy( Plane_2, "Plane_2" )
39 
40 ###### SMESH part ######
41 
42 Mesh_1 = smesh.Mesh(Partition_1)
43 Regular_1D = Mesh_1.Segment()
44 Max_Size_1 = Regular_1D.MaxSize(34.641)
45 MEFISTO_2D = Mesh_1.Triangle()
46 Tetrahedronn = Mesh_1.Tetrahedron()
47 isDone = Mesh_1.Compute()
48 
49 # create a group of free faces
50 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_FreeFaces )
51 aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
52 
53 aGroup = Mesh_1.CreateEmptyGroup(SMESH.FACE, "Free_faces")
54 aGroup.Add(aFaceIds)
55 
56 # print the result
57 print "Criterion: Free faces Nb = ", len(aFaceIds)
58 j = 1
59 for i in range(len(aFaceIds)):
60  if j > 20: j = 1; print ""
61  print aFaceIds[i],
62  j = j + 1
63  pass
64 print ""
65 
66 #filter faces from plane 2
67 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BelongToPlane, Plane_2)
68 aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
69 aGroup.Remove(aFaceIds)
70 
71 # create a group of shared faces (located on partition boundary inside box)
72 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BelongToPlane, Plane_1)
73 aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
74 
75 aGroup = Mesh_1.CreateEmptyGroup(SMESH.FACE, "Shared_faces")
76 aGroup.Add(aFaceIds)
77 
78 salome.sg.updateObjBrowser(True)

Download this script

Bare border faces

1 # Bare border faces
2 
3 
4 import salome
5 salome.salome_init()
6 import GEOM
7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
9 
10 import SMESH, SALOMEDS
11 from salome.smesh import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
13 import salome_notebook
14 
15 
16 box = geompy.MakeBoxDXDYDZ(100, 100, 100)
17 geompy.addToStudy( box, "box" )
18 
19 mesh = smesh.Mesh(box)
20 mesh.Segment().NumberOfSegments(3)
21 mesh.Quadrangle()
22 mesh.Compute()
23 
24 # remove 2 faces
25 allFaces = mesh.GetElementsByType(SMESH.FACE)
26 mesh.RemoveElements( allFaces[0:2])
27 
28 bareGroup = mesh.MakeGroup("bare faces", SMESH.FACE, SMESH.FT_BareBorderFace)
29 assert(bareGroup.Size() == 3)

Download this script

Bare border volumes

1 # Bare border volumes
2 
3 
4 import salome
5 salome.salome_init()
6 import GEOM
7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
9 
10 import SMESH, SALOMEDS
11 from salome.smesh import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
13 import salome_notebook
14 
15 
16 box = geompy.MakeBoxDXDYDZ(100, 30, 10)
17 # the smallest face of the box
18 face = geompy.SubShapeAllSorted( box, geompy.ShapeType["FACE"])[0]
19 
20 geompy.addToStudy( box, "box" )
21 geompy.addToStudyInFather( box, face, "face" )
22 
23 mesh = smesh.Mesh(box)
24 mesh.AutomaticHexahedralization();
25 
26 # remove half of mesh faces from the smallest face
27 faceFaces = mesh.GetSubMeshElementsId(face)
28 faceToRemove = faceFaces[: len(faceFaces)/2]
29 mesh.RemoveElements( faceToRemove )
30 
31 # make a group of volumes missing the removed faces
32 bareGroup = mesh.MakeGroup("bare volumes", SMESH.VOLUME, SMESH.FT_BareBorderVolume)
33 assert(bareGroup.Size() == len( faceToRemove))

Download this script

Over-constrained faces

1 # Over-constrained faces
2 
3 
4 import salome
5 salome.salome_init()
6 import GEOM
7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
9 
10 import SMESH, SALOMEDS
11 from salome.smesh import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
13 import salome_notebook
14 
15 
16 mesh = smesh.Mesh()
17 faceFilter = smesh.GetFilter(SMESH.FACE,SMESH.FT_OverConstrainedFace)
18 
19 #make an edge
20 n1 = mesh.AddNode(0,0,0)
21 n2 = mesh.AddNode(10,0,0)
22 edge = mesh.AddEdge([n1,n2])
23 assert( not mesh.GetIdsFromFilter( faceFilter ))
24 
25 # make faces
26 mesh.ExtrusionSweep([edge], smesh.MakeDirStruct(0,7,0), 5)
27 assert( 2 == len( mesh.GetIdsFromFilter( faceFilter )))

Download this script

Over-constrained volumes

1 # Over-constrained volumes
2 
3 
4 import salome
5 salome.salome_init()
6 import GEOM
7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
9 
10 import SMESH, SALOMEDS
11 from salome.smesh import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
13 import salome_notebook
14 
15 
16 mesh = smesh.Mesh()
17 volumeFilter = smesh.GetFilter(SMESH.VOLUME,SMESH.FT_OverConstrainedVolume)
18 
19 # make volumes by extrusion of one face
20 n1 = mesh.AddNode(0,0,0)
21 n2 = mesh.AddNode(10,0,0)
22 edge = mesh.AddEdge([n1,n2])
23 mesh.ExtrusionSweep([edge], smesh.MakeDirStruct(0,7,0), 1)
24 mesh.ExtrusionSweep( mesh.GetElementsByType(SMESH.FACE), smesh.MakeDirStruct(0,0,5), 7)
25 assert( 2 == len( mesh.GetIdsFromFilter( volumeFilter )))

Download this script

Length 2D

1 # Length 2D
2 
3 
4 import salome
5 salome.salome_init()
6 import GEOM
7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
9 
10 import SMESH, SALOMEDS
11 from salome.smesh import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
13 
14 # create open shell: a box without one plane
15 box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
16 FaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
17 FaceList.remove(FaceList[5])
18 box = geompy.MakeShell(FaceList)
19 idbox = geompy.addToStudy(box, "box")
20 
21 # create a mesh
22 mesh = smesh.Mesh(box, "Mesh_Length_2D")
23 algo = mesh.Segment()
24 algo.NumberOfSegments(5)
25 algo = mesh.Triangle()
26 algo.MaxElementArea(20.)
27 mesh.Compute()
28 
29 # Criterion : Length 2D > 5.7
30 length_margin = 5.7
31 
32 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Length2D, SMESH.FT_MoreThan, length_margin)
33 
34 anIds = mesh.GetIdsFromFilter(aFilter)
35 
36 # print the result
37 print "Criterion: Edges length 2D > ", length_margin, " Nb = ", len(anIds)
38 j = 1
39 for i in range(len(anIds)):
40  if j > 20: j = 1; print ""
41  print anIds[i],
42  j = j + 1
43  pass
44 print ""
45 
46 # create a group
47 aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Faces with length 2D > " + `length_margin`)
48 aGroup.Add(anIds)
49 
50 salome.sg.updateObjBrowser(True)

Download this script

Borders at Multiconnection 2D

1 # Borders at Multiconnection 2D
2 
3 
4 import salome
5 salome.salome_init()
6 import GEOM
7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
9 
10 import SMESH, SALOMEDS
11 from salome.smesh import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
13 
14 # create a compound of two glued boxes
15 box1 = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
16 box2 = geompy.MakeTranslation(box1, 0., 20., 0)
17 comp = geompy.MakeCompound([box1, box2])
18 box = geompy.MakeGlueFaces(comp, 0.000001)
19 idbox = geompy.addToStudy(box, "box")
20 
21 # create a mesh
22 mesh = smesh.Mesh(box, "Box compound : 2D triangle mesh")
23 algo = mesh.Segment()
24 algo.NumberOfSegments(5)
25 algo = mesh.Triangle()
26 algo.MaxElementArea(20.)
27 mesh.Compute()
28 
29 # Criterion : MULTI-CONNECTION 2D = 3
30 nb_conn = 3
31 
32 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MultiConnection2D, SMESH.FT_EqualTo, nb_conn)
33 
34 anIds = mesh.GetIdsFromFilter(aFilter)
35 
36 # print the result
37 print "Criterion: Borders at multi-connection 2D = ", nb_conn, " Nb = ", len(anIds)
38 j = 1
39 for i in range(len(anIds)):
40  if j > 20: j = 1; print ""
41  print anIds[i],
42  j = j + 1
43  pass
44 print ""
45 
46 # create a group
47 aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Borders at multi-connection 2D = " + `nb_conn`)
48 aGroup.Add(anIds)
49 
50 salome.sg.updateObjBrowser(True)

Download this script

Area

1 # Area
2 
3 import SMESH_mechanic
4 import SMESH
5 
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
9 
10 # Criterion : AREA > 100.
11 area_margin = 100.
12 
13 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, area_margin)
14 
15 anIds = mesh.GetIdsFromFilter(aFilter)
16 
17 # print the result
18 print "Criterion: Area > ", area_margin, " Nb = ", len(anIds)
19 j = 1
20 for i in range(len(anIds)):
21  if j > 20: j = 1; print ""
22  print anIds[i],
23  j = j + 1
24  pass
25 print ""
26 
27 # create a group
28 aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Area > " + `area_margin`)
29 aGroup.Add(anIds)
30 
31 salome.sg.updateObjBrowser(True)

Download this script

Taper

1 # Taper
2 
3 import SMESH_mechanic
4 import SMESH
5 
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
9 
10 # Criterion : Taper > 3e-20
11 taper_margin = 3e-20
12 
13 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Taper, SMESH.FT_MoreThan, taper_margin)
14 
15 anIds = mesh.GetIdsFromFilter(aFilter)
16 
17 # print the result
18 print "Criterion: Taper > ", taper_margin, " Nb = ", len(anIds)
19 j = 1
20 for i in range(len(anIds)):
21  if j > 20: j = 1; print ""
22  print anIds[i],
23  j = j + 1
24  pass
25 print ""
26 
27 # create a group
28 aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Taper > " + `taper_margin`)
29 aGroup.Add(anIds)
30 
31 salome.sg.updateObjBrowser(True)

Download this script

Aspect Ratio

1 # Aspect Ratio
2 
3 import SMESH_mechanic
4 import SMESH
5 
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
9 
10 # Criterion : ASPECT RATIO > 1.8
11 ar_margin = 1.8
12 
13 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, ar_margin)
14 
15 anIds = mesh.GetIdsFromFilter(aFilter)
16 
17 # print the result
18 print "Criterion: Aspect Ratio > ", ar_margin, " Nb = ", len(anIds)
19 j = 1
20 for i in range(len(anIds)):
21  if j > 20: j = 1; print ""
22  print anIds[i],
23  j = j + 1
24  pass
25 print ""
26 
27 # create a group
28 aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Aspect Ratio > " + `ar_margin`)
29 aGroup.Add(anIds)
30 
31 salome.sg.updateObjBrowser(True)

Download this script

Minimum Angle

1 # Minimum Angle
2 
3 import SMESH_mechanic
4 import SMESH
5 
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
9 
10 # Criterion : MINIMUM ANGLE < 35.
11 min_angle = 35.
12 
13 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MinimumAngle, SMESH.FT_LessThan, min_angle)
14 
15 anIds = mesh.GetIdsFromFilter(aFilter)
16 
17 # print the result
18 print "Criterion: Minimum Angle < ", min_angle, " Nb = ", len(anIds)
19 j = 1
20 for i in range(len(anIds)):
21  if j > 20: j = 1; print ""
22  print anIds[i],
23  j = j + 1
24  pass
25 print ""
26 
27 # create a group
28 aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Minimum Angle < " + `min_angle`)
29 
30 aGroup.Add(anIds)
31 
32 salome.sg.updateObjBrowser(True)

Download this script

Warping

1 # Warping
2 
3 import SMESH_mechanic
4 import SMESH
5 
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
9 
10 # Criterion : WARP ANGLE > 1e-15
11 wa_margin = 1e-15
12 
13 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Warping, SMESH.FT_MoreThan, wa_margin)
14 
15 anIds = mesh.GetIdsFromFilter(aFilter)
16 
17 # print the result
18 print "Criterion: Warp > ", wa_margin, " Nb = ", len(anIds)
19 j = 1
20 for i in range(len(anIds)):
21  if j > 20: j = 1; print ""
22  print anIds[i],
23  j = j + 1
24  pass
25 print ""
26 
27 # create a group
28 aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Warp > " + `wa_margin`)
29 
30 aGroup.Add(anIds)
31 
32 salome.sg.updateObjBrowser(True)

Download this script

Skew

1 # Skew
2 
3 import SMESH_mechanic
4 import SMESH
5 
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
9 
10 # Criterion : Skew > 38.
11 skew_margin = 38.
12 
13 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Skew, SMESH.FT_MoreThan, skew_margin)
14 
15 anIds = mesh.GetIdsFromFilter(aFilter)
16 
17 # print the result
18 print "Criterion: Skew > ", skew_margin, " Nb = ", len(anIds)
19 j = 1
20 for i in range(len(anIds)):
21  if j > 20: j = 1; print ""
22  print anIds[i],
23  j = j + 1
24  pass
25 print ""
26 
27 # create a group
28 aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Skew > " + `skew_margin`)
29 aGroup.Add(anIds)
30 
31 salome.sg.updateObjBrowser(True)

Download this script

Element Diameter 2D

1 # Element Diameter 2D
2 
3 import SMESH_mechanic
4 import SMESH
5 
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
9 
10 # Criterion : ELEMENT DIAMETER 2D > 10
11 mel_2d_margin = 10
12 
13 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MaxElementLength2D, SMESH.FT_MoreThan, mel_2d_margin)
14 
15 anIds = mesh.GetIdsFromFilter(aFilter)
16 
17 # print the result
18 print "Criterion: Element Diameter 2D Ratio > ", mel_2d_margin, " Nb = ", len(anIds)
19 j = 1
20 for i in range(len(anIds)):
21  if j > 20: j = 1; print ""
22  print anIds[i],
23  j = j + 1
24  pass
25 print ""
26 
27 # create a group
28 aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Element Diameter 2D > " + `mel_2d_margin`)
29 aGroup.Add(anIds)
30 
31 salome.sg.updateObjBrowser(True)

Download this script

Aspect Ratio 3D

1 # Aspect Ratio 3D
2 
3 import SMESH_mechanic_tetra
4 import SMESH
5 
6 smesh = SMESH_mechanic_tetra.smesh
7 mesh = SMESH_mechanic_tetra.mesh
8 salome = SMESH_mechanic_tetra.salome
9 
10 # Criterion : ASPECT RATIO 3D > 4.5
11 ar_margin = 4.5
12 
13 aFilter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_AspectRatio3D, SMESH.FT_MoreThan, ar_margin)
14 
15 anIds = mesh.GetIdsFromFilter(aFilter)
16 
17 # print the result
18 print "Criterion: Aspect Ratio 3D > ", ar_margin, " Nb = ", len(anIds)
19 j = 1
20 for i in range(len(anIds)):
21  if j > 20: j = 1; print ""
22  print anIds[i],
23  j = j + 1
24  pass
25 print ""
26 
27 # create a group
28 aGroup = mesh.CreateEmptyGroup(SMESH.VOLUME, "Aspect Ratio 3D > " + `ar_margin`)
29 
30 aGroup.Add(anIds)
31 
32 salome.sg.updateObjBrowser(True)

Download this script

Volume

1 # Volume
2 
3 import SMESH_mechanic_tetra
4 import SMESH
5 
6 smesh = SMESH_mechanic_tetra.smesh
7 mesh = SMESH_mechanic_tetra.mesh
8 salome = SMESH_mechanic_tetra.salome
9 
10 # Criterion : VOLUME < 7.
11 volume_margin = 7.
12 
13 aFilter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_Volume3D, SMESH.FT_LessThan, volume_margin)
14 
15 anIds = mesh.GetIdsFromFilter(aFilter)
16 
17 # print the result
18 print ""
19 print "Criterion: Volume < ", volume_margin, " Nb = ", len(anIds)
20 j = 1
21 for i in range(len(anIds)):
22  if j > 20: j = 1; print ""
23  print anIds[i],
24  j = j + 1
25  pass
26 print ""
27 
28 # create a group
29 aGroup = mesh.CreateEmptyGroup(SMESH.VOLUME, "Volume < " + `volume_margin`)
30 
31 aGroup.Add(anIds)
32 
33 salome.sg.updateObjBrowser(True)

Download this script

Element Diameter 3D

1 # Element Diameter 3D
2 
3 import SMESH_mechanic_tetra
4 import SMESH
5 
6 smesh = SMESH_mechanic_tetra.smesh
7 mesh = SMESH_mechanic_tetra.mesh
8 salome = SMESH_mechanic_tetra.salome
9 
10 # Criterion : ELEMENT DIAMETER 3D > 10
11 mel_3d_margin = 10
12 
13 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MaxElementLength3D, SMESH.FT_MoreThan, mel_3d_margin)
14 
15 anIds = mesh.GetIdsFromFilter(aFilter)
16 
17 # print the result
18 print "Criterion: Element Diameter 3D Ratio > ", mel_3d_margin, " Nb = ", len(anIds)
19 j = 1
20 for i in range(len(anIds)):
21  if j > 20: j = 1; print ""
22  print anIds[i],
23  j = j + 1
24  pass
25 print ""
26 
27 # create a group
28 aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Element Diameter 3D > " + `mel_3d_margin`)
29 aGroup.Add(anIds)
30 
31 salome.sg.updateObjBrowser(True)

Download this script