# make a mesh on a box
box = geompy.MakeBoxDXDYDZ(100,100,100)
-mesh = Mesh( box, "Box" )
+mesh = smesh.Mesh( box, "Box" )
mesh.Segment().NumberOfSegments(10)
mesh.Quadrangle()
mesh.Hexahedron()
mesh.Compute()
# copy all elements with translation and Merge nodes
-mesh.TranslateObject( mesh, MakeDirStruct( 10,0,0), Copy=True )
+mesh.TranslateObject( mesh, smesh.MakeDirStruct( 10,0,0), Copy=True )
mesh.MergeNodes( mesh.FindCoincidentNodes(1e-7) )
# create filters to find equal elements
-equalEdgesFilter = GetFilter(SMESH.EDGE, SMESH.FT_EqualEdges)
-equalFacesFilter = GetFilter(SMESH.FACE, SMESH.FT_EqualFaces)
-equalVolumesFilter = GetFilter(SMESH.VOLUME, SMESH.FT_EqualVolumes)
+equalEdgesFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_EqualEdges)
+equalFacesFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_EqualFaces)
+equalVolumesFilter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_EqualVolumes)
# get equal elements
print "Number of equal edges:", len( mesh.GetIdsFromFilter( equalEdgesFilter ))
print "Number of equal faces:", len( mesh.GetIdsFromFilter( equalFacesFilter ))
# make a mesh on a box
box = geompy.MakeBoxDXDYDZ(100,100,100)
-mesh = Mesh( box, "Box" )
+mesh = smesh.Mesh( box, "Box" )
mesh.Segment().NumberOfSegments(10)
mesh.Quadrangle()
mesh.Hexahedron()
mesh.Compute()
# copy all elements with translation
-mesh.TranslateObject( mesh, MakeDirStruct( 10,0,0), Copy=True )
+mesh.TranslateObject( mesh, smesh.MakeDirStruct( 10,0,0), Copy=True )
# create filters to find nodes equal within tolerance of 1e-5
-filter = GetFilter(SMESH.NODE, FT_EqualNodes, Tolerance=1e-5)
+filter = smesh.GetFilter(SMESH.NODE, SMESH.FT_EqualNodes, Tolerance=1e-5)
# get equal nodes
print "Number of equal nodes:", len( mesh.GetIdsFromFilter( filter ))
# create mesh
from SMESH_mechanic import *
# get all the quadrangle faces ...
-criterion1 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_ElemGeomType, smesh.Geom_QUADRANGLE, SMESH.FT_LogicalAND)
+criterion1 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_ElemGeomType, SMESH.Geom_QUADRANGLE, SMESH.FT_LogicalAND)
# ... AND do NOT get those from sub_face3
criterion2 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_BelongToGeom, sub_face3, SMESH.FT_LogicalNOT)
filter = smesh.CreateFilterManager().CreateFilter()
box = geompy.MakeBoxDXDYDZ(10,10,10)
# make a mesh with quadrangles of different area in range [1,16]
-mesh = Mesh(box,"Quad mesh")
+mesh = smesh.Mesh(box,"Quad mesh")
hyp1D = mesh.Segment().StartEndLength( 1, 4 )
mesh.Quadrangle()
mesh.Compute()
# create a group on filter selecting faces of medium size
critaria = [ \
- GetCriterion(FACE, FT_Area, ">", 1.1, BinaryOp=FT_LogicalAND ),
- GetCriterion(FACE, FT_Area, "<", 15.0 )
+ smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, ">", 1.1, BinaryOp=SMESH.FT_LogicalAND ),
+ smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, "<", 15.0 )
]
-filt = GetFilterFromCriteria( critaria )
-filtGroup = mesh.GroupOnFilter( FACE, "group on filter", filt )
+filt = smesh.GetFilterFromCriteria( critaria )
+filtGroup = mesh.GroupOnFilter( SMESH.FACE, "group on filter", filt )
print "Group on filter contains %s elemens" % filtGroup.Size()
# group on filter is updated if the mesh is modified
print "After mesh change, group on filter contains %s elemens" % filtGroup.Size()
# set a new filter defining the group
-filt2 = GetFilter( FACE, FT_RangeOfIds, "1-50" )
+filt2 = smesh.GetFilter( SMESH.FACE, SMESH.FT_RangeOfIds, "1-50" )
filtGroup.SetFilter( filt2 )
print "With a new filter, group on filter contains %s elemens" % filtGroup.Size()
# group is updated at modification of the filter
-filt2.SetCriteria( [ GetCriterion( FACE, FT_RangeOfIds, "1-70" )])
+filt2.SetCriteria( [ smesh.GetCriterion( SMESH.FACE, SMESH.FT_RangeOfIds, "1-70" )])
filtIDs3 = filtGroup.GetIDs()
print "After filter modification, group on filter contains %s elemens" % filtGroup.Size()
import salome_notebook
-box = MakeBoxDXDYDZ(200, 200, 200)
+box = geompy.MakeBoxDXDYDZ(200, 200, 200)
-mesh = Mesh( box )
+mesh = smesh.Mesh( box )
mesh.Segment().AutomaticLength(0.1)
mesh.Quadrangle()
mesh.Compute()
# find node at (0,0,0)
node000 = None
-for vId in SubShapeAllIDs( box, ShapeType["VERTEX"]):
+for vId in geompy.SubShapeAllIDs( box, geompy.ShapeType["VERTEX"]):
if node000: break
nodeIds = mesh.GetSubMeshNodesId( vId, True )
for node in nodeIds:
mesh.Compute()
# remove 2 faces
-allFaces = mesh.GetElementsByType(FACE)
+allFaces = mesh.GetElementsByType(SMESH.FACE)
mesh.RemoveElements( allFaces[0:2])
-bareGroup = mesh.MakeGroup("bare faces", FACE, FT_BareBorderFace)
+bareGroup = mesh.MakeGroup("bare faces", SMESH.FACE, SMESH.FT_BareBorderFace)
assert(bareGroup.Size() == 3)
geompy.addToStudy( box, "box" )
geompy.addToStudyInFather( box, face, "face" )
-mesh = Mesh(box)
+mesh = smesh.Mesh(box)
mesh.AutomaticHexahedralization();
# remove half of mesh faces from the smallest face
mesh.RemoveElements( faceToRemove )
# make a group of volumes missing the removed faces
-bareGroup = mesh.MakeGroup("bare volumes", VOLUME, FT_BareBorderVolume)
+bareGroup = mesh.MakeGroup("bare volumes", SMESH.VOLUME, SMESH.FT_BareBorderVolume)
assert(bareGroup.Size() == len( faceToRemove))
import salome_notebook
-mesh = Mesh()
-faceFilter = GetFilter(FACE,FT_OverConstrainedFace)
+mesh = smesh.Mesh()
+faceFilter = smesh.GetFilter(SMESH.FACE,SMESH.FT_OverConstrainedFace)
#make an edge
n1 = mesh.AddNode(0,0,0)
assert( not mesh.GetIdsFromFilter( faceFilter ))
# make faces
-mesh.ExtrusionSweep([edge], MakeDirStruct(0,7,0), 5)
+mesh.ExtrusionSweep([edge], smesh.MakeDirStruct(0,7,0), 5)
assert( 2 == len( mesh.GetIdsFromFilter( faceFilter )))
import salome_notebook
-mesh = Mesh()
-volumeFilter = GetFilter(VOLUME,FT_OverConstrainedVolume)
+mesh = smesh.Mesh()
+volumeFilter = smesh.GetFilter(SMESH.VOLUME,SMESH.FT_OverConstrainedVolume)
# make volumes by extrusion of one face
n1 = mesh.AddNode(0,0,0)
n2 = mesh.AddNode(10,0,0)
edge = mesh.AddEdge([n1,n2])
-mesh.ExtrusionSweep([edge], MakeDirStruct(0,7,0), 1)
-mesh.ExtrusionSweep( mesh.GetElementsByType(FACE), MakeDirStruct(0,0,5), 7)
+mesh.ExtrusionSweep([edge], smesh.MakeDirStruct(0,7,0), 1)
+mesh.ExtrusionSweep( mesh.GetElementsByType(SMESH.FACE), smesh.MakeDirStruct(0,0,5), 7)
assert( 2 == len( mesh.GetIdsFromFilter( volumeFilter )))
## -----------
dim = SMESH.BND_2DFROM3D
-init_mesh = Mesh(box, "box")
+init_mesh = smesh.Mesh(box, "box")
init_mesh.AutomaticHexahedralization() # it makes 3 x 3 x 3 hexahedrons
# remove some faces
init_mesh.RemoveElements( rm_face )
# restore boundary in this mesh
-mesh = CopyMesh( init_mesh, "2D from 3D")
+mesh = smesh.CopyMesh( init_mesh, "2D from 3D")
groupName = "bnd 2D"
nb, new_mesh, new_group = mesh.MakeBoundaryElements(dim, groupName)
## -----------
dim = SMESH.BND_1DFROM2D
-init_mesh = Mesh(f1, "2D mesh")
+init_mesh = smesh.Mesh(f1, "2D mesh")
init_mesh.AutomaticHexahedralization()
# remove some edges
# restore boundary edges in this mesh
-mesh = CopyMesh( init_mesh, "1D from 2D")
+mesh = smesh.CopyMesh( init_mesh, "1D from 2D")
groupName = "bnd 1D"
nb, new_mesh, new_group = mesh.MakeBoundaryElements(dim, groupName)
## ------------------
dim = SMESH.BND_1DFROM3D
-init_mesh = Mesh(box, "box")
+init_mesh = smesh.Mesh(box, "box")
init_mesh.AutomaticHexahedralization() # it makes 3 x 3 x 3 hexahedrons
# remove all edges
rm_edges = init_mesh.GetElementsByType( SMESH.EDGE )
fGroup2 = init_mesh.Group( f2, "f2" )
# make 1D boundary around groups in this mesh
-mesh = CopyMesh( init_mesh, "1D from 2D groups", toCopyGroups=True)
+mesh = smesh.CopyMesh( init_mesh, "1D from 2D groups", toCopyGroups=True)
groups = mesh.GetGroups()
nb, new_mesh, new_group = mesh.MakeBoundaryElements(dim, groupName,groups=groups)