1 # Building a compound of meshes
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
10 from salome.smesh import smeshBuilder
11 smesh = smeshBuilder.New(salome.myStudy)
13 ## create a bottom box
14 Box_inf = geompy.MakeBox(0., 0., 0., 200., 200., 50.)
17 Psup1=geompy.MakeVertex(100., 100., 50.)
18 Fsup1=geompy.GetFaceNearPoint(Box_inf, Psup1)
20 Pinf1=geompy.MakeVertex(100., 100., 0.)
21 Finf1=geompy.GetFaceNearPoint(Box_inf, Pinf1)
24 Box_sup = geompy.MakeBox(100., 100., 50., 200., 200., 100.)
27 Psup2=geompy.MakeVertex(150., 150., 100.)
28 Fsup2=geompy.GetFaceNearPoint(Box_sup, Psup2)
30 Pinf2=geompy.MakeVertex(150., 150., 50.)
31 Finf2=geompy.GetFaceNearPoint(Box_sup, Pinf2)
33 ## Publish in the study
34 geompy.addToStudy(Box_inf, "Box_inf")
35 geompy.addToStudyInFather(Box_inf, Fsup1, "Fsup")
36 geompy.addToStudyInFather(Box_inf, Finf1, "Finf")
38 geompy.addToStudy(Box_sup, "Box_sup")
39 geompy.addToStudyInFather(Box_sup, Fsup2, "Fsup")
40 geompy.addToStudyInFather(Box_sup, Finf2, "Finf")
42 smesh.SetCurrentStudy(salome.myStudy)
44 ## create a bottom mesh
45 Mesh_inf = smesh.Mesh(Box_inf, "Mesh_inf")
46 algo1D_1=Mesh_inf.Segment()
47 algo1D_1.NumberOfSegments(10)
48 algo2D_1=Mesh_inf.Quadrangle()
49 algo3D_1=Mesh_inf.Hexahedron()
52 # create a group on the top face
53 Gsup1=Mesh_inf.Group(Fsup1, "Sup")
54 # create a group on the bottom face
55 Ginf1=Mesh_inf.Group(Finf1, "Inf")
58 Mesh_sup = smesh.Mesh(Box_sup, "Mesh_sup")
59 algo1D_2=Mesh_sup.Segment()
60 algo1D_2.NumberOfSegments(5)
61 algo2D_2=Mesh_sup.Quadrangle()
62 algo3D_2=Mesh_sup.Hexahedron()
65 # create a group on the top face
66 Gsup2=Mesh_sup.Group(Fsup2, "Sup")
67 # create a group on the bottom face
68 Ginf2=Mesh_sup.Group(Finf2, "Inf")
71 # create a compound of two meshes with renaming namesake groups and
72 # merging of elements with the given tolerance
73 Compound1 = smesh.Concatenate([Mesh_inf, Mesh_sup], 0, 1, 1e-05,
74 name='Compound_with_RenamedGrps_and_MergeElems')
75 # create a compound of two meshes with uniting namesake groups and
76 # creating groups of all elements
77 Compound2 = smesh.Concatenate([Mesh_inf, Mesh_sup], 1, 0, 1e-05, True,
78 name='Compound_with_UniteGrps_and_GrpsOfAllElems')
80 if salome.sg.hasDesktop():
81 salome.sg.updateObjBrowser(1)