X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=doc%2Fsalome%2Fexamples%2Fcreating_meshes_ex07.py;h=f18109cda9e428b8a189eb461b5534e197abe3bf;hb=c95703cd85338060f1f7f4405c0859b14a713423;hp=3b003961eeda009be9b6eb9196ac29871c25c56d;hpb=bb40f7c1d3542da1ff59b6c3bface0574789dded;p=modules%2Fsmesh.git diff --git a/doc/salome/examples/creating_meshes_ex07.py b/doc/salome/examples/creating_meshes_ex07.py index 3b003961e..f18109cda 100644 --- a/doc/salome/examples/creating_meshes_ex07.py +++ b/doc/salome/examples/creating_meshes_ex07.py @@ -1,14 +1,11 @@ # Building a compound of meshes 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.) @@ -39,7 +36,7 @@ geompy.addToStudy(Box_sup, "Box_sup") 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") @@ -69,13 +66,20 @@ Ginf2=Mesh_sup.Group(Finf2, "Inf") ## create compounds # create a compound of two meshes with renaming namesake groups and -# merging of elements with the given tolerance +# merging elements with the given tolerance Compound1 = smesh.Concatenate([Mesh_inf, Mesh_sup], 0, 1, 1e-05, - name='Compound_with_RenamedGrps_and_MergeElems') + 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, Mesh_sup], 1, 0, 1e-05, True, - name='Compound_with_UniteGrps_and_GrpsOfAllElems') + 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(1) + salome.sg.updateObjBrowser()