X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=doc%2Fsalome%2Fexamples%2Fcreating_meshes_ex08.py;h=2f506fa2b86a99d01077fce0e2ae4adad8770ba3;hb=067472c5cf3e6818dedcc1272a459d6825dcbda1;hp=18f9dad011c02108c0b9a222bf36a0d1d327b5cc;hpb=54182913fbb9df65a3f4cc96f55db3618835ecd8;p=modules%2Fsmesh.git diff --git a/doc/salome/examples/creating_meshes_ex08.py b/doc/salome/examples/creating_meshes_ex08.py index 18f9dad01..2f506fa2b 100644 --- a/doc/salome/examples/creating_meshes_ex08.py +++ b/doc/salome/examples/creating_meshes_ex08.py @@ -1,23 +1,26 @@ # Mesh Copying import salome -salome.salome_init() +salome.salome_init_without_session() import GEOM from salome.geom import geomBuilder -geompy = geomBuilder.New(salome.myStudy) +geompy = geomBuilder.New() import SMESH, SALOMEDS from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(salome.myStudy) +smesh = smeshBuilder.New() # make geometry of a box box = geompy.MakeBoxDXDYDZ(100,100,100) face = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])[0] -# generate 3D mesh -mesh = smesh.Mesh(box) +# generate a prismatic 3D mesh +mesh = smesh.Mesh(box, "box") localAlgo = mesh.Triangle(face) -mesh.AutomaticHexahedralization() +mesh.Segment().NumberOfSegments( 3 ) +mesh.Quadrangle() +mesh.Prism() +mesh.Compute() # objects to copy fGroup = mesh.GroupOnGeom( face, "2D on face") @@ -32,8 +35,8 @@ newMesh = smesh.CopyMesh( mesh, "whole mesh copy") # 2. copy a group of 2D elements along with groups newMesh = smesh.CopyMesh( fGroup, "face group copy with groups",toCopyGroups=True) -# 3. copy a group of nodes with preseving their ids -newMesh = smesh.CopyMesh( nGroup, "node group copy", toKeepIDs=True) +# 3. copy a group of nodes +newMesh = smesh.CopyMesh( nGroup, "node group copy") # 4. copy some faces faceIds = fGroup.GetIDs()[-10:] @@ -44,4 +47,13 @@ nodeIds = nGroup.GetIDs()[-10:] newMesh = smesh.CopyMesh( mesh.GetIDSource( nodeIds, SMESH.NODE), "some nodes copy") # 6. copy a sub-mesh -newMesh = smesh.CopyMesh( subMesh, "submesh copy" ) +newMesh = smesh.CopyMesh( subMesh, "sub-mesh copy" ) + + +# make a new mesh with same hypotheses on a modified geometry + +smallBox = geompy.MakeScaleAlongAxes( box, None, 1, 0.5, 0.5 ) +cutBox = geompy.MakeCut( box, smallBox, theName="box - smallBox" ) + +ok, newMesh, groups, submehses, hyps, invIDs = smesh.CopyMeshWithGeom( mesh, cutBox, "cutBox" ) +newMesh.Compute()