#CCRTif test -f ${SMESH_DIR}/bin/salome/libSMESH_Swig.py ; then
#if test -f ${SMESH_DIR}/bin/salome/MED_Test ; then
-if test -f ${SMESH_DIR}/bin/salome/smesh.py ; then
+if test -f ${SMESH_DIR}/bin/salome/SMESH_test.py ; then
SMesh_ok=yes
AC_MSG_RESULT(Using SMesh module distribution in ${SMESH_DIR})
# 3d mesh generation
-from geompy import *
-import smesh
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
###
# Geometry: an assembly of a box, a cylinder and a truncated cone
height = 100
# Build a box
-box = MakeBox(-cote, -cote, -cote, +cote, +cote, +cote)
+box = geompy.MakeBox(-cote, -cote, -cote, +cote, +cote, +cote)
# Build a cylinder
-pt1 = MakeVertex(0, 0, cote/3)
-di1 = MakeVectorDXDYDZ(0, 0, 1)
-cyl = MakeCylinder(pt1, di1, section, size)
+pt1 = geompy.MakeVertex(0, 0, cote/3)
+di1 = geompy.MakeVectorDXDYDZ(0, 0, 1)
+cyl = geompy.MakeCylinder(pt1, di1, section, size)
# Build a truncated cone
-pt2 = MakeVertex(0, 0, size)
-cone = MakeCone(pt2, di1, radius_1, radius_2, height)
+pt2 = geompy.MakeVertex(0, 0, size)
+cone = geompy.MakeCone(pt2, di1, radius_1, radius_2, height)
# Fuse
-box_cyl = MakeFuse(box, cyl)
-piece = MakeFuse(box_cyl, cone)
+box_cyl = geompy.MakeFuse(box, cyl)
+piece = geompy.MakeFuse(box_cyl, cone)
# Add to the study
-addToStudy(piece, name)
+geompy.addToStudy(piece, name)
# Create a group of faces
-group = CreateGroup(piece, ShapeType["FACE"])
+group = geompy.CreateGroup(piece, geompy.ShapeType["FACE"])
group_name = name + "_grp"
-addToStudy(group, group_name)
+geompy.addToStudy(group, group_name)
group.SetName(group_name)
# Add faces to the group
-faces = SubShapeAllIDs(piece, ShapeType["FACE"])
-UnionIDs(group, faces)
+faces = geompy.SubShapeAllIDs(piece, geompy.ShapeType["FACE"])
+geompy.UnionIDs(group, faces)
###
# Create a mesh
# Usage of Body Fitting algorithm
-from smesh import *
-SetCurrentStudy(salome.myStudy)
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
# create a sphere
sphere = geompy.MakeSphereR( 50 )
geompy.addToStudy( sphere, "sphere" )
# create a mesh and assign a "Body Fitting" algo
-mesh = Mesh( sphere )
+mesh = smesh.Mesh( sphere )
cartAlgo = mesh.BodyFitted()
# define a cartesian grid using Coordinates
# Construction of a Mesh
-import geompy
-import smesh
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create a box
box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
# Construction of a Submesh
-from geompy import *
-import smesh
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create a box
-box = MakeBoxDXDYDZ(10., 10., 10.)
-addToStudy(box, "Box")
+box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
+geompy.addToStudy(box, "Box")
# select one edge of the box for definition of a local hypothesis
-p5 = MakeVertex(5., 0., 0.)
-EdgeX = GetEdgeNearPoint(box, p5)
-addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
+p5 = geompy.MakeVertex(5., 0., 0.)
+EdgeX = geompy.GetEdgeNearPoint(box, p5)
+geompy.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
# create a hexahedral mesh on the box
quadra = smesh.Mesh(box, "Box : quadrangle 2D mesh")
# Change priority of submeshes in Mesh
import salome
-import geompy
-import smesh
-import SMESH
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
[Face_1,Face_2,Face_3,Face_4,Face_5,Face_6] = geompy.SubShapeAllSorted(Box_1, geompy.ShapeType["FACE"])
Regular_1D_1 = Mesh_1.Segment(geom=Face_1)
Nb_Segments_2 = Regular_1D_1.NumberOfSegments(4)
Nb_Segments_2.SetDistrType( 0 )
-MEFISTO_2D_1 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_1)
+MEFISTO_2D_1 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_1)
Length_From_Edges_2D = MEFISTO_2D_1.LengthFromEdges()
SubMesh_1 = MEFISTO_2D_1.GetSubMesh()
Regular_1D_2 = Mesh_1.Segment(geom=Face_2)
Nb_Segments_3 = Regular_1D_2.NumberOfSegments(8)
Nb_Segments_3.SetDistrType( 0 )
-MEFISTO_2D_2 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_2)
+MEFISTO_2D_2 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_2)
Length_From_Edges_2D_1 = MEFISTO_2D_2.LengthFromEdges()
SubMesh_2 = MEFISTO_2D_2.GetSubMesh()
Regular_1D_3 = Mesh_1.Segment(geom=Face_3)
Nb_Segments_4 = Regular_1D_3.NumberOfSegments(12)
Nb_Segments_4.SetDistrType( 0 )
-MEFISTO_2D_3 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_3)
+MEFISTO_2D_3 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_3)
Length_From_Edges_2D_2 = MEFISTO_2D_3.LengthFromEdges()
SubMesh_3 = MEFISTO_2D_3.GetSubMesh()
# Editing of a mesh
-import geompy
-import smesh
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
def PrintMeshInfo(theMesh):
aMesh = theMesh.GetMesh()
# Export of a Mesh
-import geompy
-import smesh
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create a box
box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
# Creating a hexahedral mesh on a cylinder.
# Note: it is a copy of 'ex24_cylinder.py' from SMESH_SWIG
-import math
-
-import geompy
-import smesh
import salome
-geo = geompy
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+
+import math
# Parameters
# ----------
# Build a cylinder
# ----------------
-base = geo.MakeVertex(0, 0, 0)
-direction = geo.MakeVectorDXDYDZ(0, 0, 1)
+base = geompy.MakeVertex(0, 0, 0)
+direction = geompy.MakeVectorDXDYDZ(0, 0, 1)
-cylinder = geo.MakeCylinder(base, direction, radius, height)
+cylinder = geompy.MakeCylinder(base, direction, radius, height)
-geo.addToStudy(cylinder, "cylinder")
+geompy.addToStudy(cylinder, "cylinder")
# Build blocks
# ------------
size = radius/2.0
-box_rot = geo.MakeBox(-size, -size, 0, +size, +size, height)
-box_axis = geo.MakeLine(base, direction)
-box = geo.MakeRotation(box_rot, box_axis, math.pi/4)
+box_rot = geompy.MakeBox(-size, -size, 0, +size, +size, height)
+box_axis = geompy.MakeLine(base, direction)
+box = geompy.MakeRotation(box_rot, box_axis, math.pi/4)
-hole = geo.MakeCut(cylinder, box)
+hole = geompy.MakeCut(cylinder, box)
plane_trim = 2000
-plane_a = geo.MakePlane(base, geo.MakeVectorDXDYDZ(1, 0, 0), plane_trim)
-plane_b = geo.MakePlane(base, geo.MakeVectorDXDYDZ(0, 1, 0), plane_trim)
+plane_a = geompy.MakePlane(base, geompy.MakeVectorDXDYDZ(1, 0, 0), plane_trim)
+plane_b = geompy.MakePlane(base, geompy.MakeVectorDXDYDZ(0, 1, 0), plane_trim)
-blocks_part = geo.MakePartition([hole], [plane_a, plane_b], [], [], geo.ShapeType["SOLID"])
-blocks_list = [box] + geo.SubShapeAll(blocks_part, geo.ShapeType["SOLID"])
-blocks_all = geo.MakeCompound(blocks_list)
-blocks = geo.MakeGlueFaces(blocks_all, 0.0001)
+blocks_part = geompy.MakePartition([hole], [plane_a, plane_b], [], [], geompy.ShapeType["SOLID"])
+blocks_list = [box] + geompy.SubShapeAll(blocks_part, geompy.ShapeType["SOLID"])
+blocks_all = geompy.MakeCompound(blocks_list)
+blocks = geompy.MakeGlueFaces(blocks_all, 0.0001)
-geo.addToStudy(blocks, "cylinder:blocks")
+geompy.addToStudy(blocks, "cylinder:blocks")
# Build geometric groups
# ----------------------
def group(name, shape, type, base=None, direction=None):
- t = geo.ShapeType[type]
- g = geo.CreateGroup(shape, t)
+ t = geompy.ShapeType[type]
+ g = geompy.CreateGroup(shape, t)
- geo.addToStudy(g, name)
+ geompy.addToStudy(g, name)
g.SetName(name)
if base!=None:
- l = geo.GetShapesOnPlaneWithLocationIDs(shape, t, direction, base, geo.GEOM.ST_ON)
- geo.UnionIDs(g, l)
+ l = geompy.GetShapesOnPlaneWithLocationIDs(shape, t, direction, base, GEOM.ST_ON)
+ geompy.UnionIDs(g, l)
return g
group_a = group("baseA", blocks, "FACE", base, direction)
-base_b = geo.MakeVertex(0, 0, height)
+base_b = geompy.MakeVertex(0, 0, height)
group_b = group("baseB", blocks, "FACE", base_b, direction)
group_1 = group("limit", blocks, "SOLID")
-group_1_all = geo.SubShapeAllIDs(blocks, geo.ShapeType["SOLID"])
-geo.UnionIDs(group_1, group_1_all)
-group_1_box = geo.GetBlockNearPoint(blocks, base)
-geo.DifferenceList(group_1, [group_1_box])
+group_1_all = geompy.SubShapeAllIDs(blocks, geompy.ShapeType["SOLID"])
+geompy.UnionIDs(group_1, group_1_all)
+group_1_box = geompy.GetBlockNearPoint(blocks, base)
+geompy.DifferenceList(group_1, [group_1_box])
# Mesh the blocks with hexahedral
# -------------------------------
smesh.SetCurrentStudy(salome.myStudy)
def discretize(x, y, z, n, s=blocks):
- p = geo.MakeVertex(x, y, z)
- e = geo.GetEdgeNearPoint(s, p)
+ p = geompy.MakeVertex(x, y, z)
+ e = geompy.GetEdgeNearPoint(s, p)
a = hexa.Segment(e)
a.NumberOfSegments(n)
a.Propagation()
# Note: it is a copy of 'SMESH_BuildCompound.py' from SMESH_SWIG
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
## create a bottom box
Box_inf = geompy.MakeBox(0., 0., 0., 200., 200., 50.)
## 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.smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 0, 1, 1e-05)
+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
# creating groups of all elements
-Compound2 = smesh.smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 1, 0, 1e-05, True)
+Compound2 = smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 1, 0, 1e-05, True)
smesh.SetName(Compound2, 'Compound_with_UniteGrps_and_GrpsOfAllElems')
# Mesh Copying
-from smesh import *
-SetCurrentStudy(salome.myStudy)
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# make geometry of a box
box = geompy.MakeBoxDXDYDZ(100,100,100)
face = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])[0]
# generate 3D mesh
-mesh = Mesh(box)
+mesh = smesh.Mesh(box)
localAlgo = mesh.Triangle(face)
mesh.AutomaticHexahedralization()
# objects to copy
fGroup = mesh.GroupOnGeom( face, "2D on face")
-nGroup = mesh.GroupOnGeom( face, "nodes on face", NODE)
+nGroup = mesh.GroupOnGeom( face, "nodes on face", SMESH.NODE)
subMesh = localAlgo.GetSubMesh()
# make a new mesh by copying different parts of the mesh
# 1. copy the whole mesh
-newMesh = CopyMesh( mesh, "whole mesh copy")
+newMesh = smesh.CopyMesh( mesh, "whole mesh copy")
# 2. copy a group of 2D elements along with groups
-newMesh = CopyMesh( fGroup, "face group copy with groups",toCopyGroups=True)
+newMesh = smesh.CopyMesh( fGroup, "face group copy with groups",toCopyGroups=True)
# 3. copy a group of nodes with preseving their ids
-newMesh = CopyMesh( nGroup, "node group copy", toKeepIDs=True)
+newMesh = smesh.CopyMesh( nGroup, "node group copy", toKeepIDs=True)
# 4. copy some faces
faceIds = fGroup.GetIDs()[-10:]
-newMesh = CopyMesh( mesh.GetIDSource( faceIds, FACE ), "some faces copy")
+newMesh = smesh.CopyMesh( mesh.GetIDSource( faceIds, SMESH.FACE ), "some faces copy")
# 5. copy some nodes
nodeIds = nGroup.GetIDs()[-10:]
-newMesh = CopyMesh( mesh.GetIDSource( nodeIds, NODE), "some nodes copy")
+newMesh = smesh.CopyMesh( mesh.GetIDSource( nodeIds, SMESH.NODE), "some nodes copy")
# 6. copy a sub-mesh
-newMesh = CopyMesh( subMesh, "submesh copy" )
+newMesh = smesh.CopyMesh( subMesh, "submesh copy" )
# Arithmetic 1D
-import geompy
-import smesh
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create a box
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
# Deflection 1D and Number of Segments
-import geompy
-import smesh
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create a face from arc and straight segment
px = geompy.MakeVertex(100., 0. , 0. )
# Start and End Length
-from geompy import *
-import smesh
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create a box
-box = MakeBoxDXDYDZ(10., 10., 10.)
-addToStudy(box, "Box")
+box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
+geompy.addToStudy(box, "Box")
# get one edge of the box to put local hypothesis on
-p5 = MakeVertex(5., 0., 0.)
-EdgeX = GetEdgeNearPoint(box, p5)
-addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
+p5 = geompy.MakeVertex(5., 0., 0.)
+EdgeX = geompy.GetEdgeNearPoint(box, p5)
+geompy.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
# create a hexahedral mesh on the box
hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
# Local Length
-from geompy import *
-import smesh
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create a box
-box = MakeBoxDXDYDZ(10., 10., 10.)
-addToStudy(box, "Box")
+box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
+geompy.addToStudy(box, "Box")
# get one edge of the box to put local hypothesis on
-p5 = MakeVertex(5., 0., 0.)
-EdgeX = GetEdgeNearPoint(box, p5)
-addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
+p5 = geompy.MakeVertex(5., 0., 0.)
+EdgeX = geompy.GetEdgeNearPoint(box, p5)
+geompy.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
# create a hexahedral mesh on the box
hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
# Maximum Element Area
-import geompy
-import smesh
-import salome
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create a face
px = geompy.MakeVertex(100., 0. , 0. )
# Maximum Element Volume
-import geompy
-import smesh
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create a cylinder
cyl = geompy.MakeCylinderRH(30., 50.)
# Length from Edges
-import geompy
-import smesh
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create sketchers
sketcher1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
# Propagation
-from geompy import *
-import smesh
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create a box
-box = MakeBoxDXDYDZ(10., 10., 10.)
-addToStudy(box, "Box")
+box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
+geompy.addToStudy(box, "Box")
# get one edge of the box to put local hypothesis on
-p5 = MakeVertex(5., 0., 0.)
-EdgeX = GetEdgeNearPoint(box, p5)
-addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
+p5 = geompy.MakeVertex(5., 0., 0.)
+EdgeX = geompy.GetEdgeNearPoint(box, p5)
+geompy.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
# create a hexahedral mesh on the box
hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
# Defining Meshing Algorithms
-import geompy
-import smesh
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create a box
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
# Project prisms from one meshed box to another mesh on the same box
-from smesh import *
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# Prepare geometry
# Make the source mesh with prisms
-src_mesh = Mesh(box, "Source mesh")
+src_mesh = smesh.Mesh(box, "Source mesh")
src_mesh.Segment().NumberOfSegments(9,10)
src_mesh.Quadrangle()
src_mesh.Hexahedron()
# Mesh the box using projection algoritms
# Define the same global 1D and 2D hypotheses
-tgt_mesh = Mesh(box, "Target mesh")
+tgt_mesh = smesh.Mesh(box, "Target mesh")
tgt_mesh.Segment().NumberOfSegments(9,10,UseExisting=True)
tgt_mesh.Quadrangle()
tgt_mesh.Compute()
# Move the source mesh to visualy compare the two meshes
-src_mesh.TranslateObject( src_mesh, MakeDirStruct( 210, 0, 0 ), Copy=False)
+src_mesh.TranslateObject( src_mesh, smesh.MakeDirStruct( 210, 0, 0 ), Copy=False)
# Project triangles from one meshed face to another mesh on the same box
-from smesh import *
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# Prepare geometry
geompy.addToStudyInFather( box, Face_2, 'Face_2' )
# Make the source mesh with Netgem2D
-src_mesh = Mesh(Face_1, "Source mesh")
+src_mesh = smesh.Mesh(Face_1, "Source mesh")
src_mesh.Segment().NumberOfSegments(15)
src_mesh.Triangle()
src_mesh.Compute()
# 1D Mesh with Fixed Points example
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
import StdMeshers
# Create face and explode it on edges
# Radial Quadrangle 1D2D example
-from smesh import *
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
-SetCurrentStudy(salome.myStudy)
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# Create face from the wire and add to study
Face = geompy.MakeSketcher("Sketcher:F 0 0:TT 20 0:R 90:C 20 90:WF", [0, 0, 0, 1, 0, 0, 0, 0, 1])
# Define geometry for mesh, and Radial Quadrange algorithm
mesh = smesh.Mesh(Face)
-radial_Quad_algo = mesh.Quadrangle(algo=RADIAL_QUAD)
+radial_Quad_algo = mesh.Quadrangle(algo=smeshBuilder.RADIAL_QUAD)
# The Radial Quadrange algorithm can work without any hypothesis
# In this case it uses "Default Nb of Segments" preferences parameter to discretize edges
# Quadrangle Parameters example 1 (meshing a face with 3 edges)
-from smesh import *
-SetCurrentStudy(salome.myStudy)
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# Get 1/4 part from the disk face.
Box_1 = geompy.MakeBoxDXDYDZ(100, 100, 100)
# Quadrangle Parameters example 2 (using different types)
-import geompy
-import smesh
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
import StdMeshers
# Make quadrangle face and explode it on edges.
# "Use Existing Elements" example
-from smesh import *
-SetCurrentStudy(salome.myStudy)
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# Make a patritioned box
# Mesh one of boxes with quadrangles. It is a source mesh
-srcMesh = Mesh(boxes[0], "source mesh") # box coloser to CS origin
+srcMesh = smesh.Mesh(boxes[0], "source mesh") # box coloser to CS origin
nSeg1 = srcMesh.Segment().NumberOfSegments(4)
srcMesh.Quadrangle()
srcMesh.Compute()
-srcFaceGroup = srcMesh.GroupOnGeom( midFace0, "src faces", FACE )
+srcFaceGroup = srcMesh.GroupOnGeom( midFace0, "src faces", SMESH.FACE )
# Import faces from midFace0 to the target mesh
-tgtMesh = Mesh(boxes[1], "target mesh")
+tgtMesh = smesh.Mesh(boxes[1], "target mesh")
importAlgo = tgtMesh.UseExisting2DElements(midFace1)
import2hyp = importAlgo.SourceFaces( [srcFaceGroup] )
tgtMesh.Segment().NumberOfSegments(3)
# Viscous layers construction
-from smesh import *
-SetCurrentStudy(salome.myStudy)
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
X = geompy.MakeVectorDXDYDZ( 1,0,0 )
O = geompy.MakeVertex( 100,50,50 )
geompy.addToStudyInFather( shape, face1, "face1")
-mesh = Mesh(shape, "CFD")
+mesh = smesh.Mesh(shape, "CFD")
mesh.Segment().NumberOfSegments( 4 )
mesh.Compute()
-mesh.MakeGroup("Tetras",VOLUME,FT_ElemGeomType,"=",Geom_TETRA)
-mesh.MakeGroup("Pyras",VOLUME,FT_ElemGeomType,"=",Geom_PYRAMID)
-mesh.MakeGroup("Prims",VOLUME,FT_ElemGeomType,"=",Geom_PENTA)
+mesh.MakeGroup("Tetras",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_TETRA)
+mesh.MakeGroup("Pyras",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_PYRAMID)
+mesh.MakeGroup("Prims",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_PENTA)
# create mesh
from SMESH_mechanic import *
# get faces with aspect ratio > 6.5
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, 6.5)
+filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, 6.5)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with aspect ratio > 6.5:", len(ids)
mesh.Tetrahedron()
mesh.Compute()
# get volumes with aspect ratio < 2.0
-filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_AspectRatio3D, smesh.FT_LessThan, 2.0)
+filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_AspectRatio3D, SMESH.FT_LessThan, 2.0)
ids = mesh.GetIdsFromFilter(filter)
print "Number of volumes with aspect ratio < 2.0:", len(ids)
# create mesh
from SMESH_mechanic import *
# get faces with warping angle = 2.0e-13 with tolerance 5.0e-14
-criterion = smesh.GetCriterion(smesh.FACE, smesh.FT_Warping, smesh.FT_EqualTo, 2.0e-13)
+criterion = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Warping, SMESH.FT_EqualTo, 2.0e-13)
criterion.Tolerance = 5.0e-14
filter = smesh.CreateFilterManager().CreateFilter()
filter.SetCriteria([criterion])
# create mesh
from SMESH_mechanic import *
# get faces with minimum angle > 75
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_MinimumAngle,">", 75)
+filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MinimumAngle,">", 75)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with minimum angle > 75:", len(ids)
# create mesh
from SMESH_mechanic import *
# get faces with taper < 1.e-15
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_Taper, smesh.FT_LessThan, 1.e-15)
+filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Taper, SMESH.FT_LessThan, 1.e-15)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with taper < 1.e-15:", len(ids)
# create mesh
from SMESH_mechanic import *
# get faces with skew > 50
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, 50)
+filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Skew, SMESH.FT_MoreThan, 50)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with skew > 50:", len(ids)
# create mesh
from SMESH_mechanic import *
# get faces with area > 60 and < 90
-criterion1 = smesh.GetCriterion(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 60,\
- smesh.FT_Undefined, smesh.FT_LogicalAND)
-criterion2 = smesh.GetCriterion(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 90)
+criterion1 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 60,\
+ SMESH.FT_Undefined, SMESH.FT_LogicalAND)
+criterion2 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 90)
filter = smesh.CreateFilterManager().CreateFilter()
filter.SetCriteria([criterion1,criterion2])
ids = mesh.GetIdsFromFilter(filter)
mesh.Tetrahedron()
mesh.Compute()
# get volumes faces with volume > 100
-filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_Volume3D, smesh.FT_MoreThan, 100)
+filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_Volume3D, SMESH.FT_MoreThan, 100)
ids = mesh.GetIdsFromFilter(filter)
print "Number of volumes with volume > 100:", len(ids)
# Free borders
# create mesh
-import geompy, smesh, StdMeshers
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+
face = geompy.MakeFaceHW(100, 100, 1)
geompy.addToStudy( face, "quadrangle" )
mesh = smesh.Mesh(face)
mesh.Triangle().MaxElementArea(25)
mesh.Compute()
# get all free borders
-filter = smesh.GetFilter(smesh.EDGE, smesh.FT_FreeBorders)
+filter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_FreeBorders)
ids = mesh.GetIdsFromFilter(filter)
print "Number of edges on free borders:", len(ids)
# Free edges
# create mesh
-import geompy, smesh, StdMeshers
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+
face = geompy.MakeFaceHW(100, 100, 1)
geompy.addToStudy( face, "quadrangle" )
mesh = smesh.Mesh(face)
mesh.Triangle().MaxElementArea(25)
mesh.Compute()
# get all faces with free edges
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeEdges)
+filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_FreeEdges)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with free edges:", len(ids)
# add node
mesh.AddNode(0,0,0)
# get all free nodes
-filter = smesh.GetFilter(smesh.NODE, smesh.FT_FreeNodes)
+filter = smesh.GetFilter(SMESH.NODE, SMESH.FT_FreeNodes)
ids = mesh.GetIdsFromFilter(filter)
print "Number of free nodes:", len(ids)
# create mesh
from SMESH_mechanic import *
# get all free faces
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeFaces)
+filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_FreeFaces)
ids = mesh.GetIdsFromFilter(filter)
print "Number of free faces:", len(ids)
# create mesh
from SMESH_mechanic import *
# remove some faces to have faces with bare borders
-mesh.RemoveElements( mesh.GetElementsByType(smesh.FACE)[0:5] )
+mesh.RemoveElements( mesh.GetElementsByType(SMESH.FACE)[0:5] )
# get all faces bare borders
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_BareBorderFace)
+filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BareBorderFace)
ids = mesh.GetIdsFromFilter(filter)
print "Faces with bare borders:", ids
# create mesh
from SMESH_mechanic import *
-faceID = mesh.GetElementsByType(smesh.FACE)[0]
+faceID = mesh.GetElementsByType(SMESH.FACE)[0]
# get all faces co-planar to the first face with tolerance 5 degrees
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_CoplanarFaces,faceID,Tolerance=5.0)
+filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_CoplanarFaces,faceID,Tolerance=5.0)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces coplanar with the first one:", len(ids)
# create mesh
from SMESH_mechanic import *
# get all over-constrained faces
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_OverConstrainedFace)
+filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_OverConstrainedFace)
ids = mesh.GetIdsFromFilter(filter)
print "Over-constrained faces:", ids
# Double edges, Double faces, Double volumes
-from smesh import *
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
# 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, FT_EqualEdges)
-equalFacesFilter = GetFilter(SMESH.FACE, FT_EqualFaces)
-equalVolumesFilter = GetFilter(SMESH.VOLUME, 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 ))
# Double nodes
-from smesh import *
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
# 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 border edges with number of connected faces = 5
-filter = smesh.GetFilter(smesh.EDGE, smesh.FT_MultiConnection, 5)
+filter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_MultiConnection, 5)
ids = mesh.GetIdsFromFilter(filter)
print "Number of border edges with 5 faces connected:", len(ids)
# create mesh
from SMESH_mechanic import *
# get faces which consist of edges belonging to 2 mesh elements
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_MultiConnection2D, 2)
+filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MultiConnection2D, 2)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces consisting of edges belonging to 2 faces:", len(ids)
# create mesh
from SMESH_mechanic import *
# get edges with length > 14
-filter = smesh.GetFilter(smesh.EDGE, smesh.FT_Length, smesh.FT_MoreThan, 14)
+filter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_Length, SMESH.FT_MoreThan, 14)
ids = mesh.GetIdsFromFilter(filter)
print "Number of edges with length > 14:", len(ids)
# create mesh
from SMESH_mechanic import *
# get all faces that have edges with length > 14
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_Length2D, smesh.FT_MoreThan, 14)
+filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Length2D, SMESH.FT_MoreThan, 14)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with maximum edge length > 14:", len(ids)
# create mesh
from SMESH_mechanic import *
# get all faces that have elements with length > 10
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength2D, smesh.FT_MoreThan, 10)
+filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MaxElementLength2D, SMESH.FT_MoreThan, 10)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with maximum element length > 10:", len(ids)
mesh.Tetrahedron()
mesh.Compute()
# get all volumes that have elements with length > 10
-filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_MaxElementLength3D, smesh.FT_MoreThan, 10)
+filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_MaxElementLength3D, SMESH.FT_MoreThan, 10)
ids = mesh.GetIdsFromFilter(filter)
print "Number of volumes with maximum element length > 10:", len(ids)
# remove some volumes to have volumes with bare borders
mesh.RemoveElements( mesh.GetElementsByType(VOLUME)[0:5] )
# get all volumes with bare borders
-filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_BareBorderVolume)
+filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_BareBorderVolume)
ids = mesh.GetIdsFromFilter(filter)
print "Volumes with bare borders:", ids
mesh.Tetrahedron()
mesh.Compute()
# get all over-constrained volumes
-filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_OverConstrainedVolume)
+filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_OverConstrainedVolume)
ids = mesh.GetIdsFromFilter(filter)
print "Over-constrained volumes:", ids
# create mesh
from SMESH_mechanic import *
# get all faces which nodes lie on the face sub_face3
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToGeom, sub_face3)
+filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BelongToGeom, sub_face3)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces which nodes lie on sub_face3:", len(ids)
# create mesh
from SMESH_mechanic import *
# get all faces at least one node of each lies on the face sub_face3
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_LyingOnGeom, sub_face3)
+filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_LyingOnGeom, sub_face3)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces at least one node of each lies on sub_face3:", len(ids)
# create mesh
from SMESH_mechanic import *
# create plane
-import geompy
plane_1 = geompy.MakePlane(p3,seg1,2000)
geompy.addToStudy(plane_1, "plane_1")
# get all nodes which lie on the plane \a plane_1
-filter = smesh.GetFilter(smesh.NODE, smesh.FT_BelongToPlane, plane_1)
+filter = smesh.GetFilter(SMESH.NODE, SMESH.FT_BelongToPlane, plane_1)
ids = mesh.GetIdsFromFilter(filter)
print "Number of nodes which lie on the plane plane_1:", len(ids)
# create mesh
from SMESH_mechanic import *
# get all faces which lie on the cylindrical face \a sub_face1
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToCylinder, sub_face1)
+filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BelongToCylinder, sub_face1)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces which lie on the cylindrical surface sub_face1:", len(ids)
surface_1 = geompy.MakePrismVecH( spline_1, vz, 70.0 )
geompy.addToStudy(surface_1, "surface_1")
# get all nodes which lie on the surface \a surface_1
-filter = smesh.GetFilter(smesh.NODE, smesh.FT_BelongToGenSurface, surface_1)
+filter = smesh.GetFilter(SMESH.NODE, SMESH.FT_BelongToGenSurface, surface_1)
ids = mesh.GetIdsFromFilter(filter)
print "Number of nodes which lie on the surface surface_1:", len(ids)
# create mesh
from SMESH_mechanic import *
# get nodes with identifiers [5-10] and [15-30]
-criterion1 = smesh.GetCriterion(smesh.NODE, smesh.FT_RangeOfIds, Threshold="5-10",\
- BinaryOp=smesh.FT_LogicalOR)
-criterion2 = smesh.GetCriterion(smesh.NODE, smesh.FT_RangeOfIds, Threshold="15-30")
+criterion1 = smesh.GetCriterion(SMESH.NODE, SMESH.FT_RangeOfIds, Threshold="5-10",\
+ BinaryOp=SMESH.FT_LogicalOR)
+criterion2 = smesh.GetCriterion(SMESH.NODE, SMESH.FT_RangeOfIds, Threshold="15-30")
filter = smesh.CreateFilterManager().CreateFilter()
filter.SetCriteria([criterion1,criterion2])
ids = mesh.GetIdsFromFilter(filter)
mesh.Tetrahedron()
mesh.Compute()
# get all badly oriented volumes
-filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_BadOrientedVolume)
+filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_BadOrientedVolume)
ids = mesh.GetIdsFromFilter(filter)
print "Number of badly oriented volumes:", len(ids)
# create mesh
from SMESH_mechanic import *
# get number of linear and quadratic edges
-filter_linear = smesh.GetFilter(smesh.EDGE, smesh.FT_LinearOrQuadratic)
-filter_quadratic = smesh.GetFilter(smesh.EDGE, smesh.FT_LinearOrQuadratic, smesh.FT_LogicalNOT)
+filter_linear = smesh.GetFilter(SMESH.EDGE, SMESH.FT_LinearOrQuadratic)
+filter_quadratic = smesh.GetFilter(SMESH.EDGE, SMESH.FT_LinearOrQuadratic, SMESH.FT_LogicalNOT)
ids_linear = mesh.GetIdsFromFilter(filter_linear)
ids_quadratic = mesh.GetIdsFromFilter(filter_quadratic)
print "Number of linear edges:", len(ids_linear), "; number of quadratic edges:", len(ids_quadratic)
# create mesh
from SMESH_mechanic import *
# create group of edges
-all_edges = mesh.GetElementsByType(smesh.EDGE)
-grp = mesh.MakeGroupByIds("edges group", smesh.EDGE, all_edges[:len(all_edges)/4])
+all_edges = mesh.GetElementsByType(SMESH.EDGE)
+grp = mesh.MakeGroupByIds("edges group", SMESH.EDGE, all_edges[:len(all_edges)/4])
import SALOMEDS
c = SALOMEDS.Color(0.1, 0.5, 1.0)
grp.SetColor(c)
# get number of the edges not belonging to the group with the given color
-filter = smesh.GetFilter(smesh.EDGE, smesh.FT_GroupColor, c, smesh.FT_LogicalNOT)
+filter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_GroupColor, c, SMESH.FT_LogicalNOT)
ids = mesh.GetIdsFromFilter(filter)
print "Number of edges not beloging to the group with color (0.1, 0.5, 1.0):", len(ids)
mesh.Tetrahedron()
mesh.Compute()
# get all triangles, quadrangles, tetrahedrons, pyramids
-filter_tri = smesh.GetFilter(smesh.FACE, smesh.FT_ElemGeomType, smesh.Geom_TRIANGLE)
-filter_qua = smesh.GetFilter(smesh.FACE, smesh.FT_ElemGeomType, smesh.Geom_QUADRANGLE)
-filter_tet = smesh.GetFilter(smesh.VOLUME, smesh.FT_ElemGeomType, smesh.Geom_TETRA)
-filter_pyr = smesh.GetFilter(smesh.VOLUME, smesh.FT_ElemGeomType, smesh.Geom_PYRAMID)
+filter_tri = smesh.GetFilter(SMESH.FACE, SMESH.FT_ElemGeomType, smesh.Geom_TRIANGLE)
+filter_qua = smesh.GetFilter(SMESH.FACE, SMESH.FT_ElemGeomType, smesh.Geom_QUADRANGLE)
+filter_tet = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_ElemGeomType, smesh.Geom_TETRA)
+filter_pyr = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_ElemGeomType, smesh.Geom_PYRAMID)
ids_tri = mesh.GetIdsFromFilter(filter_tri)
ids_qua = mesh.GetIdsFromFilter(filter_qua)
ids_tet = mesh.GetIdsFromFilter(filter_tet)
# 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)
+criterion2 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_BelongToGeom, sub_face3, SMESH.FT_LogicalNOT)
filter = smesh.CreateFilterManager().CreateFilter()
filter.SetCriteria([criterion1,criterion2])
ids = mesh.GetIdsFromFilter(filter)
-myGroup = mesh.MakeGroupByIds("Quads_on_cylindrical_faces",smesh.FACE,ids)
+myGroup = mesh.MakeGroupByIds("Quads_on_cylindrical_faces",SMESH.FACE,ids)
# This example represents an iron cable (a thin cylinder) in a concrete bloc (a big cylinder).
# The big cylinder is defined by two geometric volumes.
-import geompy
-import smesh
-import SMESH
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+
# geometry
Box_1 = geompy.MakeBoxTwoPnt(Vertex_2, Vertex_3)
Fuse_1 = geompy.MakeFuse(Cylinder_1, Cylinder_2)
Partition_1 = geompy.MakePartition([Fuse_1], [Cylinder_1, Box_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
-[Solid_1,Solid_2] = geompy.GetShapesOnShape(Cylinder_1, Partition_1, geompy.ShapeType["SOLID"], geompy.GEOM.ST_IN)
-[Solid_3,Solid_4] = geompy.GetShapesOnShape(Cylinder_2, Partition_1, geompy.ShapeType["SOLID"], geompy.GEOM.ST_IN)
+[Solid_1,Solid_2] = geompy.GetShapesOnShape(Cylinder_1, Partition_1, geompy.ShapeType["SOLID"], GEOM.ST_IN)
+[Solid_3,Solid_4] = geompy.GetShapesOnShape(Cylinder_2, Partition_1, geompy.ShapeType["SOLID"], GEOM.ST_IN)
Vertex_4 = geompy.MakeVertex(450, 0, 0)
Vertex_5 = geompy.MakeVertex(500, 0, 0)
Vertex_6 = geompy.MakeVertex(550, 0, 0)
vec1 = geompy.MakeVector(Vertex_4, Vertex_5)
vec2 = geompy.MakeVector(Vertex_5, Vertex_6)
-[Face_1] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec1, geompy.GEOM.ST_ON)
-[Face_2] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec2, geompy.GEOM.ST_ON)
+[Face_1] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec1, GEOM.ST_ON)
+[Face_2] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec2, GEOM.ST_ON)
# meshing (we have linear tetrahedrons here, but other elements are OK)
Mesh_1 = smesh.Mesh(Partition_1)
Regular_1D = Mesh_1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(15)
-MEFISTO_2D = Mesh_1.Triangle(algo=smesh.MEFISTO)
+MEFISTO_2D = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO)
Length_From_Edges_2D = MEFISTO_2D.LengthFromEdges()
ALGO3D = Mesh_1.Tetrahedron()
isDone = Mesh_1.Compute()
# Create a Standalone Group
import SMESH_mechanic
+import SMESH
smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
salome = SMESH_mechanic.salome
# Get ids of all faces with area > 100
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 100.)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 100.)
anIds = mesh.GetIdsFromFilter(aFilter)
# create a group consisting of faces with area > 100
-aGroup1 = mesh.MakeGroupByIds("Area > 100", smesh.FACE, anIds)
+aGroup1 = mesh.MakeGroupByIds("Area > 100", SMESH.FACE, anIds)
# create a group that contains all nodes from the mesh
-aGroup2 = mesh.CreateEmptyGroup(smesh.NODE, "all nodes")
+aGroup2 = mesh.CreateEmptyGroup(SMESH.NODE, "all nodes")
aGroup2.AddFrom(mesh.mesh)
salome.sg.updateObjBrowser(1)
# Create a Group on Geometry
+
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create a box
box = geompy.MakeBox(0., 0., 0., 100., 100., 100.)
# Create a Group on Filter
-from smesh import *
-SetCurrentStudy(salome.myStudy)
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
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()
# Edit a Group
import SMESH_mechanic
+import SMESH
smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
salome = SMESH_mechanic.salome
# Get ids of all faces with area > 35
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 35.)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 35.)
anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area > 35, Nb = ", len(anIds)
# create a group by adding elements with area > 35
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Area > 35")
+aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 35")
aGroup.Add(anIds)
# Get ids of all faces with area > 40
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 40.)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 40.)
anIds = mesh.GetIdsFromFilter(aFilter)
# Union of groups
import SMESH_mechanic
+import SMESH
smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
salome = SMESH_mechanic.salome
# Criterion : AREA > 20
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 20.)
anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area > 20, Nb = ", len( anIds )
# create a group by adding elements with area > 20
-aGroup1 = mesh.CreateEmptyGroup(smesh.FACE, "Area > 20")
+aGroup1 = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 20")
aGroup1.Add(anIds)
# Criterion : AREA = 20
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_EqualTo, 20.)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_EqualTo, 20.)
anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area = 20, Nb = ", len( anIds )
# create a group by adding elements with area = 20
-aGroup2 = mesh.CreateEmptyGroup( smesh.FACE, "Area = 20" )
+aGroup2 = mesh.CreateEmptyGroup( SMESH.FACE, "Area = 20" )
aGroup2.Add(anIds)
# Please note that also there is UnionGroups() method which works with two groups only
# Criterion : AREA < 20
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 20.)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 20.)
anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area < 20, Nb = ", len(anIds)
# create a group by adding elements with area < 20
-aGroup4 = mesh.CreateEmptyGroup(smesh.FACE, "Area < 20")
+aGroup4 = mesh.CreateEmptyGroup(SMESH.FACE, "Area < 20")
aGroup4.Add(anIds)
# create union group : area >= 20 and area < 20
# Intersection of groups
import SMESH_mechanic
+import SMESH
smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
salome = SMESH_mechanic.salome
# Criterion : AREA > 20
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 20.)
anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area > 20, Nb = ", len(anIds)
# create a group by adding elements with area > 20
-aGroup1 = mesh.CreateEmptyGroup(smesh.FACE, "Area > 20")
+aGroup1 = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 20")
aGroup1.Add(anIds)
# Criterion : AREA < 60
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 60.)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 60.)
anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area < 60, Nb = ", len(anIds)
# create a group by adding elements with area < 60
-aGroup2 = mesh.CreateEmptyGroup(smesh.FACE, "Area < 60")
+aGroup2 = mesh.CreateEmptyGroup(SMESH.FACE, "Area < 60")
aGroup2.Add(anIds)
# create an intersection of groups : 20 < area < 60
# Cut of groups
import SMESH_mechanic
+import SMESH
smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
salome = SMESH_mechanic.salome
# Criterion : AREA > 20
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 20.)
anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area > 20, Nb = ", len(anIds)
# create a group by adding elements with area > 20
-aGroupMain = mesh.MakeGroupByIds("Area > 20", smesh.FACE, anIds)
+aGroupMain = mesh.MakeGroupByIds("Area > 20", SMESH.FACE, anIds)
# Criterion : AREA < 60
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 60.)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 60.)
anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area < 60, Nb = ", len(anIds)
# create a group by adding elements with area < 60
-aGroupTool = mesh.MakeGroupByIds("Area < 60", smesh.FACE, anIds)
+aGroupTool = mesh.MakeGroupByIds("Area < 60", SMESH.FACE, anIds)
# create a cut of groups : area >= 60
aGroupRes = mesh.CutGroups(aGroupMain, aGroupTool, "Area >= 60")
# Creating groups of entities from existing groups of superior dimensions
import SMESH_mechanic
+import SMESH
smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
salome = SMESH_mechanic.salome
# Criterion : AREA > 100
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 100.)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 100.)
anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area > 100, Nb = ", len(anIds)
# create a group by adding elements with area > 100
-aSrcGroup1 = mesh.MakeGroupByIds("Area > 100", smesh.FACE, anIds)
+aSrcGroup1 = mesh.MakeGroupByIds("Area > 100", SMESH.FACE, anIds)
# Criterion : AREA < 30
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 30.)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 30.)
anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area < 30, Nb = ", len(anIds)
# create a group by adding elements with area < 30
-aSrcGroup2 = mesh.MakeGroupByIds("Area < 30", smesh.FACE, anIds)
+aSrcGroup2 = mesh.MakeGroupByIds("Area < 30", SMESH.FACE, anIds)
# Create group of edges using source groups of faces
-aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], smesh.EDGE, "Edges" )
+aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], SMESH.EDGE, "Edges" )
# Create group of nodes using source groups of faces
-aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], smesh.NODE, "Nodes" )
+aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], SMESH.NODE, "Nodes" )
salome.sg.updateObjBrowser(1)
# Minimum Distance
-import smesh
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
from SMESH_mechanic import mesh as mesh1
from SMESH_test1 import mesh as mesh2
# Bounding Box
-import smesh
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
from SMESH_mechanic import mesh as mesh1
from SMESH_test1 import mesh as mesh2
# Add Node
-import smesh
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
mesh = smesh.Mesh()
# Add 0D Element
-import smesh
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
mesh = smesh.Mesh()
# Add 0D Element on Element Nodes
-import smesh, SMESH, geompy
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
# create a geometry
box = geompy.MakeBoxDXDYDZ( 10, 10, 10 )
# Add Polygon
import math
+
import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
-import smesh
# create an empty mesh structure
mesh = smesh.Mesh()
# Add Polyhedron
+
import salome
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
import math
# create an empty mesh structure
# Moving Nodes
-from geompy import *
-from smesh import *
-box = MakeBoxDXDYDZ(200, 200, 200)
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
-mesh = Mesh( box )
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
+
+box = geompy.MakeBoxDXDYDZ(200, 200, 200)
+
+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:
# Diagonal Inversion
+
import salome
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
# create an empty mesh structure
mesh = smesh.Mesh()
# Uniting two Triangles
+
import salome
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
# create an empty mesh structure
mesh = smesh.Mesh()
# Uniting a Set of Triangles
+
import salome
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
# create an empty mesh structure
mesh = smesh.Mesh()
# unite a set of triangles
print "\nUnite a set of triangles ... ",
-res = mesh.TriToQuad([ff[2], ff[3], ff[4], ff[5]], smesh.FT_MinimumAngle, 60.)
+res = mesh.TriToQuad([ff[2], ff[3], ff[4], ff[5]], SMESH.FT_MinimumAngle, 60.)
if not res: print "failed!"
else: print "done."
# Orientation
+
import salome
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
# create an empty mesh structure
mesh = smesh.Mesh()
# Cutting Quadrangles
import SMESH_mechanic
+import SMESH
smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
# cut two quadrangles: 405 and 406
-mesh.QuadToTri([405, 406], smesh.FT_MinimumAngle)
+mesh.QuadToTri([405, 406], SMESH.FT_MinimumAngle)
# Smoothing
+
import salome
-import geompy
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
import SMESH_mechanic
-smesh = SMESH_mechanic.smesh
+#smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
# select the top face
geompy.addToStudyInFather(SMESH_mechanic.shape_mesh, face, "face planar with hole")
# create a group of faces to be smoothed
-GroupSmooth = mesh.GroupOnGeom(face, "Group of faces (smooth)", smesh.FACE)
+GroupSmooth = mesh.GroupOnGeom(face, "Group of faces (smooth)", SMESH.FACE)
# perform smoothing
# Extrusion
+
import salome
-import geompy
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
import SMESH_mechanic
-smesh = SMESH_mechanic.smesh
+#smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
# select the top face
geompy.addToStudyInFather(SMESH_mechanic.shape_mesh, face, "face circular top")
# create a vector for extrusion
-point = smesh.PointStruct(0., 0., 5.)
-vector = smesh.DirStruct(point)
+point = SMESH.PointStruct(0., 0., 5.)
+vector = SMESH.DirStruct(point)
# create a group to be extruded
-GroupTri = mesh.GroupOnGeom(face, "Group of faces (extrusion)", smesh.FACE)
+GroupTri = mesh.GroupOnGeom(face, "Group of faces (extrusion)", SMESH.FACE)
# perform extrusion of the group
mesh.ExtrusionSweepObject(GroupTri, vector, 5)
# Extrusion along a Path
import math
+
import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
-# Geometry
-import geompy
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# 1. Create points
points = [[0, 0], [50, 30], [50, 110], [0, 150], [-80, 150], [-130, 70], [-130, -20]]
pass
# Mesh
-import smesh
# Mesh the given shape with the given 1d hypothesis
def Mesh1D(shape1d, nbSeg, name):
# ExtrusionAlongPath
# IDsOfElements, PathMesh, PathShape, NodeStart,
# HasAngles, Angles, HasRefPoint, RefPoint
-refPoint = smesh.PointStruct(0, 0, 0)
+refPoint = SMESH.PointStruct(0, 0, 0)
a10 = 10.0*math.pi/180.0
a45 = 45.0*math.pi/180.0
# Pattern Mapping
-import geompy
-import smesh
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# define the geometry
Box_1 = geompy.MakeBoxDXDYDZ(200., 200., 200.)
if (isDone != 1): print 'LoadFromFace :', pattern.GetErrorCode()
# apply the pattern to a face of the first mesh
-facesToSplit = Mesh_1.GetElementsByType(smesh.SMESH.FACE)
+facesToSplit = Mesh_1.GetElementsByType(SMESH.FACE)
print "Splitting %d rectangular face(s) to %d triangles..."%(len(facesToSplit), 2*len(facesToSplit))
pattern.ApplyToMeshFaces(Mesh_1.GetMesh(), facesToSplit, 0, 0)
isDone = pattern.MakeMesh(Mesh_1.GetMesh(), 0, 0)
pattern_hexa.LoadFromFile(smp_hexa)
# apply the pattern to a mesh
-volsToSplit = Mesh_3.GetElementsByType(smesh.SMESH.VOLUME)
+volsToSplit = Mesh_3.GetElementsByType(SMESH.VOLUME)
print "Splitting %d hexa volume(s) to %d hexas..."%(len(volsToSplit), 4*len(volsToSplit))
pattern_hexa.ApplyToHexahedrons(Mesh_3.GetMesh(), volsToSplit,0,3)
isDone = pattern_hexa.MakeMesh(Mesh_3.GetMesh(), True, True)
pattern_pyra.LoadFromFile(smp_pyra)
# apply the pattern to a face mesh
-volsToSplit = Mesh_4.GetElementsByType(smesh.SMESH.VOLUME)
+volsToSplit = Mesh_4.GetElementsByType(SMESH.VOLUME)
print "Splitting %d hexa volume(s) to %d hexas..."%(len(volsToSplit), 6*len(volsToSplit))
pattern_pyra.ApplyToHexahedrons(Mesh_4.GetMesh(), volsToSplit,1,0)
isDone = pattern_pyra.MakeMesh(Mesh_4.GetMesh(), True, True)
# Convert mesh to/from quadratic
-import geompy
-import smesh
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create sphere of radius 100
# Using SALOME NoteBook
-import geompy
-import smesh
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
import salome_notebook
# set variables
ret = tetra.Compute()
# translate the mesh
-point = smesh.PointStruct("Offset", 0., 0.)
-vector = smesh.DirStruct(point)
+point = SMESH.PointStruct("Offset", 0., 0.)
+vector = SMESH.DirStruct(point)
tetra.TranslateObject(tetra, vector, 0)
# Free Borders
+
import salome
-import geompy
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
-import smesh
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create open shell: a box without one plane
box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
mesh.Compute()
# criterion : free borders
-aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_FreeBorders)
+aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_FreeBorders)
anIds = mesh.GetIdsFromFilter(aFilter)
# print the result
print ""
# create a group
-aGroup = mesh.GetMesh().CreateGroup(smesh.EDGE, "Free borders")
+aGroup = mesh.GetMesh().CreateGroup(SMESH.EDGE, "Free borders")
aGroup.Add(anIds)
salome.sg.updateObjBrowser(1)
# Borders at Multiconnection
+
import salome
-import geompy
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
-import smesh
-import SMESH
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create open shell: a box without one plane
box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
# Criterion : Borders at multi-connection
nb_conn = 2
-aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_MultiConnection, smesh.FT_EqualTo, nb_conn)
+aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_MultiConnection, SMESH.FT_EqualTo, nb_conn)
anIds = mesh.GetIdsFromFilter(aFilter)
# print the result
print ""
# create a group
-aGroup = mesh.GetMesh().CreateGroup(smesh.EDGE, "Borders at multi-connections")
+aGroup = mesh.GetMesh().CreateGroup(SMESH.EDGE, "Borders at multi-connections")
aGroup.Add(anIds)
salome.sg.updateObjBrowser(1)
# Length 1D
+
import salome
-import geompy
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
-import smesh
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create open shell: a box without one plane
box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
# Criterion : Length > 3.
length_margin = 3.
-aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_Length, smesh.FT_MoreThan, length_margin)
+aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_Length, SMESH.FT_MoreThan, length_margin)
anIds = mesh.GetIdsFromFilter(aFilter)
# print the result
print ""
# create a group
-aGroup = mesh.GetMesh().CreateGroup(smesh.EDGE, "Edges with length > " + `length_margin`)
+aGroup = mesh.GetMesh().CreateGroup(SMESH.EDGE, "Edges with length > " + `length_margin`)
aGroup.Add(anIds)
salome.sg.updateObjBrowser(1)
# Free Edges
import SMESH_mechanic
+import SMESH
smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
# Criterion : AREA > 95.
area_margin = 95.
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, area_margin)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, area_margin)
anIds = mesh.GetIdsFromFilter(aFilter)
aBorders = mesh.GetFreeBorders()
# create groups
-aGroupF = mesh.CreateEmptyGroup(smesh.FACE, "Faces with free edges")
-aGroupN = mesh.CreateEmptyGroup(smesh.NODE, "Nodes on free edges")
+aGroupF = mesh.CreateEmptyGroup(SMESH.FACE, "Faces with free edges")
+aGroupN = mesh.CreateEmptyGroup(SMESH.NODE, "Nodes on free edges")
# fill groups with elements, corresponding to the criterion
print ""
# Free Nodes
+
import salome
-import geompy
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
-import smesh
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create box
box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
mesh = smesh.Mesh(box, "Mesh_free_nodes")
algo = mesh.Segment()
algo.NumberOfSegments(10)
-algo = mesh.Triangle(smesh.MEFISTO)
+algo = mesh.Triangle(smeshBuilder.MEFISTO)
algo.MaxElementArea(150.)
mesh.Compute()
# Criterion : AREA < 80.
area_margin = 80.
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, area_margin)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, area_margin)
anIds = mesh.GetIdsFromFilter(aFilter)
mesh.RemoveElements(anIds)
# criterion : free nodes
-aFilter = smesh.GetFilter(smesh.NODE, smesh.FT_FreeNodes)
+aFilter = smesh.GetFilter(SMESH.NODE, SMESH.FT_FreeNodes)
anNodeIds = mesh.GetIdsFromFilter(aFilter)
# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.NODE, "Free_nodes")
+aGroup = mesh.CreateEmptyGroup(SMESH.NODE, "Free_nodes")
aGroup.Add(anNodeIds)
# print the result
# Free Faces
+
import salome
-import geompy
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
####### GEOM part ########
geompy.addToStudy( Plane_2, "Plane_2" )
###### SMESH part ######
-import smesh
-
-import StdMeshers
Mesh_1 = smesh.Mesh(Partition_1)
Regular_1D = Mesh_1.Segment()
isDone = Mesh_1.Compute()
# create a group of free faces
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeFaces )
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_FreeFaces )
aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
-aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Free_faces")
+aGroup = Mesh_1.CreateEmptyGroup(SMESH.FACE, "Free_faces")
aGroup.Add(aFaceIds)
# print the result
print ""
#filter faces from plane 2
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToPlane, Plane_2)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BelongToPlane, Plane_2)
aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
aGroup.Remove(aFaceIds)
# create a group of shared faces (located on partition boundary inside box)
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToPlane, Plane_1)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BelongToPlane, Plane_1)
aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
-aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Shared_faces")
+aGroup = Mesh_1.CreateEmptyGroup(SMESH.FACE, "Shared_faces")
aGroup.Add(aFaceIds)
salome.sg.updateObjBrowser(1)
# Bare border faces
-from smesh import *
-SetCurrentStudy(salome.myStudy)
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
box = geompy.MakeBoxDXDYDZ(100, 100, 100)
geompy.addToStudy( box, "box" )
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)
# Bare border volumes
-from smesh import *
-SetCurrentStudy(salome.myStudy)
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
box = geompy.MakeBoxDXDYDZ(100, 30, 10)
# the smallest face of the box
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))
# Over-constrained faces
-from smesh import *
-SetCurrentStudy(salome.myStudy)
-mesh = Mesh()
-faceFilter = GetFilter(FACE,FT_OverConstrainedFace)
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
+
+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 )))
# Over-constrained volumes
-from smesh import *
-SetCurrentStudy(salome.myStudy)
-mesh = Mesh()
-volumeFilter = GetFilter(VOLUME,FT_OverConstrainedVolume)
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
+
+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 )))
# Length 2D
+
import salome
-import geompy
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
-import smesh
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create open shell: a box without one plane
box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
# Criterion : Length 2D > 5.7
length_margin = 5.7
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Length2D, smesh.FT_MoreThan, length_margin)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Length2D, SMESH.FT_MoreThan, length_margin)
anIds = mesh.GetIdsFromFilter(aFilter)
print ""
# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Faces with length 2D > " + `length_margin`)
+aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Faces with length 2D > " + `length_margin`)
aGroup.Add(anIds)
salome.sg.updateObjBrowser(1)
# Borders at Multiconnection 2D
+
import salome
-import geompy
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
-import smesh
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create a compound of two glued boxes
box1 = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
# Criterion : MULTI-CONNECTION 2D = 3
nb_conn = 3
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MultiConnection2D, smesh.FT_EqualTo, nb_conn)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MultiConnection2D, SMESH.FT_EqualTo, nb_conn)
anIds = mesh.GetIdsFromFilter(aFilter)
print ""
# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Borders at multi-connection 2D = " + `nb_conn`)
+aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Borders at multi-connection 2D = " + `nb_conn`)
aGroup.Add(anIds)
salome.sg.updateObjBrowser(1)
# Area
import SMESH_mechanic
+import SMESH
smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
# Criterion : AREA > 100.
area_margin = 100.
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, area_margin)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, area_margin)
anIds = mesh.GetIdsFromFilter(aFilter)
print ""
# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Area > " + `area_margin`)
+aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Area > " + `area_margin`)
aGroup.Add(anIds)
salome.sg.updateObjBrowser(1)
# Taper
import SMESH_mechanic
+import SMESH
smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
# Criterion : Taper > 3e-20
taper_margin = 3e-20
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Taper, smesh.FT_MoreThan, taper_margin)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Taper, SMESH.FT_MoreThan, taper_margin)
anIds = mesh.GetIdsFromFilter(aFilter)
print ""
# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Taper > " + `taper_margin`)
+aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Taper > " + `taper_margin`)
aGroup.Add(anIds)
salome.sg.updateObjBrowser(1)
# Aspect Ratio
import SMESH_mechanic
+import SMESH
smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
# Criterion : ASPECT RATIO > 1.8
ar_margin = 1.8
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, ar_margin)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, ar_margin)
anIds = mesh.GetIdsFromFilter(aFilter)
print ""
# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Aspect Ratio > " + `ar_margin`)
+aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Aspect Ratio > " + `ar_margin`)
aGroup.Add(anIds)
salome.sg.updateObjBrowser(1)
# Minimum Angle
import SMESH_mechanic
+import SMESH
smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
# Criterion : MINIMUM ANGLE < 35.
min_angle = 35.
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MinimumAngle, smesh.FT_LessThan, min_angle)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MinimumAngle, SMESH.FT_LessThan, min_angle)
anIds = mesh.GetIdsFromFilter(aFilter)
print ""
# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Minimum Angle < " + `min_angle`)
+aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Minimum Angle < " + `min_angle`)
aGroup.Add(anIds)
# Warping
import SMESH_mechanic
+import SMESH
smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
# Criterion : WARP ANGLE > 1e-15
wa_margin = 1e-15
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Warping, smesh.FT_MoreThan, wa_margin)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Warping, SMESH.FT_MoreThan, wa_margin)
anIds = mesh.GetIdsFromFilter(aFilter)
print ""
# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Warp > " + `wa_margin`)
+aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Warp > " + `wa_margin`)
aGroup.Add(anIds)
# Skew
import SMESH_mechanic
+import SMESH
smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
# Criterion : Skew > 38.
skew_margin = 38.
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, skew_margin)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Skew, SMESH.FT_MoreThan, skew_margin)
anIds = mesh.GetIdsFromFilter(aFilter)
print ""
# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Skew > " + `skew_margin`)
+aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Skew > " + `skew_margin`)
aGroup.Add(anIds)
salome.sg.updateObjBrowser(1)
# Element Diameter 2D
import SMESH_mechanic
+import SMESH
smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
# Criterion : ELEMENT DIAMETER 2D > 10
mel_2d_margin = 10
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength2D, smesh.FT_MoreThan, mel_2d_margin)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MaxElementLength2D, SMESH.FT_MoreThan, mel_2d_margin)
anIds = mesh.GetIdsFromFilter(aFilter)
print ""
# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Element Diameter 2D > " + `mel_2d_margin`)
+aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Element Diameter 2D > " + `mel_2d_margin`)
aGroup.Add(anIds)
salome.sg.updateObjBrowser(1)
# Aspect Ratio 3D
import SMESH_mechanic_tetra
+import SMESH
smesh = SMESH_mechanic_tetra.smesh
mesh = SMESH_mechanic_tetra.mesh
# Criterion : ASPECT RATIO 3D > 4.5
ar_margin = 4.5
-aFilter = smesh.GetFilter(smesh.VOLUME, smesh.FT_AspectRatio3D, smesh.FT_MoreThan, ar_margin)
+aFilter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_AspectRatio3D, SMESH.FT_MoreThan, ar_margin)
anIds = mesh.GetIdsFromFilter(aFilter)
print ""
# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, "Aspect Ratio 3D > " + `ar_margin`)
+aGroup = mesh.CreateEmptyGroup(SMESH.VOLUME, "Aspect Ratio 3D > " + `ar_margin`)
aGroup.Add(anIds)
# Volume
import SMESH_mechanic_tetra
+import SMESH
smesh = SMESH_mechanic_tetra.smesh
mesh = SMESH_mechanic_tetra.mesh
# Criterion : VOLUME < 7.
volume_margin = 7.
-aFilter = smesh.GetFilter(smesh.VOLUME, smesh.FT_Volume3D, smesh.FT_LessThan, volume_margin)
+aFilter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_Volume3D, SMESH.FT_LessThan, volume_margin)
anIds = mesh.GetIdsFromFilter(aFilter)
print ""
# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, "Volume < " + `volume_margin`)
+aGroup = mesh.CreateEmptyGroup(SMESH.VOLUME, "Volume < " + `volume_margin`)
aGroup.Add(anIds)
# Element Diameter 3D
import SMESH_mechanic_tetra
+import SMESH
smesh = SMESH_mechanic_tetra.smesh
mesh = SMESH_mechanic_tetra.mesh
# Criterion : ELEMENT DIAMETER 3D > 10
mel_3d_margin = 10
-aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength3D, smesh.FT_MoreThan, mel_3d_margin)
+aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MaxElementLength3D, SMESH.FT_MoreThan, mel_3d_margin)
anIds = mesh.GetIdsFromFilter(aFilter)
print ""
# create a group
-aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Element Diameter 3D > " + `mel_3d_margin`)
+aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Element Diameter 3D > " + `mel_3d_margin`)
aGroup.Add(anIds)
salome.sg.updateObjBrowser(1)
# Translation
import SMESH_mechanic
+import SMESH
smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
# define translation vector
-point = smesh.PointStruct(-150., -150., 0.)
-vector =smesh.DirStruct(point)
+point = SMESH.PointStruct(-150., -150., 0.)
+vector =SMESH.DirStruct(point)
# translate a mesh
doCopy = 1
import math
import SMESH_mechanic
+import SMESH
smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
# define rotation axis and angle
-axisXYZ = smesh.AxisStruct(0., 0., 0., 5., 5., 20.)
+axisXYZ = SMESH.AxisStruct(0., 0., 0., 5., 5., 20.)
angle270 = 1.5 * math.pi
# rotate a mesh
# Scale
-import geompy
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+
Box = geompy.MakeBoxDXDYDZ(200, 200, 200)
f = geompy.SubShapeAllSorted(Box, geompy.ShapeType["FACE"])
-import smesh,SMESH
-import StdMeshers
Mesh1 = smesh.Mesh(f[0])
Regular_1D = Mesh1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(3)
import math
import SMESH_mechanic
+import SMESH
smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
# create a symmetrical copy of the mesh mirrored through a point
-axis = smesh.AxisStruct(0, 0, 0, 0, 0, 0)
+axis = SMESH.AxisStruct(0, 0, 0, 0, 0, 0)
mesh.Mirror([], axis, smesh.POINT, 1)
# Merging Elements
+
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create a face to be meshed
px = geompy.MakeVertex(100., 0. , 0. )
# extrusion of the mesh
trias.ExtrusionAlongPath([], circlemesh, circle,
- 1, 0, [], 0, smesh.PointStruct(0, 0, 0))
+ 1, 0, [], 0, SMESH.PointStruct(0, 0, 0))
# merge nodes
print "Number of nodes before MergeNodes:",
# Sew Meshes Border to Side
-import geompy
-import smesh
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create two faces of a box
box1 = geompy.MakeBox(0., 0., -10., 30., 20., 25.)
# Sew Conform Free Borders
-import geompy
-import smesh
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
# create two faces of the box
box1 = geompy.MakeBox(0., 0., -10., 20., 20., 15.)
# Sew Free Borders
-import geompy
-import smesh
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create two faces of the box
box1 = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
# Sew Side Elements
-import geompy
-import smesh
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create two boxes
box1 = geompy.MakeBox(0., 0., 0., 10., 10., 10.)
# Duplicate nodes
+
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# Create a box
# Without the duplication of border elements
# Nodes to duplicate
-nodes1 = mesh.CreateEmptyGroup( smesh.NODE, 'nodes1' )
+nodes1 = mesh.CreateEmptyGroup( SMESH.NODE, 'nodes1' )
nodes1.Add( [ 119, 125, 131, 137 ] )
# Group of faces to replace nodes with new ones
-faces1 = mesh.CreateEmptyGroup( smesh.FACE, 'faces1' )
+faces1 = mesh.CreateEmptyGroup( SMESH.FACE, 'faces1' )
faces1.Add( [ 144, 151, 158 ] )
# Duplicate nodes
# With the duplication of border elements
# Edges to duplicate
-edges = mesh.CreateEmptyGroup( smesh.EDGE, 'edges' )
+edges = mesh.CreateEmptyGroup( SMESH.EDGE, 'edges' )
edges.Add( [ 32, 33, 34 ] )
# Nodes not to duplicate
-nodes2 = mesh.CreateEmptyGroup( smesh.NODE, 'nodes2' )
+nodes2 = mesh.CreateEmptyGroup( SMESH.NODE, 'nodes2' )
nodes2.Add( [ 35, 38 ] )
# Group of faces to replace nodes with new ones
-faces2 = mesh.CreateEmptyGroup( smesh.FACE, 'faces2' )
+faces2 = mesh.CreateEmptyGroup( SMESH.FACE, 'faces2' )
faces2.Add( [ 141, 148, 155 ] )
# Duplicate nodes
# Create boundary elements
-from smesh import *
-SetCurrentStudy(salome.myStudy)
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
box = geompy.MakeBoxDXDYDZ(100, 100, 100)
gFaces = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])
## -----------
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)
# Reorient faces by vector
-import smesh, geompy, SMESH
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
# create a geometry consisting of two faces
box = geompy.MakeBoxDXDYDZ( 10, 10, 10 )
# Use existing faces algorithm
-import smesh, geompy
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+import salome_notebook
+
import numpy as np
# define my 2D algorithm
# Viewing Mesh Infos
-import geompy
-import smesh
-import SMESH
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create a box
box = geompy.MakeBox(0., 0., 0., 20., 20., 20.)
# Find Element by Point
-import geompy
-import smesh
-import SMESH
+
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# Create a geometry to mesh
box = geompy.MakeBoxDXDYDZ(100,100,100)
DOC_LD_LIBRARY_PATH=$(prefix)lib/salome:${MED_ROOT_DIR}/lib/salome:${GEOM_ROOT_DIR}/lib/salome:${KERNEL_ROOT_DIR}/lib/salome
DOC_SMESH_MeshersList=StdMeshers
-# to have smesh.py in the documentation instead of smeshDC.py
-# we create dummy smesh.py from the smeshDC.py
-smesh.py: ../../../../src/SMESH_SWIG/smeshDC.py
- @awk '/^class Mesh:/ { mesh_found=1 } // { if (mesh_found) {print $$0; next} } /^ +(def|#)/ { match( $$0, /^ +/); print substr( $$0, 1+RLENGTH ); next } /^class smeshDC/ { next } //' \
- $< > $@
-
-tmp/smesh.py: $(top_srcdir)/src/SMESH_SWIG/StdMeshersDC.py $(srcdir)/collect_mesh_methods.py
- @mkdir -p tmp && PYTHONPATH=$(DOC_PYTHONPATH):${PYTHONPATH} LD_LIBRARY_PATH=$(DOC_LD_LIBRARY_PATH):${LD_LIBRARY_PATH} SMESH_MeshersList=$(DOC_SMESH_MeshersList) $(PYTHON) $(srcdir)/collect_mesh_methods.py -o $@ StdMeshers
-
-usr_docs: doxyfile_py doxyfile smesh.py tmp/smesh.py
+usr_docs: doxyfile_py doxyfile
@$(DOXYGEN) doxyfile_py ; \
$(DOXYGEN) doxyfile
#---------------------------------------------------------------------------
#Input related options
#---------------------------------------------------------------------------
-INPUT = smesh.py \
+INPUT = @top_srcdir@/src/SMESH_SWIG/smeshBuilder.py \
@top_srcdir@/src/SMESH_SWIG/smesh_algorithm.py \
- @top_srcdir@/src/SMESH_SWIG/StdMeshersDC.py \
- tmp/smesh.py
+ @top_srcdir@/src/SMESH_SWIG/StdMeshersBuilder.py
FILE_PATTERNS =
IMAGE_PATH = @srcdir@/images
RECURSIVE = NO
- <a href="smeshpy_doc/modules.html">Structured documentation</a>, where all methods and
classes are grouped by their functionality, like it is done in the GUI documentation
- <a href="smeshpy_doc/namespaces.html">Linear documentation</a> grouped only by classes, declared
-in the \ref smesh and StdMeshersDC Python packages.
+in the \ref SMESH_SWIG.smeshBuilder "smeshBuilder" and \ref SMESH_SWIG.StdMeshersBuilder "StdMeshersBuilder" Python packages.
-Python package \ref smesh provides an interface to create and handle
+Class \ref SMESH_SWIG.smeshBuilder.smeshBuilder "smeshBuilder" provides an interface to create and handle
meshes. It can be used to create an empty mesh or to import mesh from the data file.
As soon as mesh is created, it is possible to manage it via its own
-methods, described in \ref smesh.Mesh "class Mesh" documentation.
+methods, described in \ref SMESH_SWIG.smeshBuilder.Mesh "class Mesh" documentation.
-Class \ref smesh.Mesh "Mesh" allows assigning algorithms to a mesh.
+Class \ref SMESH_SWIG.smeshBuilder.Mesh "Mesh" allows assigning algorithms to a mesh.
Please note that some algorithms, included in the standard SALOME
-distribution are always available. Python package \ref StdMeshersDC
+distribution are always available. Python package \ref SMESH_SWIG.StdMeshersBuilder "StdMeshersBuilder"
provides an interface for standard meshing algorithms included into
the SALOME %Mesh module distribution, like:
- REGULAR (1D)
\section filter_aspect_ratio Aspect ratio
Filter 2D mesh elements (faces) according to the aspect ratio value:
-- element type should be \a smesh.FACE
-- functor type should be \a smesh.FT_AspectRatio
+- element type should be \a SMESH.FACE
+- functor type should be \a SMESH.FT_AspectRatio
- threshold is floating point value (aspect ratio)
\tui_script{filters_ex01.py}
\section filter_aspect_ratio_3d Aspect ratio 3D
Filter 3D mesh elements (volumes) according to the aspect ratio value:
-- element type is \a smesh.VOLUME
-- functor type is \a smesh.FT_AspectRatio3D
+- element type is \a SMESH.VOLUME
+- functor type is \a SMESH.FT_AspectRatio3D
- threshold is floating point value (aspect ratio)
\tui_script{filters_ex02.py}
\section filter_warping_angle Warping angle
Filter 2D mesh elements (faces) according to the warping angle value:
-- element type is \a smesh.FACE
-- functor type is \a smesh.FT_Warping
+- element type is \a SMESH.FACE
+- functor type is \a SMESH.FT_Warping
- threshold is floating point value (warping angle)
\tui_script{filters_ex03.py}
\section filter_minimum_angle Minimum angle
Filter 2D mesh elements (faces) according to the minimum angle value:
-- element type is \a smesh.FACE
-- functor type is \a smesh.FT_MinimumAngle
+- element type is \a SMESH.FACE
+- functor type is \a SMESH.FT_MinimumAngle
- threshold is floating point value (minimum angle)
\tui_script{filters_ex04.py}
\section filter_taper Taper
Filter 2D mesh elements (faces) according to the taper value:
-- element type is \a smesh.FACE
-- functor type is \a smesh.FT_Taper
+- element type is \a SMESH.FACE
+- functor type is \a SMESH.FT_Taper
- threshold is floating point value (taper)
\tui_script{filters_ex05.py}
\section filter_skew Skew
Filter 2D mesh elements (faces) according to the skew value:
-- element type is \a smesh.FACE
-- functor type is \a smesh.FT_Skew
+- element type is \a SMESH.FACE
+- functor type is \a SMESH.FT_Skew
- threshold is floating point value (skew)
\tui_script{filters_ex06.py}
\section filter_area Area
Filter 2D mesh elements (faces) according to the area value:
-- element type is \a smesh.FACE
-- functor type is \a smesh.FT_Area
+- element type is \a SMESH.FACE
+- functor type is \a SMESH.FT_Area
- threshold is floating point value (area)
\tui_script{filters_ex07.py}
\section filter_volume Volume
Filter 3D mesh elements (volumes) according to the volume value:
-- element type is \a smesh.VOLUME
-- functor type is \a smesh.FT_Volume3D
+- element type is \a SMESH.VOLUME
+- functor type is \a SMESH.FT_Volume3D
- threshold is floating point value (volume)
\tui_script{filters_ex08.py}
\section filter_free_borders Free borders
Filter 1D mesh elements (edges) which represent free borders of a mesh:
-- element type is \a smesh.EDGE
-- functor type is \a smesh.FT_FreeBorders
+- element type is \a SMESH.EDGE
+- functor type is \a SMESH.FT_FreeBorders
- threshold value is not required
\tui_script{filters_ex09.py}
Filter 2D mesh elements (faces) consisting of edges belonging to one
element of mesh only:
-- element type is \a smesh.FACE
-- functor type is \a smesh.FT_FreeEdges
+- element type is \a SMESH.FACE
+- functor type is \a SMESH.FT_FreeEdges
- threshold value is not required
\tui_script{filters_ex10.py}
\section filter_free_nodes Free nodes
Filter free nodes:
-- element type is \a smesh.NODE
-- functor type is \a smesh.FT_FreeNodes
+- element type is \a SMESH.NODE
+- functor type is \a SMESH.FT_FreeNodes
- threshold value is not required
\tui_script{filters_ex11.py}
\section filter_free_faces Free faces
Filter free faces:
-- element type is \a smesh.FACE
-- functor type is \a smesh.FT_FreeFaces
+- element type is \a SMESH.FACE
+- functor type is \a SMESH.FT_FreeFaces
- threshold value is not required
\tui_script{filters_ex12.py}
\section filter_bare_border_faces Bare border faces
Filter faces with bare borders:
-- element type is \a smesh.FACE
-- functor type is \a smesh.FT_BareBorderFace
+- element type is \a SMESH.FACE
+- functor type is \a SMESH.FT_BareBorderFace
- threshold value is not required
\tui_script{filters_ex13.py}
\section filter_coplanar_faces Coplanar faces
Filter faces with bare borders:
-- element type is \a smesh.FACE
-- functor type is \a smesh.FT_CoplanarFaces
+- element type is \a SMESH.FACE
+- functor type is \a SMESH.FT_CoplanarFaces
- threshold value is the face ID
- tolerance is in degrees
\section filter_over_constrained_faces Over-constrained faces
Filter over-constrained faces:
-- element type is \a smesh.FACE
-- functor type is \a smesh.FT_OverConstrainedFace
+- element type is \a SMESH.FACE
+- functor type is \a SMESH.FT_OverConstrainedFace
- threshold value is not required
\tui_script{filters_ex15.py}
\section filter_double_elements Double edges, Double faces, Double volumes
filter mesh elements basing on the same set of nodes:
-- element type is either \a smesh.EGDE, \a smesh.FACE or \a smesh.VOLUME
-- functor type is either \a smesh.FT_EqualEdges, \a
- smesh.FT_EqualFaces or \a smesh.FT_EqualVolumes,
+- element type is either \a smesh.EGDE, \a SMESH.FACE or \a SMESH.VOLUME
+- functor type is either \a SMESH.FT_EqualEdges, \a
+ SMESH.FT_EqualFaces or \a SMESH.FT_EqualVolumes,
- threshold value is not required
\tui_script{filters_ex16.py}
\section tui_double_nodes_control Double nodes
filters mesh nodes which are coincident with other nodes (within a given tolerance):
-- element type is \a smesh.NODE
-- functor type is \a smesh.FT_EqualNodes
+- element type is \a SMESH.NODE
+- functor type is \a SMESH.FT_EqualNodes
- threshold value is not required
- default tolerance is 1.0e-7
Filter border 1D mesh elements (edges) according to the specified number of
connections (faces belonging the border edges)
-- element type is \a smesh.EDGE
-- functor type is \a smesh.FT_MultiConnection
+- element type is \a SMESH.EDGE
+- functor type is \a SMESH.FT_MultiConnection
- threshold is integer value (number of connections)
\tui_script{filters_ex18.py}
Filter 2D mesh elements (faces) which consist of edges belonging
to the specified number of mesh elements
-- element type is \a smesh.FACE
-- functor type is \a smesh.FT_MultiConnection2D
+- element type is \a SMESH.FACE
+- functor type is \a SMESH.FT_MultiConnection2D
- threshold is integer value (number of connections)
\tui_script{filters_ex19.py}
\section filter_length Length
Filter 1D mesh elements (edges) according to the edge length value:
-- element type should be \a smesh.EDGE
-- functor type should be \a smesh.FT_Length
+- element type should be \a SMESH.EDGE
+- functor type should be \a SMESH.FT_Length
- threshold is floating point value (length)
\tui_script{filters_ex20.py}
Filter 2D mesh elements (faces) corresponding to the maximum length.
value of its edges:
-- element type should be \a smesh.FACE
-- functor type should be \a smesh.FT_Length2D
+- element type should be \a SMESH.FACE
+- functor type should be \a SMESH.FT_Length2D
- threshold is floating point value (edge length)
\tui_script{filters_ex21.py}
Filter 2D mesh elements (faces) corresponding to the maximum length
value of its edges and diagonals:
-- element type should be \a smesh.FACE
-- functor type should be \a smesh.FT_MaxElementLength2D
+- element type should be \a SMESH.FACE
+- functor type should be \a SMESH.FT_MaxElementLength2D
- threshold is floating point value (edge/diagonal length)
\tui_script{filters_ex22.py}
Filter 3D mesh elements (volumes) corresponding to the maximum length
value of its edges and diagonals:
-- element type should be \a smesh.VOLUME
-- functor type should be \a smesh.FT_MaxElementLength3D
+- element type should be \a SMESH.VOLUME
+- functor type should be \a SMESH.FT_MaxElementLength3D
- threshold is floating point value (edge/diagonal length)
\tui_script{filters_ex23.py}
\section filter_bare_border_volumes Bare border volumes
Filter 3D mesh elements with bare borders:
-- element type is \a smesh.VOLUME
-- functor type is \a smesh.FT_BareBorderVolume
+- element type is \a SMESH.VOLUME
+- functor type is \a SMESH.FT_BareBorderVolume
- threshold value is not required
\tui_script{filters_ex24.py}
\section filter_over_constrained_volumes Over-constrained volumes
Filter over-constrained volumes:
-- element type is \a smesh.VOLUME
-- functor type is \a smesh.FT_OverConstrainedVolume
+- element type is \a SMESH.VOLUME
+- functor type is \a SMESH.FT_OverConstrainedVolume
- threshold value is not required
\tui_script{filters_ex25.py}
Filter mesh entities (nodes or elements) which all nodes lie on the
shape defined by threshold value:
-- element type can be any entity type, from \a smesh.NODE to \a smesh.VOLUME
-- functor type should be \a smesh.FT_BelongToGeom
+- element type can be any entity type, from \a SMESH.NODE to \a SMESH.VOLUME
+- functor type should be \a SMESH.FT_BelongToGeom
- threshold is geometrical object
\tui_script{filters_ex26.py}
Filter mesh entities (nodes or elements) at least one node of which lies on the
shape defined by threshold value:
-- element type can be any entity type, from \a smesh.NODE to \a smesh.VOLUME
-- functor type should be \a smesh.FT_LyingOnGeom
+- element type can be any entity type, from \a SMESH.NODE to \a SMESH.VOLUME
+- functor type should be \a SMESH.FT_LyingOnGeom
- threshold is geometrical object
\tui_script{filters_ex27.py}
Filter mesh entities (nodes or elements) which all nodes belong to the
plane defined by threshold value with the given tolerance:
-- element type can be: \a smesh.NODE, \a smesh.EDGE, \a smesh.FACE
-- functor type should be \a smesh.FT_BelongToPlane
+- element type can be: \a SMESH.NODE, \a SMESH.EDGE, \a SMESH.FACE
+- functor type should be \a SMESH.FT_BelongToPlane
- threshold is geometrical object (plane)
- default tolerance is 1.0e-7
Filter mesh entities (nodes or elements) which all nodes belong to the
cylindrical face defined by threshold value with the given tolerance:
-- element type can be: \a smesh.NODE, \a smesh.EDGE, \a smesh.FACE
-- functor type should be \a smesh.FT_BelongToCylinder
+- element type can be: \a , \a SMESH.EDGE, \a SMESH.FACE
+- functor type should be \a SMESH.FT_BelongToCylinder
- threshold is geometrical object (cylindrical face)
- default tolerance is 1.0e-7
Filter mesh entities (nodes or elements) which all nodes belong to the
arbitrary surface defined by threshold value with the given tolerance:
-- element type can be: \a smesh.NODE, \a smesh.EDGE, \a smesh.FACE
-- functor type should be \a smesh.FT_BelongToGenSurface
+- element type can be: \a SMESH.NODE, \a SMESH.EDGE, \a SMESH.FACE
+- functor type should be \a SMESH.FT_BelongToGenSurface
- threshold is geometrical object (arbitrary surface)
- default tolerance is 1.0e-7
Filter mesh entities elements (nodes or elements) according to the
specified identifiers range:
-- element type can be any entity type, from \a smesh.NODE to \a smesh.VOLUME
-- functor type is \a smesh.FT_RangeOfIds
+- element type can be any entity type, from \a SMESH.NODE to \a SMESH.VOLUME
+- functor type is \a SMESH.FT_RangeOfIds
- threshold is string listing required IDs and/or ranges of IDs, e.g."1,2,3,50-60,63,67,70-78"
\tui_script{filters_ex31.py}
Filter 3D mesh elements (volumes), which are incorrectly oriented from
the point of view of MED convention.
-- element type should be \a smesh.VOLUME
-- functor type is \a smesh.FT_BadOrientedVolume
+- element type should be \a SMESH.VOLUME
+- functor type is \a SMESH.FT_BadOrientedVolume
- threshold is not required
\tui_script{filters_ex32.py}
\section filter_linear_or_quadratic Linear / quadratic
Filter linear / quadratic mesh elements:
-- element type should be any element type, e.g.: \a smesh.EDGE, \a smesh.FACE, \a smesh.VOLUME
-- functor type is \a smesh.FT_LinearOrQuadratic
+- element type should be any element type, e.g.: \a SMESH.EDGE, \a SMESH.FACE, \a SMESH.VOLUME
+- functor type is \a SMESH.FT_LinearOrQuadratic
- threshold is not required
-- if unary operator is set to smesh.FT_LogicalNOT, the quadratic
+- if unary operator is set to SMESH.FT_LogicalNOT, the quadratic
elements are selected, otherwise (by default) linear elements are selected
\tui_script{filters_ex33.py}
\section filter_group_color Group color
Filter mesh entities, belonging to the group with the color defined by the threshold value.
-- element type can be any entity type, from \a smesh.NODE to \a smesh.VOLUME
-- functor type is \a smesh.FT_GroupColor
+- element type can be any entity type, from \a SMESH.NODE to \a SMESH.VOLUME
+- functor type is \a SMESH.FT_GroupColor
- threshold should be of SALOMEDS.Color type
\tui_script{filters_ex34.py}
Filter mesh elements by the geometric type defined with the threshold
value. The list of available geometric types depends on the element
entity type.
-- element type should be any element type, e.g.: \a smesh.EDGE, \a smesh.FACE, \a smesh.VOLUME
-- functor type should be \a smesh.FT_ElemGeomType
+- element type should be any element type, e.g.: \a SMESH.EDGE, \a SMESH.FACE, \a SMESH.VOLUME
+- functor type should be \a SMESH.FT_ElemGeomType
- threshold is of smesh.GeometryType value
\tui_script{filters_ex35.py}
output ="EDGE"
dim ="1">
<python-wrap>
- <algo>CompositeSegment_1D=Segment(algo=smesh.COMPOSITE)</algo>
+ <algo>CompositeSegment_1D=Segment(algo=smeshBuilder.COMPOSITE)</algo>
<hypo>LocalLength=LocalLength(SetLength(), ,SetPrecision())</hypo>
<hypo>MaxLength=MaxSize(SetLength())</hypo>
<hypo>Arithmetic1D=Arithmetic1D(SetStartLength(),SetEndLength(),SetReversedEdges())</hypo>
output="EDGE"
dim="1">
<python-wrap>
- <algo>Python_1D=Segment(algo=smesh.PYTHON)</algo>
+ <algo>Python_1D=Segment(algo=smeshBuilder.PYTHON)</algo>
<hypo>PythonSplit1D=PythonSplit1D(SetNumberOfSegments(),SetPythonLog10RatioFunction())</hypo>
</python-wrap>
</algorithm>
output ="TRIA"
dim ="2">
<python-wrap>
- <algo>MEFISTO_2D=Triangle(algo=smesh.MEFISTO)</algo>
+ <algo>MEFISTO_2D=Triangle(algo=smeshBuilder.MEFISTO)</algo>
<hypo>LengthFromEdges=LengthFromEdges()</hypo>
<hypo>MaxElementArea=MaxElementArea(SetMaxElementArea())</hypo>
<hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges())</hypo>
output ="QUAD"
dim ="2">
<python-wrap>
- <algo>Quadrangle_2D=Quadrangle(algo=smesh.QUADRANGLE)</algo>
+ <algo>Quadrangle_2D=Quadrangle(algo=smeshBuilder.QUADRANGLE)</algo>
<hypo>QuadrangleParams=QuadrangleParameters(SetQuadType(),SetTriaVertex())</hypo>
<hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges())</hypo>
</python-wrap>
opt-hypos="ViscousLayers"
dim ="3">
<python-wrap>
- <algo>Hexa_3D=Hexahedron(algo=smesh.Hexa)</algo>
+ <algo>Hexa_3D=Hexahedron(algo=smeshBuilder.Hexa)</algo>
<hypo>ViscousLayers=ViscousLayers(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreFaces())</hypo>
</python-wrap>
</algorithm>
output ="QUAD,TRIA"
dim ="2">
<python-wrap>
- <algo>RadialQuadrangle_1D2D=Quadrangle(algo=smesh.RADIAL_QUAD)</algo>
+ <algo>RadialQuadrangle_1D2D=Quadrangle(algo=smeshBuilder.RADIAL_QUAD)</algo>
<hypo>NumberOfLayers2D=NumberOfLayers(SetNumberOfLayers())</hypo>
</python-wrap>
</algorithm>
// File : SMESH_Object.h
// Author : Nicolas REJNERI
// Module : SMESH
-// $Header$
//
#ifndef SMESH_OBJECT_H
#define SMESH_OBJECT_H
// File : SMESH_Object.h
// Author : Nicolas REJNERI
// Module : SMESH
-// $Header$
//
#ifndef SMESH_OBJECTDEF_H
#define SMESH_OBJECTDEF_H
//================================================================================
/*!
- * \brief Convert a python script using commands of smesh.py
+ * \brief Convert a python script using commands of smeshBuilder.py
* \param theScript - Input script
* \param theEntry2AccessorMethod - returns method names to access to
* objects wrapped with python class
//================================================================================
/*!
- * \brief name of SMESH_Gen in smesh.py
+ * \brief name of SMESH_Gen in smeshBuilder.py
*/
//================================================================================
// Replace name of SMESH_Gen
- // names of SMESH_Gen methods fully equal to methods defined in smesh.py
+ // names of SMESH_Gen methods fully equal to methods defined in smeshBuilder.py
static TStringSet smeshpyMethods;
if ( smeshpyMethods.empty() ) {
const char * names[] =
* This file was created in order to respond to requirement of bug PAL10494:
* SMESH python dump uses idl interface.
*
- * The creation reason is that smesh.py commands defining hypotheses encapsulate
- * several SMESH engine method calls. As well, the dependencies between smesh.py
+ * The creation reason is that smeshBuilder.py commands defining hypotheses encapsulate
+ * several SMESH engine method calls. As well, the dependencies between smeshBuilder.py
* classes differ from ones between corresponding SMESH IDL interfaces.
*
* Everything here is for internal usage by SMESH_2smeshpy::ConvertScript()
aScript += helper + "aFilterManager = " + aSMESHGen + ".CreateFilterManager()\n\t";
aScript += helper + "aMeasurements = " + aSMESHGen + ".CreateMeasurements()\n\t";
if ( isPublished )
- aScript += aSMESHGen + ".SetCurrentStudy(theStudy)";
+ aScript += aSMESHGen + " = smeshBuilder.New(theStudy)";
else
- aScript += aSMESHGen + ".SetCurrentStudy(None)";
+ aScript += aSMESHGen + " = smeshBuilder.New(None)";
// import python files corresponding to plugins
set<string> moduleNameSet;
string moduleName = hyp_creator->second->GetModuleName();
bool newModule = moduleNameSet.insert( moduleName ).second;
if ( newModule )
- aScript += helper + "\n\t" + "import " + (char*) moduleName.c_str();
+ aScript += helper + "\n\t" + "from salome." + (char*) moduleName.c_str() + " import " + (char*) moduleName.c_str() +"Builder";
}
// Dump trace of restored study
if (theSavedTrace.Length() > 0) {
- // For the convertion of IDL API calls -> smesh.py API, "smesh" standing for SMESH_Gen
+ // For the convertion of IDL API calls -> smeshBuilder.py API, "smesh" standing for SMESH_Gen
// was replaces with "smeshgen" (==TPythonDump::SMESHGenName()).
- // Change "smesh" -> "smeshgen" in the trace saved before passage to smesh.py API
+ // Change "smesh" -> "smeshgen" in the trace saved before passage to smeshBuilder.py API
bool isNewVersion =
theSavedTrace.Location( anOldGen + ".", 1, theSavedTrace.Length() );
if ( !isNewVersion ) {
aScript += helper + "\n" + aNewLines;
}
- // Convert IDL API calls into smesh.py API.
+ // Convert IDL API calls into smeshBuilder.py API.
// Some objects are wrapped with python classes and
// Resource_DataMapOfAsciiStringAsciiString holds methods returning wrapped objects
Resource_DataMapOfAsciiStringAsciiString anEntry2AccessorMethod;
TCollection_AsciiString initPart = "import ";
if ( isMultiFile )
initPart += helper + "salome, ";
- initPart += aSmeshpy + ", SMESH, SALOMEDS\n";
+ initPart += " SMESH, SALOMEDS\n";
+ initPart += "from salome.smesh import smeshBuilder\n";
if ( importGeom && isMultiFile )
{
initPart += ("\n## import GEOM dump file ## \n"
if ( aRemovedObjIDs.count( seqRemoved.Value(ir) )) continue;
anUpdatedScript += "\n\tSO = theStudy.FindObjectIOR(theStudy.ConvertObjectToIOR(";
anUpdatedScript += seqRemoved.Value(ir);
- // for object wrapped by class of smesh.py
+ // for object wrapped by class of smeshBuilder.py
anEntry = theObjectNames( seqRemoved.Value(ir) );
if ( anEntry2AccessorMethod.IsBound( anEntry ) )
anUpdatedScript += helper + "." + anEntry2AccessorMethod( anEntry );
{
public:
/*!
- * \brief Convert a python script using commands of smesh.py
+ * \brief Convert a python script using commands of smeshBuilder.py
* \param theScript - Input script
* \param theEntry2AccessorMethod - returns method names to access to
* objects wrapped with python class
# Scripts to be installed.
dist_salomescript_PYTHON = \
smesh.py \
- smeshDC.py \
- smesh_algorithm.py \
- StdMeshersDC.py \
batchmode_smesh.py \
batchmode_mefisto.py \
ex00_all.py \
PAL_MESH_043_3D.py \
SMESH_reg.py
+mypkgpythondir = $(salomepythondir)/salome/smesh
+mypkgpython_PYTHON = \
+ smeshBuilder.py \
+ smesh_algorithm.py
+
+stdpkgpythondir = $(salomepythondir)/salome/StdMeshers
+stdpkgpython_PYTHON = \
+ __init__.py \
+ StdMeshersBuilder.py
+
sharedpkgpython_PYTHON = \
SMESH_shared_modules.py
#
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
#-----------------------------GEOM----------------------------------------
#-----------------------------SMESH-------------------------------------------
-smesh.SetCurrentStudy(salome.myStudy)
# -- Init mesh --
plane_mesh = salome.IDToObject( Id_face1)
# Description : Create meshes to test extrusion of mesh elements along path
#
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
#----------------------------------GEOM
#---------------------------------SMESH
-smesh.SetCurrentStudy(salome.myStudy)
# create the path mesh
mesh1 = smesh.Mesh(ellipse1, "Path Mesh")
# Description : Create meshes to test extrusion of mesh elements along path
#
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# create points to build two circles
idface = geompy.addToStudy(face, "Circular face")
-smesh.SetCurrentStudy(salome.myStudy)
-
# init a Mesh with the circular face
mesh1 = smesh.Mesh(face, "Mesh on circular face")
#
import salome
-import smesh
-import math
-
salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+
+import math
def GetNewNodes(mesh,Elems,OldNodes):
"""
pass
return newnodes
-smesh.SetCurrentStudy(salome.myStudy)
# create empty mesh
mesh = smesh.Mesh()
n1 = mesh.AddNode(55,-5,0)
n2 = mesh.AddNode(55,5,0)
e1 = mesh.AddEdge([n1,n2])
-dir1 = smesh.DirStruct(smesh.PointStruct(-10,0,0))
+dir1 = SMESH.DirStruct(SMESH.PointStruct(-10,0,0))
mesh.ExtrusionSweep([e1],dir1,11)
# 2. create second edge and make extrusion along 0y
n3 = mesh.AddNode(-5,-55,0)
n4 = mesh.AddNode(5,-55,0)
e2 = mesh.AddEdge([n3,n4])
-dir2 = smesh.DirStruct(smesh.PointStruct(0,10,0))
+dir2 = SMESH.DirStruct(SMESH.PointStruct(0,10,0))
mesh.ExtrusionSweep([e2],dir2,11)
# since result has coincident nodes and faces
mesh.MergeEqualElements()
# make extrusion faces along 0z
-faces = mesh.GetElementsByType(smesh.FACE)
+faces = mesh.GetElementsByType(SMESH.FACE)
nbf = len(faces)
maxang = 2.0
zstep = 5
nbzsteps = 50
-dir3 = smesh.DirStruct(smesh.PointStruct(0,0,zstep))
+dir3 = SMESH.DirStruct(SMESH.PointStruct(0,0,zstep))
newfaces = [] # list for keeping created top faces
# during extrusion
pass
# rotate faces from newfaces
-axisr1 = smesh.AxisStruct(0,0,0,0,0,1)
+axisr1 = SMESH.AxisStruct(0,0,0,0,0,1)
for i in range(0,nbzsteps):
ang = maxang*(1-math.cos((i+1)*math.pi/nbzsteps))
mesh.Rotate(newfaces[i],axisr1,ang,0)
n7 = mesh.AddNode(70,0,0)
e56 = mesh.AddEdge([n5,n6])
e67 = mesh.AddEdge([n6,n7])
-axisr2 = smesh.AxisStruct(65,0,0,0,1,0)
+axisr2 = SMESH.AxisStruct(65,0,0,0,1,0)
mesh.RotationSweep([e56,e67],axisr2, math.pi/6, 12, tol)
res = mesh.GetLastCreatedElems()
faces1 = []
n10 = mesh.AddNode(-70,0,0)
e8 = mesh.AddEdge([n8,n9])
e9 = mesh.AddEdge([n9,n10])
-axisr3 = smesh.AxisStruct(-65,0,0,0,-1,0)
+axisr3 = SMESH.AxisStruct(-65,0,0,0,-1,0)
mesh.RotationSweep([e8,e9],axisr3, math.pi/6, 12, tol)
res = mesh.GetLastCreatedElems()
faces2 = []
oldnodes = newnodes
pass
-smesh.salome.sg.updateObjBrowser(1)
+salome.sg.updateObjBrowser(1)
## Old style
def CheckBelongToGeomFilterOld(theMeshGen, theMesh, theShape, theSubShape, theElemType):
- import geompy
if theShape != theSubShape:
aName = str(theSubShape)
geompy.addToStudyInFather(theShape,theSubShape,aName)
## Current style
def CheckBelongToGeomFilter(theMesh, theShape, theSubShape, theElemType):
- import geompy
- import smesh
if theShape != theSubShape:
aName = str(theSubShape)
geompy.addToStudyInFather(theShape,theSubShape,aName)
theMesh.Compute()
- aFilter = smesh.GetFilter(theElemType, smesh.FT_BelongToGeom, theSubShape)
+ aFilter = smesh.GetFilter(theElemType, SMESH.FT_BelongToGeom, theSubShape)
return aFilter.GetElementsId(theMesh.GetMesh())
-anElemType = smesh.FACE;
+anElemType = SMESH.FACE;
print "anElemType =", anElemType
#anIds = CheckBelongToGeomFilter(mesh,box,subShapeList[1],anElemType)
anIds = CheckBelongToGeomFilter(mesh,box,box,anElemType)
print "Number of ids = ", len(anIds)
print "anIds = ", anIds
## Check old version
-#anIds = CheckBelongToGeomFilterOld(smesh.smesh,mesh.GetMesh(),box,box,anElemType)
+#anIds = CheckBelongToGeomFilterOld(smesh,mesh.GetMesh(),box,box,anElemType)
#print "anIds = ", anIds
salome.sg.updateObjBrowser(1);
# ! documentation generation to identify certain places of this file
#
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
## 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)
## create a bottom mesh
Mesh_inf = smesh.Mesh(Box_inf, "Mesh_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.smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 0, 1, 1e-05)
+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
# creating groups of all elements
-Compound2 = smesh.smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 1, 0, 1e-05, True)
+Compound2 = smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 1, 0, 1e-05, True)
smesh.SetName(Compound2, 'Compound_with_UniteGrps_and_GrpsOfAllElems')
#end
geompy.addToStudy(aGeomGroup1, "Group on Faces")
geompy.addToStudy(aGeomGroup2, "Group on Edges")
-aSmeshGroup1 = mesh.GroupOnGeom(aGeomGroup1, "SMESHGroup1", smesh.FACE)
-aSmeshGroup2 = mesh.GroupOnGeom(aGeomGroup2, "SMESHGroup2", smesh.EDGE)
+aSmeshGroup1 = mesh.GroupOnGeom(aGeomGroup1, "SMESHGroup1", SMESH.FACE)
+aSmeshGroup2 = mesh.GroupOnGeom(aGeomGroup2, "SMESHGroup2", SMESH.EDGE)
salome.sg.updateObjBrowser(1);
geompy.addToStudy(aGeomGroup1, "Group on Faces")
geompy.addToStudy(aGeomGroup2, "Group on Edges")
-aSmeshGroup1 = mesh.GroupOnGeom(aGeomGroup1, "SMESHGroup1", smesh.FACE)
-aSmeshGroup2 = mesh.GroupOnGeom(aGeomGroup2, "SMESHGroup2", smesh.EDGE)
+aSmeshGroup1 = mesh.GroupOnGeom(aGeomGroup1, "SMESHGroup1", SMESH.FACE)
+aSmeshGroup2 = mesh.GroupOnGeom(aGeomGroup2, "SMESHGroup2", SMESH.EDGE)
print "Create aGroupOnShell - a group linked to a shell"
-aGroupOnShell = mesh.GroupOnGeom(shell, "GroupOnShell", smesh.EDGE)
+aGroupOnShell = mesh.GroupOnGeom(shell, "GroupOnShell", SMESH.EDGE)
print "aGroupOnShell type =", aGroupOnShell.GetType()
print "aGroupOnShell size =", aGroupOnShell.Size()
print "aGroupOnShell ids :", aGroupOnShell.GetListOfID()
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-import salome
-import smesh
-
-smesh.SetCurrentStudy(salome.myStudy)
-
def BuildGroupLyingOn(theMesh, theElemType, theName, theShape):
- aFilterMgr = smesh.smesh.CreateFilterManager()
+ aFilterMgr = smesh.CreateFilterManager()
aFilter = aFilterMgr.CreateFilter()
aLyingOnGeom = aFilterMgr.CreateLyingOnGeom()
mesh.Compute()
# First way
-BuildGroupLyingOn(mesh.GetMesh(), smesh.FACE, "Group of faces lying on edge #1", edge )
+BuildGroupLyingOn(mesh.GetMesh(), SMESH.FACE, "Group of faces lying on edge #1", edge )
# Second way
-mesh.MakeGroup("Group of faces lying on edge #2", smesh.FACE, smesh.FT_LyingOnGeom, edge)
+mesh.MakeGroup("Group of faces lying on edge #2", SMESH.FACE, SMESH.FT_LyingOnGeom, edge)
salome.sg.updateObjBrowser(1);
#Auhtor :MASLOV Eugeny, KOVALTCHUK Alexey
#####################################################################
#
-import geompy
import salome
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+
import os
import math
#Mesh creation
-smesh.SetCurrentStudy(salome.myStudy)
-
# -- Init --
shape_mesh = salome.IDToObject( Cut_1_ID )
print "-------------------------- MaxElementArea"
theMaxElementArea = 20
-algoMef = mesh.Triangle(smesh.MEFISTO)
+algoMef = mesh.Triangle(smeshBuilder.MEFISTO)
hArea = algoMef.MaxElementArea( theMaxElementArea )
print hArea.GetName()
print hArea.GetId()
print "-------------------------- MaxElementVolume"
theMaxElementVolume = 150
-algoNg = mesh.Tetrahedron(smesh.NETGEN)
+algoNg = mesh.Tetrahedron(smeshBuilder.NETGEN)
hVolume = algoNg.MaxElementVolume( theMaxElementVolume )
print hVolume.GetName()
print hVolume.GetId()
# -- Rayon de la bariere
#
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+
from math import sqrt
status = geompy.CheckShape(alveole)
print " check status ", status
-# ---- launch SMESH
-smesh.SetCurrentStudy(salome.myStudy)
# ---- init a Mesh with the alveole
shape_mesh = salome.IDToObject( idalveole )
maxElementVolume = 0.5
-netgen3D = mesh.Tetrahedron(smesh.NETGEN)
+netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN)
hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
print hypVolume.GetName()
print hypVolume.GetId()
# Module : GEOM
# $Header:
#
-from geompy import *
-from math import *
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
-import smesh
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+
+import math
# It is an example of creating a hexahedrical mesh on a sphere.
#
Radius = 100.
Dist = Radius / 2.
Factor = 2.5
-Angle90 = pi / 2.
+Angle90 = math.pi / 2.
NbSeg = 10
PointsList = []
ShapesList = []
#Basic Elements
-P0 = MakeVertex(0., 0., 0.)
-P1 = MakeVertex(-Dist, -Dist, -Dist)
-P2 = MakeVertex(-Dist, -Dist, Dist)
-P3 = MakeVertex(-Dist, Dist, Dist)
-P4 = MakeVertex(-Dist, Dist, -Dist)
+P0 = geompy.MakeVertex(0., 0., 0.)
+P1 = geompy.MakeVertex(-Dist, -Dist, -Dist)
+P2 = geompy.MakeVertex(-Dist, -Dist, Dist)
+P3 = geompy.MakeVertex(-Dist, Dist, Dist)
+P4 = geompy.MakeVertex(-Dist, Dist, -Dist)
-VZ = MakeVectorDXDYDZ(0., 0., 1.)
+VZ = geompy.MakeVectorDXDYDZ(0., 0., 1.)
#Construction Elements
PointsList.append(P1)
PointsList.append(P4)
PointsList.append(P1)
-PolyLine = MakePolyline(PointsList)
+PolyLine = geompy.MakePolyline(PointsList)
-Face1 = MakeFace(PolyLine, 1)
-Face2 = MakeScaleTransform(Face1, P0, Factor)
-Face3 = MakeScaleTransform(Face1, P0, -1.)
+Face1 = geompy.MakeFace(PolyLine, 1)
+Face2 = geompy.MakeScaleTransform(Face1, P0, Factor)
+Face3 = geompy.MakeScaleTransform(Face1, P0, -1.)
#Models
-Sphere = MakeSphereR(Radius)
+Sphere = geompy.MakeSphereR(Radius)
-Block = MakeHexa2Faces(Face1, Face2)
-Cube = MakeHexa2Faces(Face1, Face3)
+Block = geompy.MakeHexa2Faces(Face1, Face2)
+Cube = geompy.MakeHexa2Faces(Face1, Face3)
-Common1 = MakeBoolean(Sphere, Block, 1)
-Common2 = MakeRotation(Common1, VZ, Angle90)
+Common1 = geompy.MakeBoolean(Sphere, Block, 1)
+Common2 = geompy.MakeRotation(Common1, VZ, Angle90)
-MultiBlock1 = MakeMultiTransformation1D(Common1, 20, -1, 3)
-MultiBlock2 = MakeMultiTransformation1D(Common2, 30, -1, 3)
+MultiBlock1 = geompy.MakeMultiTransformation1D(Common1, 20, -1, 3)
+MultiBlock2 = geompy.MakeMultiTransformation1D(Common2, 30, -1, 3)
#Reconstruct sphere from several blocks
ShapesList.append(Cube)
ShapesList.append(MultiBlock1)
ShapesList.append(MultiBlock2)
-Compound = MakeCompound(ShapesList)
+Compound = geompy.MakeCompound(ShapesList)
-Result = MakeGlueFaces(Compound, 0.1)
+Result = geompy.MakeGlueFaces(Compound, 0.1)
#addToStudy
-Id_Sphere = addToStudy(Sphere, "Sphere")
-Id_Cube = addToStudy(Cube, "Cube")
+Id_Sphere = geompy.addToStudy(Sphere, "Sphere")
+Id_Cube = geompy.addToStudy(Cube, "Cube")
-Id_Common1 = addToStudy(Common1, "Common1")
-Id_Common2 = addToStudy(Common2, "Common2")
+Id_Common1 = geompy.addToStudy(Common1, "Common1")
+Id_Common2 = geompy.addToStudy(Common2, "Common2")
-Id_MultiBlock1 = addToStudy(MultiBlock1, "MultiBlock1")
-Id_MultiBlock2 = addToStudy(MultiBlock2, "MultiBlock2")
+Id_MultiBlock1 = geompy.addToStudy(MultiBlock1, "MultiBlock1")
+Id_MultiBlock2 = geompy.addToStudy(MultiBlock2, "MultiBlock2")
-Id_Result = addToStudy(Result, "Result")
+Id_Result = geompy.addToStudy(Result, "Result")
#-----------------------------------------------------------------------
#Meshing
-smesh.SetCurrentStudy(salome.myStudy)
my_hexa = smesh.Mesh(Result, "Sphere_Mesh")
algo = my_hexa.Segment()
algo.NumberOfSegments(NbSeg)
# $Header$
#
import salome
-import geompy
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+
import math
-import smesh
import GEOM_Spanner
isBlocksTest = 0 # False
isMeshTest = 1 # True
-smesh.SetCurrentStudy(salome.myStudy)
-
GEOM_Spanner.MakeSpanner(geompy, math, isBlocksTest, isMeshTest, smesh)
salome.sg.updateObjBrowser(1);
# Salome geometry and meshing for a box
#
import salome
-from salome import sg
-import geompy
-import smesh
-
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
-# ---- launch GEOM
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
-geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
-
-###geom.GetCurrentStudy(salome.myStudy._get_StudyId())
+from salome import sg
# Plate
boxId = geompy.addToStudy(box,"box")
# ---- SMESH
-smesh.SetCurrentStudy(salome.myStudy)
# ---- init a Mesh
# Hypothesis and algorithms for the mesh generation are global
#
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# ---- define 2 boxes box1 and box2
### ---------------------------- SMESH --------------------------------------
-smesh.SetCurrentStudy(salome.myStudy)
# ---- init a Mesh with the shell
maxElementVolume = 500
-netgen3D = mesh.Tetrahedron(smesh.NETGEN)
+netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN)
hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
print hypVolume.GetName()
print hypVolume.GetId()
# Hypothesis and algorithms for the mesh generation are global
#
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# ---- define 3 boxes box1, box2 and box3
### ---------------------------- SMESH --------------------------------------
-smesh.SetCurrentStudy(salome.myStudy)
# ---- init a Mesh with the shell
maxElementVolume = 500
-netgen3D = mesh.Tetrahedron(smesh.NETGEN)
+netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN)
hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
print hypVolume.GetName()
print hypVolume.GetId()
# the mesh generation are global
#
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# ---- define a boxe
### ---------------------------- SMESH --------------------------------------
-smesh.SetCurrentStudy(salome.myStudy)
# ---- init a Mesh with the boxe
maxElementVolume = 500
-netgen3D = mesh.Tetrahedron(smesh.NETGEN)
+netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN)
hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
print hypVolume.GetName()
print hypVolume.GetId()
# Author : Sergey LITONIN
# Module : SMESH
#
-import smesh
import SMESH_mechanic
-salome = smesh.salome
-mesh = SMESH_mechanic.mesh
-
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# ---- Criterion : AREA > 100
# create group
-aGroup = mesh.MakeGroup("Area > 100", smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 100)
+aGroup = mesh.MakeGroup("Area > 100", SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 100)
# print result
anIds = aGroup.GetIDs()
# ---- Criterion : Taper > 3e-15
# create group
-aGroup = mesh.MakeGroup("Taper > 3e-15", smesh.FACE, smesh.FT_Taper, smesh.FT_MoreThan, 3e-15)
+aGroup = mesh.MakeGroup("Taper > 3e-15", SMESH.FACE, SMESH.FT_Taper, SMESH.FT_MoreThan, 3e-15)
# print result
anIds = aGroup.GetIDs()
# ---- Criterion : ASPECT RATIO > 1.3
# create group
-aGroup = mesh.MakeGroup("Aspect Ratio > 1.3", smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, 1.3)
+aGroup = mesh.MakeGroup("Aspect Ratio > 1.3", SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, 1.3)
# print result
anIds = aGroup.GetIDs()
# ---- Criterion : MINIMUM ANGLE < 30
# create group
-aGroup = mesh.MakeGroup("Minimum Angle < 30", smesh.FACE, smesh.FT_MinimumAngle, smesh.FT_LessThan, 30)
+aGroup = mesh.MakeGroup("Minimum Angle < 30", SMESH.FACE, SMESH.FT_MinimumAngle, SMESH.FT_LessThan, 30)
# print result
anIds = aGroup.GetIDs()
# ---- Criterion : Warp > 2e-13
# create group
-aGroup = mesh.MakeGroup("Warp > 2e-13", smesh.FACE, smesh.FT_Warping, smesh.FT_MoreThan, 2e-13 )
+aGroup = mesh.MakeGroup("Warp > 2e-13", SMESH.FACE, SMESH.FT_Warping, SMESH.FT_MoreThan, 2e-13 )
# print result
anIds = aGroup.GetIDs()
# ---- Criterion : Skew > 18
# create group
-aGroup = mesh.MakeGroup("Skew > 18", smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, 18 )
+aGroup = mesh.MakeGroup("Skew > 18", SMESH.FACE, SMESH.FT_Skew, SMESH.FT_MoreThan, 18 )
# print result
anIds = aGroup.GetIDs()
# Criterion : Length > 10
# create group
-aGroup = mesh.MakeGroup("Length > 10", smesh.FACE, smesh.FT_Length, smesh.FT_MoreThan, 10 )
+aGroup = mesh.MakeGroup("Length > 10", SMESH.FACE, SMESH.FT_Length, SMESH.FT_MoreThan, 10 )
# print result
anIds = aGroup.GetIDs()
# Criterion : Borders at multi-connections = 2
# create group
-aGroup = mesh.MakeGroup("Borders at multi-connections = 2", smesh.EDGE, smesh.FT_MultiConnection, smesh.FT_EqualTo, 2)
+aGroup = mesh.MakeGroup("Borders at multi-connections = 2", SMESH.EDGE, SMESH.FT_MultiConnection, SMESH.FT_EqualTo, 2)
# print result
anIds = aGroup.GetIDs()
# Criterion : Element Diameter 2D > 10
# create group
-aGroup = mesh.MakeGroup("Element Diameter 2D > 10", smesh.FACE, smesh.FT_MaxElementLength2D, smesh.FT_MoreThan, 10 )
+aGroup = mesh.MakeGroup("Element Diameter 2D > 10", SMESH.FACE, SMESH.FT_MaxElementLength2D, SMESH.FT_MoreThan, 10 )
# print result
anIds = aGroup.GetIDs()
# the mesh of some edges is thinner
#
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
import math
# $Header$
#
import salome
-import geompy
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
import math
# -----------------------------------------------------------------------------
# Hypothesis and algorithms for the mesh generation are global
#
import SMESH_fixation
-import smesh
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
compshell = SMESH_fixation.compshell
idcomp = SMESH_fixation.idcomp
# The new Netgen algorithm is used that discretizes baoundaries itself
#
import SMESH_fixation
-import smesh
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
compshell = SMESH_fixation.compshell
idcomp = SMESH_fixation.idcomp
print "-------------------------- create Mesh, algorithm, hypothesis"
mesh = smesh.Mesh(compshell, "MeshcompShel");
-netgen = mesh.Tetrahedron(smesh.FULL_NETGEN)
+netgen = mesh.Tetrahedron(smeshBuilder.FULL_NETGEN)
netgen.SetMaxSize( 50 )
#netgen.SetSecondOrder( 0 )
-netgen.SetFineness( smesh.Fine )
+netgen.SetFineness( smeshBuilder.Fine )
#netgen.SetOptimize( 1 )
salome.sg.updateObjBrowser(1)
# SMESH_fixation.py
# Hypothesis and algorithms for the mesh generation are global
#
+
import SMESH_fixation
-import smesh
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
compshell = SMESH_fixation.compshell
idcomp = SMESH_fixation.idcomp
maxElementVolume = 1000
-netgen3D = mesh.Tetrahedron(smesh.NETGEN)
+netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN)
netgen3D.SetName("NETGEN_3D")
hypVolume = netgen3D.MaxElementVolume(maxElementVolume)
print hypVolume.GetName()
#
import os
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# ---------------------------- GEOM --------------------------------------
#
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# Create box without one plane
# Criterion : Free edges. Create group.
-aCriterion = smesh.GetCriterion(smesh.EDGE, smesh.FT_FreeEdges)
+aCriterion = smesh.GetCriterion(SMESH.EDGE, SMESH.FT_FreeEdges)
aGroup = mesh.MakeGroupByCriterion("Free edges", aCriterion)
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
-# -----------------------------------------------------------------------------
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
-geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
+# -----------------------------------------------------------------------------
p0 = geompy.MakeVertex(0., 0., 0.)
px = geompy.MakeVertex(100., 0., 0.)
#-------------------------------------------------------------------------
#
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
import StdMeshers
#-------------------------------------------------------------------------
#
import salome
-import geompy
-import smesh
-
salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+
# ---------------------------- GEOM --------------------------------------
# ---- define contigous arcs and segment to define a closed wire
Id_SubFace4 = geompy.addToStudyInFather( mechanic, sub_face4, name )
# ---------------------------- SMESH --------------------------------------
-smesh.SetCurrentStudy(salome.myStudy)
# -- Init --
shape_mesh = salome.IDToObject( Id_mechanic )
#2 cutting of triangles of the group
FacesTriToQuad = [ 2391, 2824, 2825, 2826, 2827, 2828, 2832, 2833, 2834, 2835, 2836, 2837, 2838, 2839, 2841, 2844, 2845, 2847, 2854, 2861, 2863, 2922, 2923, 2924, 2925, 2926, 2927, 2928, 2929, 2930, 2931, 2932, 2933, 2934, 2935, 2936, 2937, 2938, 2940, 2941, 2946, 2951, 2970, 2971, 2972, 2973, 2974, 2975, 2976, 2977, 2978, 2979, 2980, 2981, 2982, 2983, 2984, 2985 ]
-GroupTriToQuad = mesh.MakeGroupByIds("Group of faces (quad)", smesh.FACE, FacesTriToQuad)
-mesh.TriToQuadObject(GroupTriToQuad, smesh.FT_AspectRatio , 1.57)
+GroupTriToQuad = mesh.MakeGroupByIds("Group of faces (quad)", SMESH.FACE, FacesTriToQuad)
+mesh.TriToQuadObject(GroupTriToQuad, SMESH.FT_AspectRatio , 1.57)
#3 extrusion of the group
-point = smesh.PointStruct(0, 0, 5)
-vector = smesh.DirStruct(point)
+point = SMESH.PointStruct(0, 0, 5)
+vector = SMESH.DirStruct(point)
mesh.ExtrusionSweepObject(GroupTriToQuad, vector, 5)
#4 mirror object
-mesh.Mirror([], smesh.AxisStruct(0, 0, 0, 0, 0, 0), smesh.POINT, 0)
+mesh.Mirror([], SMESH.AxisStruct(0, 0, 0, 0, 0, 0), smesh.POINT, 0)
#5 mesh translation
-point = smesh.PointStruct(10, 10, 10)
-vector = smesh.DirStruct(point)
+point = SMESH.PointStruct(10, 10, 10)
+vector = SMESH.DirStruct(point)
mesh.Translate([], vector, 0)
#6 mesh rotation
-axisXYZ = smesh.AxisStruct(0, 0, 0, 10, 10, 10)
+axisXYZ = SMESH.AxisStruct(0, 0, 0, 10, 10, 10)
angle180 = 180*3.141/180
mesh.Rotate([], axisXYZ, angle180, 0)
#7 group smoothing
FacesSmooth = [864, 933, 941, 950, 1005, 1013]
-GroupSmooth = mesh.MakeGroupByIds("Group of faces (smooth)", smesh.FACE, FacesSmooth)
+GroupSmooth = mesh.MakeGroupByIds("Group of faces (smooth)", SMESH.FACE, FacesSmooth)
mesh.SmoothObject(GroupSmooth, [], 20, 2, smesh.CENTROIDAL_SMOOTH)
#8 rotation sweep object
FacesRotate = [492, 493, 502, 503]
-GroupRotate = mesh.MakeGroupByIds("Group of faces (rotate)", smesh.FACE, FacesRotate)
+GroupRotate = mesh.MakeGroupByIds("Group of faces (rotate)", SMESH.FACE, FacesRotate)
angle45 = 45*3.141/180
-axisXYZ = smesh.AxisStruct(-38.3128, -73.3658, -133.321, -13.3402, -13.3265, 6.66632)
+axisXYZ = SMESH.AxisStruct(-38.3128, -73.3658, -133.321, -13.3402, -13.3265, 6.66632)
mesh.RotationSweepObject(GroupRotate, axisXYZ, angle45, 4, 1e-5)
#9 reorientation of the submesh1
# The new Netgen algorithm is used that discretizes baoundaries itself
#
import salome
-import geompy
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
-geom = geompy.geom
-
-import smesh
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# ---------------------------- GEOM --------------------------------------
print "number of Edges in mechanic : ",len(subEdgeList)
### ---------------------------- SMESH --------------------------------------
-smesh.SetCurrentStudy(salome.myStudy)
print "-------------------------- create Mesh, algorithm, hypothesis"
mesh = smesh.Mesh(mechanic, "Mesh_mechanic");
-netgen = mesh.Triangle(smesh.NETGEN)
+netgen = mesh.Triangle(smeshBuilder.NETGEN)
netgen.SetMaxSize( 50 )
#netgen.SetSecondOrder( 0 )
-netgen.SetFineness( smesh.Fine )
+netgen.SetFineness( smeshBuilder.Fine )
netgen.SetQuadAllowed( 1 )
#netgen.SetOptimize( 1 )
# $Header$
#
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
-geom = geompy.geom
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# ---------------------------- GEOM --------------------------------------
print "number of Edges in mechanic : ",len(subEdgeList)
### ---------------------------- SMESH --------------------------------------
-smesh.SetCurrentStudy(salome.myStudy)
shape_mesh = salome.IDToObject( Id_mechanic )
maxElementArea = 20
-algo2 = mesh.Triangle(smesh.MEFISTO)
+algo2 = mesh.Triangle(smeshBuilder.MEFISTO)
hypArea = algo2.MaxElementArea(maxElementArea)
print hypArea.GetName()
print hypArea.GetId()
maxElementVolume = 20
-algo3 = mesh.Tetrahedron(smesh.NETGEN)
+algo3 = mesh.Tetrahedron(smeshBuilder.NETGEN)
hypVolume = algo3.MaxElementVolume(maxElementVolume)
print hypVolume.GetName()
print hypVolume.GetId()
# Module : SMESH
#
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
import StdMeshers
# Module : SMESH
#
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# ---- define a box
print hyp.GetId()
print hyp.GetLength()
-algo_2 = mesh.Triangle(smesh.MEFISTO, box)
+algo_2 = mesh.Triangle(smeshBuilder.MEFISTO, box)
hyp = algo_2.MaxElementArea(5000)
print hyp.GetName()
print hyp.GetId()
# Module : SMESH
#
import salome
-import geompy
-from geompy import geom
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
-
-myBuilder = salome.myStudy.NewBuilder()
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# ---- define a box
# Module : SMESH
#
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# ---- define a box
# ---- SMESH
-smesh.SetCurrentStudy(salome.myStudy)
-
# ---- Init a Mesh with the box
mesh = smesh.Mesh(box, "Meshbox")
# Module : SMESH
#
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# ---- define a box
# ---- SMESH
-smesh.SetCurrentStudy(salome.myStudy)
-
# ---- Init a Mesh with the box
mesh = smesh.Mesh(box, "Meshbox")
# Module : SMESH
#import salome
#
+import salome
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
import math
-import geompy
pi = math.pi
#
import salome
-import geompy
-import smesh
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
# ---- GEOM
algo1.NumberOfSegments(10)
# Set 2D algorithm/hypotheses to mesh
-algo2 = mesh.Triangle(smesh.MEFISTO)
+algo2 = mesh.Triangle(smeshBuilder.MEFISTO)
algo2.MaxElementArea(10)
# Create submesh on face
algo3 = mesh.Segment(face)
algo3.NumberOfSegments(10)
-algo4 = mesh.Triangle(smesh.MEFISTO, face)
+algo4 = mesh.Triangle(smeshBuilder.MEFISTO, face)
algo4.MaxElementArea(100)
submesh = algo4.GetSubMesh()
smesh.SetName(submesh, "SubMeshFace")
mesh.Compute()
-faces = submesh.GetElementsByType(smesh.FACE)
+faces = submesh.GetElementsByType(SMESH.FACE)
if len(faces) > 1:
print len(faces), len(faces)/2
- group1 = mesh.CreateEmptyGroup(smesh.FACE,"Group of faces")
- group2 = mesh.CreateEmptyGroup(smesh.FACE,"Another group of faces")
+ group1 = mesh.CreateEmptyGroup(SMESH.FACE,"Group of faces")
+ group2 = mesh.CreateEmptyGroup(SMESH.FACE,"Another group of faces")
group1.Add(faces[:int(len(faces)/2)])
group2.Add(faces[int(len(faces)/2):])
# Module : SMESH
#
import salome
-import smesh
-import SALOMEDS
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
+
import CORBA
import os
import os.path
-smesh.SetCurrentStudy(salome.myStudy)
-
def SetSObjName(theSObj,theName) :
ok, anAttr = theSObj.FindAttribute("AttributeName")
if ok:
--- /dev/null
+# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+##
+# @package StdMeshersBuilder
+# Python API for the standard meshing plug-in module.
+
+from salome.smesh.smesh_algorithm import Mesh_Algorithm
+from salome.smesh.smeshBuilder import AssureGeomPublished, IsEqual, ParseParameters
+from salome.smesh.smeshBuilder import GetName, TreatHypoStatus
+from salome.smesh.smeshBuilder import Mesh
+
+import StdMeshers
+
+#----------------------------
+# Mesh algo type identifiers
+#----------------------------
+
+## Algorithm type: Regular 1D algorithm, see StdMeshersBuilder_Segment
+REGULAR = "Regular_1D"
+## Algorithm type: Python 1D algorithm, see StdMeshersBuilder_Segment_Python
+PYTHON = "Python_1D"
+## Algorithm type: Composite segment 1D algorithm, see StdMeshersBuilder_CompositeSegment
+COMPOSITE = "CompositeSegment_1D"
+## Algorithm type: Triangle MEFISTO 2D algorithm, see StdMeshersBuilder_Triangle_MEFISTO
+MEFISTO = "MEFISTO_2D"
+## Algorithm type: Hexahedron 3D (i-j-k) algorithm, see StdMeshersBuilder_Hexahedron
+Hexa = "Hexa_3D"
+## Algorithm type: Quadrangle 2D algorithm, see StdMeshersBuilder_Quadrangle
+QUADRANGLE = "Quadrangle_2D"
+## Algorithm type: Radial Quadrangle 1D-2D algorithm, see StdMeshersBuilder_RadialQuadrangle1D2D
+RADIAL_QUAD = "RadialQuadrangle_1D2D"
+
+# import items of enum QuadType
+for e in StdMeshers.QuadType._items: exec('%s = StdMeshers.%s'%(e,e))
+
+#----------------------
+# Algorithms
+#----------------------
+
+## Defines segment 1D algorithm for edges discretization.
+#
+# It can be created by calling smesh.Mesh.Segment(geom=0)
+#
+# @ingroup l3_algos_basic
+class StdMeshersBuilder_Segment(Mesh_Algorithm):
+
+ ## name of the dynamic method in smesh.Mesh class
+ # @internal
+ meshMethod = "Segment"
+ ## type of algorithm used with helper function in smesh.Mesh class
+ # @internal
+ algoType = REGULAR
+ ## flag pointing either this algorithm should be used by default in dynamic method
+ # of smesh.Mesh class
+ # @internal
+ isDefault = True
+ ## doc string of the method
+ # @internal
+ docHelper = "Creates segment 1D algorithm for edges"
+
+ ## Private constructor.
+ # @param mesh parent mesh object algorithm is assigned to
+ # @param geom geometry (shape/sub-shape) algorithm is assigned to;
+ # if it is @c 0 (default), the algorithm is assigned to the main shape
+ def __init__(self, mesh, geom=0):
+ Mesh_Algorithm.__init__(self)
+ self.Create(mesh, geom, self.algoType)
+ pass
+
+ ## Defines "LocalLength" hypothesis to cut an edge in several segments with the same length
+ # @param l for the length of segments that cut an edge
+ # @param UseExisting if ==true - searches for an existing hypothesis created with
+ # the same parameters, else (default) - creates a new one
+ # @param p precision, used for calculation of the number of segments.
+ # The precision should be a positive, meaningful value within the range [0,1].
+ # In general, the number of segments is calculated with the formula:
+ # nb = ceil((edge_length / l) - p)
+ # Function ceil rounds its argument to the higher integer.
+ # So, p=0 means rounding of (edge_length / l) to the higher integer,
+ # p=0.5 means rounding of (edge_length / l) to the nearest integer,
+ # p=1 means rounding of (edge_length / l) to the lower integer.
+ # Default value is 1e-07.
+ # @return an instance of StdMeshers_LocalLength hypothesis
+ # @ingroup l3_hypos_1dhyps
+ def LocalLength(self, l, UseExisting=0, p=1e-07):
+ comFun=lambda hyp, args: IsEqual(hyp.GetLength(), args[0]) and IsEqual(hyp.GetPrecision(), args[1])
+ hyp = self.Hypothesis("LocalLength", [l,p], UseExisting=UseExisting, CompareMethod=comFun)
+ hyp.SetLength(l)
+ hyp.SetPrecision(p)
+ return hyp
+
+ ## Defines "MaxSize" hypothesis to cut an edge into segments not longer than given value
+ # @param length is optional maximal allowed length of segment, if it is omitted
+ # the preestimated length is used that depends on geometry size
+ # @param UseExisting if ==true - searches for an existing hypothesis created with
+ # the same parameters, else (default) - creates a new one
+ # @return an instance of StdMeshers_MaxLength hypothesis
+ # @ingroup l3_hypos_1dhyps
+ def MaxSize(self, length=0.0, UseExisting=0):
+ hyp = self.Hypothesis("MaxLength", [length], UseExisting=UseExisting)
+ if length > 0.0:
+ # set given length
+ hyp.SetLength(length)
+ if not UseExisting:
+ # set preestimated length
+ gen = self.mesh.smeshpyD
+ initHyp = gen.GetHypothesisParameterValues("MaxLength", "libStdMeshersEngine.so",
+ self.mesh.GetMesh(), self.mesh.GetShape(),
+ False) # <- byMesh
+ preHyp = initHyp._narrow(StdMeshers.StdMeshers_MaxLength)
+ if preHyp:
+ hyp.SetPreestimatedLength( preHyp.GetPreestimatedLength() )
+ pass
+ pass
+ hyp.SetUsePreestimatedLength( length == 0.0 )
+ return hyp
+
+ ## Defines "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments
+ # @param n for the number of segments that cut an edge
+ # @param s for the scale factor (optional)
+ # @param reversedEdges is a list of edges to mesh using reversed orientation.
+ # A list item can also be a tuple (edge, 1st_vertex_of_edge)
+ # @param UseExisting if ==true - searches for an existing hypothesis created with
+ # the same parameters, else (default) - create a new one
+ # @return an instance of StdMeshers_NumberOfSegments hypothesis
+ # @ingroup l3_hypos_1dhyps
+ def NumberOfSegments(self, n, s=[], reversedEdges=[], UseExisting=0):
+ if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
+ reversedEdges, UseExisting = [], reversedEdges
+ entry = self.MainShapeEntry()
+ reversedEdgeInd = self.ReversedEdgeIndices(reversedEdges)
+ if s == []:
+ hyp = self.Hypothesis("NumberOfSegments", [n, reversedEdgeInd, entry],
+ UseExisting=UseExisting,
+ CompareMethod=self._compareNumberOfSegments)
+ else:
+ hyp = self.Hypothesis("NumberOfSegments", [n,s, reversedEdgeInd, entry],
+ UseExisting=UseExisting,
+ CompareMethod=self._compareNumberOfSegments)
+ hyp.SetDistrType( 1 )
+ hyp.SetScaleFactor(s)
+ hyp.SetNumberOfSegments(n)
+ hyp.SetReversedEdges( reversedEdgeInd )
+ hyp.SetObjectEntry( entry )
+ return hyp
+
+ ## Private method
+ #
+ # Checks if the given "NumberOfSegments" hypothesis has the same parameters as the given arguments
+ def _compareNumberOfSegments(self, hyp, args):
+ if hyp.GetNumberOfSegments() == args[0]:
+ if len(args) == 3:
+ if hyp.GetReversedEdges() == args[1]:
+ if not args[1] or hyp.GetObjectEntry() == args[2]:
+ return True
+ else:
+ if hyp.GetReversedEdges() == args[2]:
+ if not args[2] or hyp.GetObjectEntry() == args[3]:
+ if hyp.GetDistrType() == 1:
+ if IsEqual(hyp.GetScaleFactor(), args[1]):
+ return True
+ return False
+
+ ## Defines "Arithmetic1D" hypothesis to cut an edge in several segments with increasing arithmetic length
+ # @param start defines the length of the first segment
+ # @param end defines the length of the last segment
+ # @param reversedEdges is a list of edges to mesh using reversed orientation.
+ # A list item can also be a tuple (edge, 1st_vertex_of_edge)
+ # @param UseExisting if ==true - searches for an existing hypothesis created with
+ # the same parameters, else (default) - creates a new one
+ # @return an instance of StdMeshers_Arithmetic1D hypothesis
+ # @ingroup l3_hypos_1dhyps
+ def Arithmetic1D(self, start, end, reversedEdges=[], UseExisting=0):
+ if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
+ reversedEdges, UseExisting = [], reversedEdges
+ reversedEdgeInd = self.ReversedEdgeIndices(reversedEdges)
+ entry = self.MainShapeEntry()
+ compFun = lambda hyp, args: ( IsEqual(hyp.GetLength(1), args[0]) and \
+ IsEqual(hyp.GetLength(0), args[1]) and \
+ hyp.GetReversedEdges() == args[2] and \
+ (not args[2] or hyp.GetObjectEntry() == args[3]))
+ hyp = self.Hypothesis("Arithmetic1D", [start, end, reversedEdgeInd, entry],
+ UseExisting=UseExisting, CompareMethod=compFun)
+ hyp.SetStartLength(start)
+ hyp.SetEndLength(end)
+ hyp.SetReversedEdges( reversedEdgeInd )
+ hyp.SetObjectEntry( entry )
+ return hyp
+
+ ## Defines "FixedPoints1D" hypothesis to cut an edge using parameter
+ # on curve from 0 to 1 (additionally it is neecessary to check
+ # orientation of edges and create list of reversed edges if it is
+ # needed) and sets numbers of segments between given points (default
+ # values are equals 1
+ # @param points defines the list of parameters on curve
+ # @param nbSegs defines the list of numbers of segments
+ # @param reversedEdges is a list of edges to mesh using reversed orientation.
+ # A list item can also be a tuple (edge, 1st_vertex_of_edge)
+ # @param UseExisting if ==true - searches for an existing hypothesis created with
+ # the same parameters, else (default) - creates a new one
+ # @return an instance of StdMeshers_Arithmetic1D hypothesis
+ # @ingroup l3_hypos_1dhyps
+ def FixedPoints1D(self, points, nbSegs=[1], reversedEdges=[], UseExisting=0):
+ if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
+ reversedEdges, UseExisting = [], reversedEdges
+ reversedEdgeInd = self.ReversedEdgeIndices(reversedEdges)
+ entry = self.MainShapeEntry()
+ compFun = lambda hyp, args: ( hyp.GetPoints() == args[0] and \
+ hyp.GetNbSegments() == args[1] and \
+ hyp.GetReversedEdges() == args[2] and \
+ (not args[2] or hyp.GetObjectEntry() == args[3]))
+ hyp = self.Hypothesis("FixedPoints1D", [points, nbSegs, reversedEdgeInd, entry],
+ UseExisting=UseExisting, CompareMethod=compFun)
+ hyp.SetPoints(points)
+ hyp.SetNbSegments(nbSegs)
+ hyp.SetReversedEdges(reversedEdgeInd)
+ hyp.SetObjectEntry(entry)
+ return hyp
+
+ ## Defines "StartEndLength" hypothesis to cut an edge in several segments with increasing geometric