7 from salome.geom
import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
10 import SMESH, SALOMEDS
11 from salome.smesh
import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
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")
22 mesh = smesh.Mesh(box,
"Mesh_free_borders")
24 algo.NumberOfSegments(5)
25 algo = mesh.Triangle()
26 algo.MaxElementArea(20.)
30 aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_FreeBorders)
31 anIds = mesh.GetIdsFromFilter(aFilter)
34 print "Criterion: Free borders Nb = ", len(anIds)
36 for i
in range(len(anIds)):
37 if j > 20: j = 1;
print ""
44 aGroup = mesh.GetMesh().CreateGroup(SMESH.EDGE,
"Free borders")
47 salome.sg.updateObjBrowser(
True)
7 from salome.geom
import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
10 import SMESH, SALOMEDS
11 from salome.smesh
import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
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")
22 mesh = smesh.Mesh(box,
"Mesh_borders_at_multi-connections")
24 algo.NumberOfSegments(5)
25 algo = mesh.Triangle()
26 algo.MaxElementArea(20.)
32 aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_MultiConnection, SMESH.FT_EqualTo, nb_conn)
33 anIds = mesh.GetIdsFromFilter(aFilter)
36 print "Criterion: Borders at multi-connections Nb = ", len(anIds)
38 for i
in range(len(anIds)):
39 if j > 20: j = 1;
print ""
46 aGroup = mesh.GetMesh().CreateGroup(SMESH.EDGE,
"Borders at multi-connections")
49 salome.sg.updateObjBrowser(
True)
7 from salome.geom
import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
10 import SMESH, SALOMEDS
11 from salome.smesh
import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
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")
22 mesh = smesh.Mesh(box,
"Mesh_Length_1D")
24 algo.NumberOfSegments(5)
25 algo = mesh.Triangle()
26 algo.MaxElementArea(20.)
32 aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_Length, SMESH.FT_MoreThan, length_margin)
33 anIds = mesh.GetIdsFromFilter(aFilter)
36 print "Criterion: Edges length > ", length_margin,
" Nb = ", len(anIds)
38 for i
in range(len(anIds)):
39 if j > 20: j = 1;
print ""
46 aGroup = mesh.GetMesh().CreateGroup(SMESH.EDGE,
"Edges with length > " + `length_margin`)
49 salome.sg.updateObjBrowser(
True)
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
10 aFilterMgr = smesh.CreateFilterManager()
16 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, area_margin)
18 anIds = mesh.GetIdsFromFilter(aFilter)
20 mesh.RemoveElements(anIds)
23 aBorders = mesh.GetFreeBorders()
26 aGroupF = mesh.CreateEmptyGroup(SMESH.FACE,
"Faces with free edges")
27 aGroupN = mesh.CreateEmptyGroup(SMESH.NODE,
"Nodes on free edges")
31 print "Criterion: Free edges Nb = ", len(aBorders)
32 for i
in range(len(aBorders)):
34 print "Face # ", aBorder.myElemId,
" : Edge between nodes (",
35 print aBorder.myPnt1,
", ", aBorder.myPnt2,
")"
37 aGroupF.Add([aBorder.myElemId])
38 aGroupN.Add([aBorder.myPnt1, aBorder.myPnt2])
40 salome.sg.updateObjBrowser(
True)
7 from salome.geom
import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
10 import SMESH, SALOMEDS
11 from salome.smesh
import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
15 box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
16 idbox = geompy.addToStudy(box,
"box")
19 mesh = smesh.Mesh(box,
"Mesh_free_nodes")
21 algo.NumberOfSegments(10)
22 algo = mesh.Triangle(smeshBuilder.MEFISTO)
23 algo.MaxElementArea(150.)
30 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, area_margin)
32 anIds = mesh.GetIdsFromFilter(aFilter)
34 mesh.RemoveElements(anIds)
37 aFilter = smesh.GetFilter(SMESH.NODE, SMESH.FT_FreeNodes)
38 anNodeIds = mesh.GetIdsFromFilter(aFilter)
41 aGroup = mesh.CreateEmptyGroup(SMESH.NODE,
"Free_nodes")
45 print "Criterion: Free nodes Nb = ", len(anNodeIds)
47 for i
in range(len(anNodeIds)):
48 if j > 20: j = 1;
print ""
54 salome.sg.updateObjBrowser(
True)
7 from salome.geom
import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
10 import SMESH, SALOMEDS
11 from salome.smesh
import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
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)
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)
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" )
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()
50 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_FreeFaces )
51 aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
53 aGroup = Mesh_1.CreateEmptyGroup(SMESH.FACE,
"Free_faces")
57 print "Criterion: Free faces Nb = ", len(aFaceIds)
59 for i
in range(len(aFaceIds)):
60 if j > 20: j = 1;
print ""
67 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BelongToPlane, Plane_2)
68 aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
69 aGroup.Remove(aFaceIds)
72 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BelongToPlane, Plane_1)
73 aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
75 aGroup = Mesh_1.CreateEmptyGroup(SMESH.FACE,
"Shared_faces")
78 salome.sg.updateObjBrowser(
True)
7 from salome.geom
import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
10 import SMESH, SALOMEDS
11 from salome.smesh
import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
13 import salome_notebook
16 box = geompy.MakeBoxDXDYDZ(100, 100, 100)
17 geompy.addToStudy( box,
"box" )
19 mesh = smesh.Mesh(box)
25 allFaces = mesh.GetElementsByType(SMESH.FACE)
26 mesh.RemoveElements( allFaces[0:2])
28 bareGroup = mesh.MakeGroup(
"bare faces", SMESH.FACE, SMESH.FT_BareBorderFace)
29 assert(bareGroup.Size() == 3)
7 from salome.geom
import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
10 import SMESH, SALOMEDS
11 from salome.smesh
import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
13 import salome_notebook
16 box = geompy.MakeBoxDXDYDZ(100, 30, 10)
18 face = geompy.SubShapeAllSorted( box, geompy.ShapeType[
"FACE"])[0]
20 geompy.addToStudy( box,
"box" )
21 geompy.addToStudyInFather( box, face,
"face" )
23 mesh = smesh.Mesh(box)
24 mesh.AutomaticHexahedralization();
27 faceFaces = mesh.GetSubMeshElementsId(face)
28 faceToRemove = faceFaces[: len(faceFaces)/2]
29 mesh.RemoveElements( faceToRemove )
32 bareGroup = mesh.MakeGroup(
"bare volumes", SMESH.VOLUME, SMESH.FT_BareBorderVolume)
33 assert(bareGroup.Size() == len( faceToRemove))
7 from salome.geom
import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
10 import SMESH, SALOMEDS
11 from salome.smesh
import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
13 import salome_notebook
17 faceFilter = smesh.GetFilter(SMESH.FACE,SMESH.FT_OverConstrainedFace)
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 ))
26 mesh.ExtrusionSweep([edge], smesh.MakeDirStruct(0,7,0), 5)
27 assert( 2 == len( mesh.GetIdsFromFilter( faceFilter )))
7 from salome.geom
import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
10 import SMESH, SALOMEDS
11 from salome.smesh
import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
13 import salome_notebook
17 volumeFilter = smesh.GetFilter(SMESH.VOLUME,SMESH.FT_OverConstrainedVolume)
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 )))
7 from salome.geom
import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
10 import SMESH, SALOMEDS
11 from salome.smesh
import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
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")
22 mesh = smesh.Mesh(box,
"Mesh_Length_2D")
24 algo.NumberOfSegments(5)
25 algo = mesh.Triangle()
26 algo.MaxElementArea(20.)
32 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Length2D, SMESH.FT_MoreThan, length_margin)
34 anIds = mesh.GetIdsFromFilter(aFilter)
37 print "Criterion: Edges length 2D > ", length_margin,
" Nb = ", len(anIds)
39 for i
in range(len(anIds)):
40 if j > 20: j = 1;
print ""
47 aGroup = mesh.CreateEmptyGroup(SMESH.FACE,
"Faces with length 2D > " + `length_margin`)
50 salome.sg.updateObjBrowser(
True)
7 from salome.geom
import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
10 import SMESH, SALOMEDS
11 from salome.smesh
import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
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")
22 mesh = smesh.Mesh(box,
"Box compound : 2D triangle mesh")
24 algo.NumberOfSegments(5)
25 algo = mesh.Triangle()
26 algo.MaxElementArea(20.)
32 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MultiConnection2D, SMESH.FT_EqualTo, nb_conn)
34 anIds = mesh.GetIdsFromFilter(aFilter)
37 print "Criterion: Borders at multi-connection 2D = ", nb_conn,
" Nb = ", len(anIds)
39 for i
in range(len(anIds)):
40 if j > 20: j = 1;
print ""
47 aGroup = mesh.CreateEmptyGroup(SMESH.FACE,
"Borders at multi-connection 2D = " + `nb_conn`)
50 salome.sg.updateObjBrowser(
True)
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
13 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, area_margin)
15 anIds = mesh.GetIdsFromFilter(aFilter)
18 print "Criterion: Area > ", area_margin,
" Nb = ", len(anIds)
20 for i
in range(len(anIds)):
21 if j > 20: j = 1;
print ""
28 aGroup = mesh.CreateEmptyGroup(SMESH.FACE,
"Area > " + `area_margin`)
31 salome.sg.updateObjBrowser(
True)
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
13 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Taper, SMESH.FT_MoreThan, taper_margin)
15 anIds = mesh.GetIdsFromFilter(aFilter)
18 print "Criterion: Taper > ", taper_margin,
" Nb = ", len(anIds)
20 for i
in range(len(anIds)):
21 if j > 20: j = 1;
print ""
28 aGroup = mesh.CreateEmptyGroup(SMESH.FACE,
"Taper > " + `taper_margin`)
31 salome.sg.updateObjBrowser(
True)
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
13 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, ar_margin)
15 anIds = mesh.GetIdsFromFilter(aFilter)
18 print "Criterion: Aspect Ratio > ", ar_margin,
" Nb = ", len(anIds)
20 for i
in range(len(anIds)):
21 if j > 20: j = 1;
print ""
28 aGroup = mesh.CreateEmptyGroup(SMESH.FACE,
"Aspect Ratio > " + `ar_margin`)
31 salome.sg.updateObjBrowser(
True)
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
13 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MinimumAngle, SMESH.FT_LessThan, min_angle)
15 anIds = mesh.GetIdsFromFilter(aFilter)
18 print "Criterion: Minimum Angle < ", min_angle,
" Nb = ", len(anIds)
20 for i
in range(len(anIds)):
21 if j > 20: j = 1;
print ""
28 aGroup = mesh.CreateEmptyGroup(SMESH.FACE,
"Minimum Angle < " + `min_angle`)
32 salome.sg.updateObjBrowser(
True)
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
13 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Warping, SMESH.FT_MoreThan, wa_margin)
15 anIds = mesh.GetIdsFromFilter(aFilter)
18 print "Criterion: Warp > ", wa_margin,
" Nb = ", len(anIds)
20 for i
in range(len(anIds)):
21 if j > 20: j = 1;
print ""
28 aGroup = mesh.CreateEmptyGroup(SMESH.FACE,
"Warp > " + `wa_margin`)
32 salome.sg.updateObjBrowser(
True)
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
13 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Skew, SMESH.FT_MoreThan, skew_margin)
15 anIds = mesh.GetIdsFromFilter(aFilter)
18 print "Criterion: Skew > ", skew_margin,
" Nb = ", len(anIds)
20 for i
in range(len(anIds)):
21 if j > 20: j = 1;
print ""
28 aGroup = mesh.CreateEmptyGroup(SMESH.FACE,
"Skew > " + `skew_margin`)
31 salome.sg.updateObjBrowser(
True)
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
13 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MaxElementLength2D, SMESH.FT_MoreThan, mel_2d_margin)
15 anIds = mesh.GetIdsFromFilter(aFilter)
18 print "Criterion: Element Diameter 2D Ratio > ", mel_2d_margin,
" Nb = ", len(anIds)
20 for i
in range(len(anIds)):
21 if j > 20: j = 1;
print ""
28 aGroup = mesh.CreateEmptyGroup(SMESH.FACE,
"Element Diameter 2D > " + `mel_2d_margin`)
31 salome.sg.updateObjBrowser(
True)
3 import SMESH_mechanic_tetra
6 smesh = SMESH_mechanic_tetra.smesh
7 mesh = SMESH_mechanic_tetra.mesh
8 salome = SMESH_mechanic_tetra.salome
13 aFilter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_AspectRatio3D, SMESH.FT_MoreThan, ar_margin)
15 anIds = mesh.GetIdsFromFilter(aFilter)
18 print "Criterion: Aspect Ratio 3D > ", ar_margin,
" Nb = ", len(anIds)
20 for i
in range(len(anIds)):
21 if j > 20: j = 1;
print ""
28 aGroup = mesh.CreateEmptyGroup(SMESH.VOLUME,
"Aspect Ratio 3D > " + `ar_margin`)
32 salome.sg.updateObjBrowser(
True)
3 import SMESH_mechanic_tetra
6 smesh = SMESH_mechanic_tetra.smesh
7 mesh = SMESH_mechanic_tetra.mesh
8 salome = SMESH_mechanic_tetra.salome
13 aFilter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_Volume3D, SMESH.FT_LessThan, volume_margin)
15 anIds = mesh.GetIdsFromFilter(aFilter)
19 print "Criterion: Volume < ", volume_margin,
" Nb = ", len(anIds)
21 for i
in range(len(anIds)):
22 if j > 20: j = 1;
print ""
29 aGroup = mesh.CreateEmptyGroup(SMESH.VOLUME,
"Volume < " + `volume_margin`)
33 salome.sg.updateObjBrowser(
True)
3 import SMESH_mechanic_tetra
6 smesh = SMESH_mechanic_tetra.smesh
7 mesh = SMESH_mechanic_tetra.mesh
8 salome = SMESH_mechanic_tetra.salome
13 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MaxElementLength3D, SMESH.FT_MoreThan, mel_3d_margin)
15 anIds = mesh.GetIdsFromFilter(aFilter)
18 print "Criterion: Element Diameter 3D Ratio > ", mel_3d_margin,
" Nb = ", len(anIds)
20 for i
in range(len(anIds)):
21 if j > 20: j = 1;
print ""
28 aGroup = mesh.CreateEmptyGroup(SMESH.FACE,
"Element Diameter 3D > " + `mel_3d_margin`)
31 salome.sg.updateObjBrowser(
True)