# Building a compound of meshes
-# Note: it is a copy of 'SMESH_BuildCompound.py' from SMESH_SWIG
import salome
-salome.salome_init()
-import GEOM
+salome.salome_init_without_session()
from salome.geom import geomBuilder
-geompy = geomBuilder.New(salome.myStudy)
-
-import SMESH, SALOMEDS
+geompy = geomBuilder.New()
from salome.smesh import smeshBuilder
-smesh = smeshBuilder.New(salome.myStudy)
+smesh = smeshBuilder.New()
## create a bottom box
Box_inf = geompy.MakeBox(0., 0., 0., 200., 200., 50.)
geompy.addToStudyInFather(Box_sup, Fsup2, "Fsup")
geompy.addToStudyInFather(Box_sup, Finf2, "Finf")
-smesh.SetCurrentStudy(salome.myStudy)
+smesh.UpdateStudy()
## create a bottom mesh
Mesh_inf = smesh.Mesh(Box_inf, "Mesh_inf")
Ginf2=Mesh_sup.Group(Finf2, "Inf")
## create compounds
-# create a compound of two meshes with renaming groups with the same names and
-# merging of elements with the given tolerance
-Compound1 = smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 0, 1, 1e-05)
-smesh.SetName(Compound1, 'Compound_with_RenamedGrps_and_MergeElems')
-# create a compound of two meshes with uniting groups with the same names and
+# create a compound of two meshes with renaming namesake groups and
+# merging elements with the given tolerance
+Compound1 = smesh.Concatenate([Mesh_inf, Mesh_sup], 0, 1, 1e-05,
+ name='Compound with RenamedGrps and MergeElems')
+# create a compound of two meshes with uniting namesake groups and
# creating groups of all elements
-Compound2 = smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 1, 0, 1e-05, True)
-smesh.SetName(Compound2, 'Compound_with_UniteGrps_and_GrpsOfAllElems')
+Compound2 = smesh.Concatenate([Mesh_inf, Mesh_sup], 1, 0, 1e-05, True,
+ name='Compound with UniteGrps and GrpsOfAllElems')
+
+# copy Gsup1 into a separate mesh and translate it
+groupMesh = Mesh_inf.TranslateObjectMakeMesh( Gsup1, [300,0,0] )
+
+# add Ginf2 to groupMesh
+smesh.Concatenate([Ginf2], False, meshToAppendTo = groupMesh )
+
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser()