PR: examples adaptation

This commit is contained in:
prascle 2013-03-21 16:50:22 +00:00
parent a091c1bd76
commit ab477cd54e
100 changed files with 727 additions and 303 deletions

View File

@ -1,14 +1,24 @@
# Usage of Body Fitting algorithm # 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 # create a sphere
sphere = geompy.MakeSphereR( 50 ) sphere = geompy.MakeSphereR( 50 )
geompy.addToStudy( sphere, "sphere" ) geompy.addToStudy( sphere, "sphere" )
# create a mesh and assign a "Body Fitting" algo # create a mesh and assign a "Body Fitting" algo
mesh = Mesh( sphere ) mesh = smesh.Mesh( sphere )
cartAlgo = mesh.BodyFitted() cartAlgo = mesh.BodyFitted()
# define a cartesian grid using Coordinates # define a cartesian grid using Coordinates

View File

@ -3,6 +3,6 @@
# create mesh # create mesh
from SMESH_mechanic import * from SMESH_mechanic import *
# get faces with aspect ratio > 6.5 # 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) ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with aspect ratio > 6.5:", len(ids) print "Number of faces with aspect ratio > 6.5:", len(ids)

View File

@ -5,6 +5,6 @@ from SMESH_mechanic import *
mesh.Tetrahedron() mesh.Tetrahedron()
mesh.Compute() mesh.Compute()
# get volumes with aspect ratio < 2.0 # 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) ids = mesh.GetIdsFromFilter(filter)
print "Number of volumes with aspect ratio < 2.0:", len(ids) print "Number of volumes with aspect ratio < 2.0:", len(ids)

View File

@ -3,7 +3,7 @@
# create mesh # create mesh
from SMESH_mechanic import * from SMESH_mechanic import *
# get faces with warping angle = 2.0e-13 with tolerance 5.0e-14 # 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 criterion.Tolerance = 5.0e-14
filter = smesh.CreateFilterManager().CreateFilter() filter = smesh.CreateFilterManager().CreateFilter()
filter.SetCriteria([criterion]) filter.SetCriteria([criterion])

View File

@ -3,6 +3,6 @@
# create mesh # create mesh
from SMESH_mechanic import * from SMESH_mechanic import *
# get faces with minimum angle > 75 # 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) ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with minimum angle > 75:", len(ids) print "Number of faces with minimum angle > 75:", len(ids)

View File

@ -3,6 +3,6 @@
# create mesh # create mesh
from SMESH_mechanic import * from SMESH_mechanic import *
# get faces with taper < 1.e-15 # 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) ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with taper < 1.e-15:", len(ids) print "Number of faces with taper < 1.e-15:", len(ids)

View File

@ -3,6 +3,6 @@
# create mesh # create mesh
from SMESH_mechanic import * from SMESH_mechanic import *
# get faces with skew > 50 # 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) ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with skew > 50:", len(ids) print "Number of faces with skew > 50:", len(ids)

View File

@ -3,9 +3,9 @@
# create mesh # create mesh
from SMESH_mechanic import * from SMESH_mechanic import *
# get faces with area > 60 and < 90 # get faces with area > 60 and < 90
criterion1 = smesh.GetCriterion(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 60,\ criterion1 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 60,\
smesh.FT_Undefined, smesh.FT_LogicalAND) SMESH.FT_Undefined, SMESH.FT_LogicalAND)
criterion2 = smesh.GetCriterion(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 90) criterion2 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 90)
filter = smesh.CreateFilterManager().CreateFilter() filter = smesh.CreateFilterManager().CreateFilter()
filter.SetCriteria([criterion1,criterion2]) filter.SetCriteria([criterion1,criterion2])
ids = mesh.GetIdsFromFilter(filter) ids = mesh.GetIdsFromFilter(filter)

View File

@ -5,6 +5,6 @@ from SMESH_mechanic import *
mesh.Tetrahedron() mesh.Tetrahedron()
mesh.Compute() mesh.Compute()
# get volumes faces with volume > 100 # 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) ids = mesh.GetIdsFromFilter(filter)
print "Number of volumes with volume > 100:", len(ids) print "Number of volumes with volume > 100:", len(ids)

View File

@ -1,7 +1,17 @@
# Free borders # Free borders
# create mesh # 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) face = geompy.MakeFaceHW(100, 100, 1)
geompy.addToStudy( face, "quadrangle" ) geompy.addToStudy( face, "quadrangle" )
mesh = smesh.Mesh(face) mesh = smesh.Mesh(face)
@ -9,6 +19,6 @@ mesh.Segment().NumberOfSegments(10)
mesh.Triangle().MaxElementArea(25) mesh.Triangle().MaxElementArea(25)
mesh.Compute() mesh.Compute()
# get all free borders # get all free borders
filter = smesh.GetFilter(smesh.EDGE, smesh.FT_FreeBorders) filter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_FreeBorders)
ids = mesh.GetIdsFromFilter(filter) ids = mesh.GetIdsFromFilter(filter)
print "Number of edges on free borders:", len(ids) print "Number of edges on free borders:", len(ids)

View File

@ -1,7 +1,17 @@
# Free edges # Free edges
# create mesh # 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) face = geompy.MakeFaceHW(100, 100, 1)
geompy.addToStudy( face, "quadrangle" ) geompy.addToStudy( face, "quadrangle" )
mesh = smesh.Mesh(face) mesh = smesh.Mesh(face)
@ -9,6 +19,6 @@ mesh.Segment().NumberOfSegments(10)
mesh.Triangle().MaxElementArea(25) mesh.Triangle().MaxElementArea(25)
mesh.Compute() mesh.Compute()
# get all faces with free edges # 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) ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with free edges:", len(ids) print "Number of faces with free edges:", len(ids)

View File

@ -5,6 +5,6 @@ from SMESH_mechanic import *
# add node # add node
mesh.AddNode(0,0,0) mesh.AddNode(0,0,0)
# get all free nodes # get all free nodes
filter = smesh.GetFilter(smesh.NODE, smesh.FT_FreeNodes) filter = smesh.GetFilter(SMESH.NODE, SMESH.FT_FreeNodes)
ids = mesh.GetIdsFromFilter(filter) ids = mesh.GetIdsFromFilter(filter)
print "Number of free nodes:", len(ids) print "Number of free nodes:", len(ids)

View File

@ -3,6 +3,6 @@
# create mesh # create mesh
from SMESH_mechanic import * from SMESH_mechanic import *
# get all free faces # get all free faces
filter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeFaces) filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_FreeFaces)
ids = mesh.GetIdsFromFilter(filter) ids = mesh.GetIdsFromFilter(filter)
print "Number of free faces:", len(ids) print "Number of free faces:", len(ids)

View File

@ -3,8 +3,8 @@
# create mesh # create mesh
from SMESH_mechanic import * from SMESH_mechanic import *
# remove some faces to have faces with bare borders # 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 # 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) ids = mesh.GetIdsFromFilter(filter)
print "Faces with bare borders:", ids print "Faces with bare borders:", ids

View File

@ -2,8 +2,8 @@
# create mesh # create mesh
from SMESH_mechanic import * 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 # 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) ids = mesh.GetIdsFromFilter(filter)
print "Number of faces coplanar with the first one:", len(ids) print "Number of faces coplanar with the first one:", len(ids)

View File

@ -2,6 +2,6 @@
# create mesh # create mesh
from SMESH_mechanic import * from SMESH_mechanic import *
# get all over-constrained faces # 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) ids = mesh.GetIdsFromFilter(filter)
print "Over-constrained faces:", ids print "Over-constrained faces:", ids

View File

@ -1,6 +1,17 @@
# Double edges, Double faces, Double volumes # 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 # make a mesh on a box
box = geompy.MakeBoxDXDYDZ(100,100,100) box = geompy.MakeBoxDXDYDZ(100,100,100)
mesh = Mesh( box, "Box" ) mesh = Mesh( box, "Box" )
@ -12,9 +23,9 @@ mesh.Compute()
mesh.TranslateObject( mesh, MakeDirStruct( 10,0,0), Copy=True ) mesh.TranslateObject( mesh, MakeDirStruct( 10,0,0), Copy=True )
mesh.MergeNodes( mesh.FindCoincidentNodes(1e-7) ) mesh.MergeNodes( mesh.FindCoincidentNodes(1e-7) )
# create filters to find equal elements # create filters to find equal elements
equalEdgesFilter = GetFilter(SMESH.EDGE, FT_EqualEdges) equalEdgesFilter = GetFilter(SMESH.EDGE, SMESH.FT_EqualEdges)
equalFacesFilter = GetFilter(SMESH.FACE, FT_EqualFaces) equalFacesFilter = GetFilter(SMESH.FACE, SMESH.FT_EqualFaces)
equalVolumesFilter = GetFilter(SMESH.VOLUME, FT_EqualVolumes) equalVolumesFilter = GetFilter(SMESH.VOLUME, SMESH.FT_EqualVolumes)
# get equal elements # get equal elements
print "Number of equal edges:", len( mesh.GetIdsFromFilter( equalEdgesFilter )) print "Number of equal edges:", len( mesh.GetIdsFromFilter( equalEdgesFilter ))
print "Number of equal faces:", len( mesh.GetIdsFromFilter( equalFacesFilter )) print "Number of equal faces:", len( mesh.GetIdsFromFilter( equalFacesFilter ))

View File

@ -1,6 +1,17 @@
# Double nodes # 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 # make a mesh on a box
box = geompy.MakeBoxDXDYDZ(100,100,100) box = geompy.MakeBoxDXDYDZ(100,100,100)
mesh = Mesh( box, "Box" ) mesh = Mesh( box, "Box" )

View File

@ -3,6 +3,6 @@
# create mesh # create mesh
from SMESH_mechanic import * from SMESH_mechanic import *
# get border edges with number of connected faces = 5 # 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) ids = mesh.GetIdsFromFilter(filter)
print "Number of border edges with 5 faces connected:", len(ids) print "Number of border edges with 5 faces connected:", len(ids)

View File

@ -3,6 +3,6 @@
# create mesh # create mesh
from SMESH_mechanic import * from SMESH_mechanic import *
# get faces which consist of edges belonging to 2 mesh elements # 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) ids = mesh.GetIdsFromFilter(filter)
print "Number of faces consisting of edges belonging to 2 faces:", len(ids) print "Number of faces consisting of edges belonging to 2 faces:", len(ids)

View File

@ -3,6 +3,6 @@
# create mesh # create mesh
from SMESH_mechanic import * from SMESH_mechanic import *
# get edges with length > 14 # 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) ids = mesh.GetIdsFromFilter(filter)
print "Number of edges with length > 14:", len(ids) print "Number of edges with length > 14:", len(ids)

View File

@ -3,6 +3,6 @@
# create mesh # create mesh
from SMESH_mechanic import * from SMESH_mechanic import *
# get all faces that have edges with length > 14 # 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) ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with maximum edge length > 14:", len(ids) print "Number of faces with maximum edge length > 14:", len(ids)

View File

@ -3,6 +3,6 @@
# create mesh # create mesh
from SMESH_mechanic import * from SMESH_mechanic import *
# get all faces that have elements with length > 10 # 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) ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with maximum element length > 10:", len(ids) print "Number of faces with maximum element length > 10:", len(ids)

View File

@ -5,6 +5,6 @@ from SMESH_mechanic import *
mesh.Tetrahedron() mesh.Tetrahedron()
mesh.Compute() mesh.Compute()
# get all volumes that have elements with length > 10 # 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) ids = mesh.GetIdsFromFilter(filter)
print "Number of volumes with maximum element length > 10:", len(ids) print "Number of volumes with maximum element length > 10:", len(ids)

View File

@ -7,6 +7,6 @@ mesh.Compute()
# remove some volumes to have volumes with bare borders # remove some volumes to have volumes with bare borders
mesh.RemoveElements( mesh.GetElementsByType(VOLUME)[0:5] ) mesh.RemoveElements( mesh.GetElementsByType(VOLUME)[0:5] )
# get all volumes with bare borders # 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) ids = mesh.GetIdsFromFilter(filter)
print "Volumes with bare borders:", ids print "Volumes with bare borders:", ids

View File

@ -5,6 +5,6 @@ from SMESH_mechanic import *
mesh.Tetrahedron() mesh.Tetrahedron()
mesh.Compute() mesh.Compute()
# get all over-constrained volumes # 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) ids = mesh.GetIdsFromFilter(filter)
print "Over-constrained volumes:", ids print "Over-constrained volumes:", ids

View File

@ -3,6 +3,6 @@
# create mesh # create mesh
from SMESH_mechanic import * from SMESH_mechanic import *
# get all faces which nodes lie on the face sub_face3 # 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) ids = mesh.GetIdsFromFilter(filter)
print "Number of faces which nodes lie on sub_face3:", len(ids) print "Number of faces which nodes lie on sub_face3:", len(ids)

View File

@ -3,6 +3,6 @@
# create mesh # create mesh
from SMESH_mechanic import * from SMESH_mechanic import *
# get all faces at least one node of each lies on the face sub_face3 # 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) ids = mesh.GetIdsFromFilter(filter)
print "Number of faces at least one node of each lies on sub_face3:", len(ids) print "Number of faces at least one node of each lies on sub_face3:", len(ids)

View File

@ -3,10 +3,9 @@
# create mesh # create mesh
from SMESH_mechanic import * from SMESH_mechanic import *
# create plane # create plane
import geompy
plane_1 = geompy.MakePlane(p3,seg1,2000) plane_1 = geompy.MakePlane(p3,seg1,2000)
geompy.addToStudy(plane_1, "plane_1") geompy.addToStudy(plane_1, "plane_1")
# get all nodes which lie on the plane \a 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) ids = mesh.GetIdsFromFilter(filter)
print "Number of nodes which lie on the plane plane_1:", len(ids) print "Number of nodes which lie on the plane plane_1:", len(ids)

View File

@ -3,6 +3,6 @@
# create mesh # create mesh
from SMESH_mechanic import * from SMESH_mechanic import *
# get all faces which lie on the cylindrical face \a sub_face1 # 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) ids = mesh.GetIdsFromFilter(filter)
print "Number of faces which lie on the cylindrical surface sub_face1:", len(ids) print "Number of faces which lie on the cylindrical surface sub_face1:", len(ids)

View File

@ -7,6 +7,6 @@ spline_1 = geompy.MakeInterpol([p4,p6,p3,p1])
surface_1 = geompy.MakePrismVecH( spline_1, vz, 70.0 ) surface_1 = geompy.MakePrismVecH( spline_1, vz, 70.0 )
geompy.addToStudy(surface_1, "surface_1") geompy.addToStudy(surface_1, "surface_1")
# get all nodes which lie on the surface \a 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) ids = mesh.GetIdsFromFilter(filter)
print "Number of nodes which lie on the surface surface_1:", len(ids) print "Number of nodes which lie on the surface surface_1:", len(ids)

View File

@ -3,9 +3,9 @@
# create mesh # create mesh
from SMESH_mechanic import * from SMESH_mechanic import *
# get nodes with identifiers [5-10] and [15-30] # get nodes with identifiers [5-10] and [15-30]
criterion1 = smesh.GetCriterion(smesh.NODE, smesh.FT_RangeOfIds, Threshold="5-10",\ criterion1 = smesh.GetCriterion(SMESH.NODE, SMESH.FT_RangeOfIds, Threshold="5-10",\
BinaryOp=smesh.FT_LogicalOR) BinaryOp=SMESH.FT_LogicalOR)
criterion2 = smesh.GetCriterion(smesh.NODE, smesh.FT_RangeOfIds, Threshold="15-30") criterion2 = smesh.GetCriterion(SMESH.NODE, SMESH.FT_RangeOfIds, Threshold="15-30")
filter = smesh.CreateFilterManager().CreateFilter() filter = smesh.CreateFilterManager().CreateFilter()
filter.SetCriteria([criterion1,criterion2]) filter.SetCriteria([criterion1,criterion2])
ids = mesh.GetIdsFromFilter(filter) ids = mesh.GetIdsFromFilter(filter)

View File

@ -5,6 +5,6 @@ from SMESH_mechanic import *
mesh.Tetrahedron() mesh.Tetrahedron()
mesh.Compute() mesh.Compute()
# get all badly oriented volumes # 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) ids = mesh.GetIdsFromFilter(filter)
print "Number of badly oriented volumes:", len(ids) print "Number of badly oriented volumes:", len(ids)

View File

@ -3,8 +3,8 @@
# create mesh # create mesh
from SMESH_mechanic import * from SMESH_mechanic import *
# get number of linear and quadratic edges # get number of linear and quadratic edges
filter_linear = smesh.GetFilter(smesh.EDGE, smesh.FT_LinearOrQuadratic) filter_linear = smesh.GetFilter(SMESH.EDGE, SMESH.FT_LinearOrQuadratic)
filter_quadratic = smesh.GetFilter(smesh.EDGE, smesh.FT_LinearOrQuadratic, smesh.FT_LogicalNOT) filter_quadratic = smesh.GetFilter(SMESH.EDGE, SMESH.FT_LinearOrQuadratic, SMESH.FT_LogicalNOT)
ids_linear = mesh.GetIdsFromFilter(filter_linear) ids_linear = mesh.GetIdsFromFilter(filter_linear)
ids_quadratic = mesh.GetIdsFromFilter(filter_quadratic) ids_quadratic = mesh.GetIdsFromFilter(filter_quadratic)
print "Number of linear edges:", len(ids_linear), "; number of quadratic edges:", len(ids_quadratic) print "Number of linear edges:", len(ids_linear), "; number of quadratic edges:", len(ids_quadratic)

View File

@ -3,12 +3,12 @@
# create mesh # create mesh
from SMESH_mechanic import * from SMESH_mechanic import *
# create group of edges # create group of edges
all_edges = mesh.GetElementsByType(smesh.EDGE) all_edges = mesh.GetElementsByType(SMESH.EDGE)
grp = mesh.MakeGroupByIds("edges group", smesh.EDGE, all_edges[:len(all_edges)/4]) grp = mesh.MakeGroupByIds("edges group", SMESH.EDGE, all_edges[:len(all_edges)/4])
import SALOMEDS import SALOMEDS
c = SALOMEDS.Color(0.1, 0.5, 1.0) c = SALOMEDS.Color(0.1, 0.5, 1.0)
grp.SetColor(c) grp.SetColor(c)
# get number of the edges not belonging to the group with the given color # 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) ids = mesh.GetIdsFromFilter(filter)
print "Number of edges not beloging to the group with color (0.1, 0.5, 1.0):", len(ids) print "Number of edges not beloging to the group with color (0.1, 0.5, 1.0):", len(ids)

View File

@ -5,10 +5,10 @@ from SMESH_mechanic import *
mesh.Tetrahedron() mesh.Tetrahedron()
mesh.Compute() mesh.Compute()
# get all triangles, quadrangles, tetrahedrons, pyramids # get all triangles, quadrangles, tetrahedrons, pyramids
filter_tri = smesh.GetFilter(smesh.FACE, smesh.FT_ElemGeomType, smesh.Geom_TRIANGLE) 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_qua = smesh.GetFilter(SMESH.FACE, SMESH.FT_ElemGeomType, smesh.Geom_QUADRANGLE)
filter_tet = smesh.GetFilter(smesh.VOLUME, smesh.FT_ElemGeomType, smesh.Geom_TETRA) 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_pyr = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_ElemGeomType, smesh.Geom_PYRAMID)
ids_tri = mesh.GetIdsFromFilter(filter_tri) ids_tri = mesh.GetIdsFromFilter(filter_tri)
ids_qua = mesh.GetIdsFromFilter(filter_qua) ids_qua = mesh.GetIdsFromFilter(filter_qua)
ids_tet = mesh.GetIdsFromFilter(filter_tet) ids_tet = mesh.GetIdsFromFilter(filter_tet)

View File

@ -3,11 +3,11 @@
# create mesh # create mesh
from SMESH_mechanic import * from SMESH_mechanic import *
# get all the quadrangle faces ... # 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 # ... 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 = smesh.CreateFilterManager().CreateFilter()
filter.SetCriteria([criterion1,criterion2]) filter.SetCriteria([criterion1,criterion2])
ids = mesh.GetIdsFromFilter(filter) ids = mesh.GetIdsFromFilter(filter)
myGroup = mesh.MakeGroupByIds("Quads_on_cylindrical_faces",smesh.FACE,ids) myGroup = mesh.MakeGroupByIds("Quads_on_cylindrical_faces",SMESH.FACE,ids)

View File

@ -3,9 +3,17 @@
# This example represents an iron cable (a thin cylinder) in a concrete bloc (a big cylinder). # 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. # The big cylinder is defined by two geometric volumes.
import geompy
import smesh 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)
# geometry # geometry
@ -21,22 +29,22 @@ Vertex_3 = geompy.MakeVertex(250, 200, 200)
Box_1 = geompy.MakeBoxTwoPnt(Vertex_2, Vertex_3) Box_1 = geompy.MakeBoxTwoPnt(Vertex_2, Vertex_3)
Fuse_1 = geompy.MakeFuse(Cylinder_1, Cylinder_2) Fuse_1 = geompy.MakeFuse(Cylinder_1, Cylinder_2)
Partition_1 = geompy.MakePartition([Fuse_1], [Cylinder_1, Box_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0) 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_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"], geompy.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_4 = geompy.MakeVertex(450, 0, 0)
Vertex_5 = geompy.MakeVertex(500, 0, 0) Vertex_5 = geompy.MakeVertex(500, 0, 0)
Vertex_6 = geompy.MakeVertex(550, 0, 0) Vertex_6 = geompy.MakeVertex(550, 0, 0)
vec1 = geompy.MakeVector(Vertex_4, Vertex_5) vec1 = geompy.MakeVector(Vertex_4, Vertex_5)
vec2 = geompy.MakeVector(Vertex_5, Vertex_6) vec2 = geompy.MakeVector(Vertex_5, Vertex_6)
[Face_1] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec1, 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, geompy.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) # meshing (we have linear tetrahedrons here, but other elements are OK)
Mesh_1 = smesh.Mesh(Partition_1) Mesh_1 = smesh.Mesh(Partition_1)
Regular_1D = Mesh_1.Segment() Regular_1D = Mesh_1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(15) 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() Length_From_Edges_2D = MEFISTO_2D.LengthFromEdges()
ALGO3D = Mesh_1.Tetrahedron() ALGO3D = Mesh_1.Tetrahedron()
isDone = Mesh_1.Compute() isDone = Mesh_1.Compute()

View File

@ -7,15 +7,15 @@ mesh = SMESH_mechanic.mesh
salome = SMESH_mechanic.salome salome = SMESH_mechanic.salome
# Get ids of all faces with area > 100 # 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) anIds = mesh.GetIdsFromFilter(aFilter)
# create a group consisting of faces with area > 100 # 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 # 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) aGroup2.AddFrom(mesh.mesh)
salome.sg.updateObjBrowser(1) salome.sg.updateObjBrowser(1)

View File

@ -1,8 +1,15 @@
# Create a Group on Geometry # Create a Group on Geometry
import salome import salome
import geompy salome.salome_init()
import smesh 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 # create a box
box = geompy.MakeBox(0., 0., 0., 100., 100., 100.) box = geompy.MakeBox(0., 0., 0., 100., 100., 100.)

View File

@ -1,7 +1,17 @@
# Create a Group on Filter # 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) box = geompy.MakeBoxDXDYDZ(10,10,10)

View File

@ -7,18 +7,18 @@ mesh = SMESH_mechanic.mesh
salome = SMESH_mechanic.salome salome = SMESH_mechanic.salome
# Get ids of all faces with area > 35 # 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) anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area > 35, Nb = ", len(anIds) print "Criterion: Area > 35, Nb = ", len(anIds)
# create a group by adding elements with area > 35 # 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) aGroup.Add(anIds)
# Get ids of all faces with area > 40 # 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) anIds = mesh.GetIdsFromFilter(aFilter)

View File

@ -7,25 +7,25 @@ mesh = SMESH_mechanic.mesh
salome = SMESH_mechanic.salome salome = SMESH_mechanic.salome
# Criterion : AREA > 20 # 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) anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area > 20, Nb = ", len( anIds ) print "Criterion: Area > 20, Nb = ", len( anIds )
# create a group by adding elements with area > 20 # 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) aGroup1.Add(anIds)
# Criterion : AREA = 20 # 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) anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area = 20, Nb = ", len( anIds ) print "Criterion: Area = 20, Nb = ", len( anIds )
# create a group by adding elements with area = 20 # 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) aGroup2.Add(anIds)
@ -35,14 +35,14 @@ print "Criterion: Area >= 20, Nb = ", len(aGroup3.GetListOfID())
# Please note that also there is UnionGroups() method which works with two groups only # Please note that also there is UnionGroups() method which works with two groups only
# Criterion : AREA < 20 # 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) anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area < 20, Nb = ", len(anIds) print "Criterion: Area < 20, Nb = ", len(anIds)
# create a group by adding elements with area < 20 # 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) aGroup4.Add(anIds)
# create union group : area >= 20 and area < 20 # create union group : area >= 20 and area < 20

View File

@ -7,25 +7,25 @@ mesh = SMESH_mechanic.mesh
salome = SMESH_mechanic.salome salome = SMESH_mechanic.salome
# Criterion : AREA > 20 # 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) anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area > 20, Nb = ", len(anIds) print "Criterion: Area > 20, Nb = ", len(anIds)
# create a group by adding elements with area > 20 # 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) aGroup1.Add(anIds)
# Criterion : AREA < 60 # 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) anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area < 60, Nb = ", len(anIds) print "Criterion: Area < 60, Nb = ", len(anIds)
# create a group by adding elements with area < 60 # 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) aGroup2.Add(anIds)
# create an intersection of groups : 20 < area < 60 # create an intersection of groups : 20 < area < 60

View File

@ -7,24 +7,24 @@ mesh = SMESH_mechanic.mesh
salome = SMESH_mechanic.salome salome = SMESH_mechanic.salome
# Criterion : AREA > 20 # 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) anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area > 20, Nb = ", len(anIds) print "Criterion: Area > 20, Nb = ", len(anIds)
# create a group by adding elements with area > 20 # 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 # 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) anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area < 60, Nb = ", len(anIds) print "Criterion: Area < 60, Nb = ", len(anIds)
# create a group by adding elements with area < 60 # 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 # create a cut of groups : area >= 60
aGroupRes = mesh.CutGroups(aGroupMain, aGroupTool, "Area >= 60") aGroupRes = mesh.CutGroups(aGroupMain, aGroupTool, "Area >= 60")

View File

@ -7,29 +7,29 @@ mesh = SMESH_mechanic.mesh
salome = SMESH_mechanic.salome salome = SMESH_mechanic.salome
# Criterion : AREA > 100 # 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) anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area > 100, Nb = ", len(anIds) print "Criterion: Area > 100, Nb = ", len(anIds)
# create a group by adding elements with area > 100 # 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 # 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) anIds = mesh.GetIdsFromFilter(aFilter)
print "Criterion: Area < 30, Nb = ", len(anIds) print "Criterion: Area < 30, Nb = ", len(anIds)
# create a group by adding elements with area < 30 # 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 # 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 # 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) salome.sg.updateObjBrowser(1)

View File

@ -1,6 +1,16 @@
# Minimum Distance # 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_mechanic import mesh as mesh1
from SMESH_test1 import mesh as mesh2 from SMESH_test1 import mesh as mesh2

View File

@ -1,6 +1,17 @@
# Bounding Box # 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_mechanic import mesh as mesh1
from SMESH_test1 import mesh as mesh2 from SMESH_test1 import mesh as mesh2

View File

@ -1,6 +1,17 @@
# Add Node # 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() mesh = smesh.Mesh()

View File

@ -1,6 +1,17 @@
# Add 0D Element # 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() mesh = smesh.Mesh()

View File

@ -1,6 +1,17 @@
# Add 0D Element on Element Nodes # 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 # create a geometry
box = geompy.MakeBoxDXDYDZ( 10, 10, 10 ) box = geompy.MakeBoxDXDYDZ( 10, 10, 10 )

View File

@ -1,9 +1,18 @@
# Add Polygon # Add Polygon
import math import math
import salome
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 an empty mesh structure # create an empty mesh structure
mesh = smesh.Mesh() mesh = smesh.Mesh()

View File

@ -1,7 +1,17 @@
# Add Polyhedron # Add Polyhedron
import salome 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 import math
# create an empty mesh structure # create an empty mesh structure

View File

@ -1,7 +1,17 @@
# Moving Nodes # Moving Nodes
from geompy import *
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
box = MakeBoxDXDYDZ(200, 200, 200) box = MakeBoxDXDYDZ(200, 200, 200)

View File

@ -1,7 +1,17 @@
# Diagonal Inversion # Diagonal Inversion
import salome 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 # create an empty mesh structure
mesh = smesh.Mesh() mesh = smesh.Mesh()

View File

@ -1,7 +1,17 @@
# Uniting two Triangles # Uniting two Triangles
import salome 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 # create an empty mesh structure
mesh = smesh.Mesh() mesh = smesh.Mesh()

View File

@ -1,7 +1,17 @@
# Uniting a Set of Triangles # Uniting a Set of Triangles
import salome 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 # create an empty mesh structure
mesh = smesh.Mesh() mesh = smesh.Mesh()
@ -37,7 +47,7 @@ ff[5] = mesh.AddFace([bb[2], tt[3], tt[2]])
# unite a set of triangles # unite a set of triangles
print "\nUnite 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!" if not res: print "failed!"
else: print "done." else: print "done."

View File

@ -1,7 +1,17 @@
# Orientation # Orientation
import salome 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 # create an empty mesh structure
mesh = smesh.Mesh() mesh = smesh.Mesh()

View File

@ -6,4 +6,4 @@ smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh mesh = SMESH_mechanic.mesh
# cut two quadrangles: 405 and 406 # cut two quadrangles: 405 and 406
mesh.QuadToTri([405, 406], smesh.FT_MinimumAngle) mesh.QuadToTri([405, 406], SMESH.FT_MinimumAngle)

View File

@ -1,11 +1,19 @@
# Smoothing # Smoothing
import salome 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 import SMESH_mechanic
smesh = SMESH_mechanic.smesh #smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh mesh = SMESH_mechanic.mesh
# select the top face # select the top face
@ -14,7 +22,7 @@ face = faces[3]
geompy.addToStudyInFather(SMESH_mechanic.shape_mesh, face, "face planar with hole") geompy.addToStudyInFather(SMESH_mechanic.shape_mesh, face, "face planar with hole")
# create a group of faces to be smoothed # 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 # perform smoothing

View File

@ -1,11 +1,19 @@
# Extrusion # Extrusion
import salome 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 import SMESH_mechanic
smesh = SMESH_mechanic.smesh #smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh mesh = SMESH_mechanic.mesh
# select the top face # select the top face
@ -18,7 +26,7 @@ point = smesh.PointStruct(0., 0., 5.)
vector = smesh.DirStruct(point) vector = smesh.DirStruct(point)
# create a group to be extruded # 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 # perform extrusion of the group
mesh.ExtrusionSweepObject(GroupTri, vector, 5) mesh.ExtrusionSweepObject(GroupTri, vector, 5)

View File

@ -1,10 +1,16 @@
# Extrusion along a Path # Extrusion along a Path
import math import math
import salome
# Geometry 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)
# 1. Create points # 1. Create points
points = [[0, 0], [50, 30], [50, 110], [0, 150], [-80, 150], [-130, 70], [-130, -20]] points = [[0, 0], [50, 30], [50, 110], [0, 150], [-80, 150], [-130, 70], [-130, -20]]
@ -36,7 +42,6 @@ for ii in range(len(Wire_polyline_edges)):
pass pass
# Mesh # Mesh
import smesh
# Mesh the given shape with the given 1d hypothesis # Mesh the given shape with the given 1d hypothesis
def Mesh1D(shape1d, nbSeg, name): def Mesh1D(shape1d, nbSeg, name):

View File

@ -1,7 +1,15 @@
# Pattern Mapping # 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 # define the geometry
Box_1 = geompy.MakeBoxDXDYDZ(200., 200., 200.) Box_1 = geompy.MakeBoxDXDYDZ(200., 200., 200.)

View File

@ -1,7 +1,15 @@
# Convert mesh to/from quadratic # 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 # create sphere of radius 100

View File

@ -1,7 +1,15 @@
# Using SALOME NoteBook # 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 import salome_notebook
# set variables # set variables

View File

@ -1,9 +1,15 @@
# Free Borders # Free Borders
import salome
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 open shell: a box without one plane # create open shell: a box without one plane
box = geompy.MakeBox(0., 0., 0., 20., 20., 15.) box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
@ -21,7 +27,7 @@ algo.MaxElementArea(20.)
mesh.Compute() mesh.Compute()
# criterion : free borders # criterion : free borders
aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_FreeBorders) aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_FreeBorders)
anIds = mesh.GetIdsFromFilter(aFilter) anIds = mesh.GetIdsFromFilter(aFilter)
# print the result # print the result
@ -35,7 +41,7 @@ for i in range(len(anIds)):
print "" print ""
# create a group # create a group
aGroup = mesh.GetMesh().CreateGroup(smesh.EDGE, "Free borders") aGroup = mesh.GetMesh().CreateGroup(SMESH.EDGE, "Free borders")
aGroup.Add(anIds) aGroup.Add(anIds)
salome.sg.updateObjBrowser(1) salome.sg.updateObjBrowser(1)

View File

@ -1,10 +1,15 @@
# Borders at Multiconnection # Borders at Multiconnection
import salome
import geompy
import smesh 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)
# create open shell: a box without one plane # create open shell: a box without one plane
box = geompy.MakeBox(0., 0., 0., 20., 20., 15.) box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
@ -24,7 +29,7 @@ mesh.Compute()
# Criterion : Borders at multi-connection # Criterion : Borders at multi-connection
nb_conn = 2 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) anIds = mesh.GetIdsFromFilter(aFilter)
# print the result # print the result
@ -38,7 +43,7 @@ for i in range(len(anIds)):
print "" print ""
# create a group # 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) aGroup.Add(anIds)
salome.sg.updateObjBrowser(1) salome.sg.updateObjBrowser(1)

View File

@ -1,9 +1,15 @@
# Length 1D # Length 1D
import salome
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 open shell: a box without one plane # create open shell: a box without one plane
box = geompy.MakeBox(0., 0., 0., 20., 20., 15.) box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
@ -23,7 +29,7 @@ mesh.Compute()
# Criterion : Length > 3. # Criterion : Length > 3.
length_margin = 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) anIds = mesh.GetIdsFromFilter(aFilter)
# print the result # print the result
@ -37,7 +43,7 @@ for i in range(len(anIds)):
print "" print ""
# create a group # 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) aGroup.Add(anIds)
salome.sg.updateObjBrowser(1) salome.sg.updateObjBrowser(1)

View File

@ -12,7 +12,7 @@ aFilterMgr = smesh.CreateFilterManager()
# Criterion : AREA > 95. # Criterion : AREA > 95.
area_margin = 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) anIds = mesh.GetIdsFromFilter(aFilter)
@ -22,8 +22,8 @@ mesh.RemoveElements(anIds)
aBorders = mesh.GetFreeBorders() aBorders = mesh.GetFreeBorders()
# create groups # create groups
aGroupF = mesh.CreateEmptyGroup(smesh.FACE, "Faces with free edges") aGroupF = mesh.CreateEmptyGroup(SMESH.FACE, "Faces with free edges")
aGroupN = mesh.CreateEmptyGroup(smesh.NODE, "Nodes on free edges") aGroupN = mesh.CreateEmptyGroup(SMESH.NODE, "Nodes on free edges")
# fill groups with elements, corresponding to the criterion # fill groups with elements, corresponding to the criterion
print "" print ""

View File

@ -1,9 +1,15 @@
# Free Nodes # Free Nodes
import salome
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 box # create box
box = geompy.MakeBox(0., 0., 0., 100., 200., 300.) box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
@ -21,18 +27,18 @@ mesh.Compute()
# Criterion : AREA < 80. # Criterion : AREA < 80.
area_margin = 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) anIds = mesh.GetIdsFromFilter(aFilter)
mesh.RemoveElements(anIds) mesh.RemoveElements(anIds)
# criterion : free nodes # criterion : free nodes
aFilter = smesh.GetFilter(smesh.NODE, smesh.FT_FreeNodes) aFilter = smesh.GetFilter(SMESH.NODE, SMESH.FT_FreeNodes)
anNodeIds = mesh.GetIdsFromFilter(aFilter) anNodeIds = mesh.GetIdsFromFilter(aFilter)
# create a group # create a group
aGroup = mesh.CreateEmptyGroup(smesh.NODE, "Free_nodes") aGroup = mesh.CreateEmptyGroup(SMESH.NODE, "Free_nodes")
aGroup.Add(anNodeIds) aGroup.Add(anNodeIds)
# print the result # print the result

View File

@ -1,7 +1,15 @@
# Free Faces # Free Faces
import salome 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 ######## ####### GEOM part ########
@ -30,9 +38,6 @@ geompy.addToStudyInFather( Box_1, Box_1_vertex_21, "Box_1:vertex_21" )
geompy.addToStudy( Plane_2, "Plane_2" ) geompy.addToStudy( Plane_2, "Plane_2" )
###### SMESH part ###### ###### SMESH part ######
import smesh
import StdMeshers
Mesh_1 = smesh.Mesh(Partition_1) Mesh_1 = smesh.Mesh(Partition_1)
Regular_1D = Mesh_1.Segment() Regular_1D = Mesh_1.Segment()
@ -42,10 +47,10 @@ Tetrahedronn = Mesh_1.Tetrahedron()
isDone = Mesh_1.Compute() isDone = Mesh_1.Compute()
# create a group of free faces # 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) aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Free_faces") aGroup = Mesh_1.CreateEmptyGroup(SMESH.FACE, "Free_faces")
aGroup.Add(aFaceIds) aGroup.Add(aFaceIds)
# print the result # print the result
@ -59,15 +64,15 @@ for i in range(len(aFaceIds)):
print "" print ""
#filter faces from plane 2 #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) aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
aGroup.Remove(aFaceIds) aGroup.Remove(aFaceIds)
# create a group of shared faces (located on partition boundary inside box) # 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) aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Shared_faces") aGroup = Mesh_1.CreateEmptyGroup(SMESH.FACE, "Shared_faces")
aGroup.Add(aFaceIds) aGroup.Add(aFaceIds)
salome.sg.updateObjBrowser(1) salome.sg.updateObjBrowser(1)

View File

@ -1,7 +1,17 @@
# Bare border faces # 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) box = geompy.MakeBoxDXDYDZ(100, 100, 100)
geompy.addToStudy( box, "box" ) geompy.addToStudy( box, "box" )

View File

@ -1,7 +1,17 @@
# Bare border volumes # 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) box = geompy.MakeBoxDXDYDZ(100, 30, 10)
# the smallest face of the box # the smallest face of the box

View File

@ -1,7 +1,17 @@
# Over-constrained faces # Over-constrained 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
mesh = Mesh() mesh = Mesh()
faceFilter = GetFilter(FACE,FT_OverConstrainedFace) faceFilter = GetFilter(FACE,FT_OverConstrainedFace)

View File

@ -1,7 +1,17 @@
# Over-constrained volumes # Over-constrained 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
mesh = Mesh() mesh = Mesh()
volumeFilter = GetFilter(VOLUME,FT_OverConstrainedVolume) volumeFilter = GetFilter(VOLUME,FT_OverConstrainedVolume)

View File

@ -1,9 +1,15 @@
# Length 2D # Length 2D
import salome
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 open shell: a box without one plane # create open shell: a box without one plane
box = geompy.MakeBox(0., 0., 0., 20., 20., 15.) box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
@ -23,7 +29,7 @@ mesh.Compute()
# Criterion : Length 2D > 5.7 # Criterion : Length 2D > 5.7
length_margin = 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) anIds = mesh.GetIdsFromFilter(aFilter)
@ -38,7 +44,7 @@ for i in range(len(anIds)):
print "" print ""
# create a group # 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) aGroup.Add(anIds)
salome.sg.updateObjBrowser(1) salome.sg.updateObjBrowser(1)

View File

@ -1,9 +1,15 @@
# Borders at Multiconnection 2D # Borders at Multiconnection 2D
import salome
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 compound of two glued boxes # create a compound of two glued boxes
box1 = geompy.MakeBox(0., 0., 0., 20., 20., 15.) box1 = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
@ -23,7 +29,7 @@ mesh.Compute()
# Criterion : MULTI-CONNECTION 2D = 3 # Criterion : MULTI-CONNECTION 2D = 3
nb_conn = 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) anIds = mesh.GetIdsFromFilter(aFilter)
@ -38,7 +44,7 @@ for i in range(len(anIds)):
print "" print ""
# create a group # 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) aGroup.Add(anIds)
salome.sg.updateObjBrowser(1) salome.sg.updateObjBrowser(1)

View File

@ -9,7 +9,7 @@ salome = SMESH_mechanic.salome
# Criterion : AREA > 100. # Criterion : AREA > 100.
area_margin = 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) anIds = mesh.GetIdsFromFilter(aFilter)
@ -24,7 +24,7 @@ for i in range(len(anIds)):
print "" print ""
# create a group # create a group
aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Area > " + `area_margin`) aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Area > " + `area_margin`)
aGroup.Add(anIds) aGroup.Add(anIds)
salome.sg.updateObjBrowser(1) salome.sg.updateObjBrowser(1)

View File

@ -9,7 +9,7 @@ salome = SMESH_mechanic.salome
# Criterion : Taper > 3e-20 # Criterion : Taper > 3e-20
taper_margin = 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) anIds = mesh.GetIdsFromFilter(aFilter)
@ -24,7 +24,7 @@ for i in range(len(anIds)):
print "" print ""
# create a group # create a group
aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Taper > " + `taper_margin`) aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Taper > " + `taper_margin`)
aGroup.Add(anIds) aGroup.Add(anIds)
salome.sg.updateObjBrowser(1) salome.sg.updateObjBrowser(1)

View File

@ -9,7 +9,7 @@ salome = SMESH_mechanic.salome
# Criterion : ASPECT RATIO > 1.8 # Criterion : ASPECT RATIO > 1.8
ar_margin = 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) anIds = mesh.GetIdsFromFilter(aFilter)
@ -24,7 +24,7 @@ for i in range(len(anIds)):
print "" print ""
# create a group # create a group
aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Aspect Ratio > " + `ar_margin`) aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Aspect Ratio > " + `ar_margin`)
aGroup.Add(anIds) aGroup.Add(anIds)
salome.sg.updateObjBrowser(1) salome.sg.updateObjBrowser(1)

View File

@ -9,7 +9,7 @@ salome = SMESH_mechanic.salome
# Criterion : MINIMUM ANGLE < 35. # Criterion : MINIMUM ANGLE < 35.
min_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) anIds = mesh.GetIdsFromFilter(aFilter)
@ -24,7 +24,7 @@ for i in range(len(anIds)):
print "" print ""
# create a group # create a group
aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Minimum Angle < " + `min_angle`) aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Minimum Angle < " + `min_angle`)
aGroup.Add(anIds) aGroup.Add(anIds)

View File

@ -9,7 +9,7 @@ salome = SMESH_mechanic.salome
# Criterion : WARP ANGLE > 1e-15 # Criterion : WARP ANGLE > 1e-15
wa_margin = 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) anIds = mesh.GetIdsFromFilter(aFilter)
@ -24,7 +24,7 @@ for i in range(len(anIds)):
print "" print ""
# create a group # create a group
aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Warp > " + `wa_margin`) aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Warp > " + `wa_margin`)
aGroup.Add(anIds) aGroup.Add(anIds)

View File

@ -9,7 +9,7 @@ salome = SMESH_mechanic.salome
# Criterion : Skew > 38. # Criterion : Skew > 38.
skew_margin = 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) anIds = mesh.GetIdsFromFilter(aFilter)
@ -24,7 +24,7 @@ for i in range(len(anIds)):
print "" print ""
# create a group # create a group
aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Skew > " + `skew_margin`) aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Skew > " + `skew_margin`)
aGroup.Add(anIds) aGroup.Add(anIds)
salome.sg.updateObjBrowser(1) salome.sg.updateObjBrowser(1)

View File

@ -9,7 +9,7 @@ salome = SMESH_mechanic.salome
# Criterion : ELEMENT DIAMETER 2D > 10 # Criterion : ELEMENT DIAMETER 2D > 10
mel_2d_margin = 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) anIds = mesh.GetIdsFromFilter(aFilter)
@ -24,7 +24,7 @@ for i in range(len(anIds)):
print "" print ""
# create a group # 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) aGroup.Add(anIds)
salome.sg.updateObjBrowser(1) salome.sg.updateObjBrowser(1)

View File

@ -9,7 +9,7 @@ salome = SMESH_mechanic_tetra.salome
# Criterion : ASPECT RATIO 3D > 4.5 # Criterion : ASPECT RATIO 3D > 4.5
ar_margin = 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) anIds = mesh.GetIdsFromFilter(aFilter)
@ -24,7 +24,7 @@ for i in range(len(anIds)):
print "" print ""
# create a group # 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) aGroup.Add(anIds)

View File

@ -9,7 +9,7 @@ salome = SMESH_mechanic_tetra.salome
# Criterion : VOLUME < 7. # Criterion : VOLUME < 7.
volume_margin = 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) anIds = mesh.GetIdsFromFilter(aFilter)
@ -25,7 +25,7 @@ for i in range(len(anIds)):
print "" print ""
# create a group # create a group
aGroup = mesh.CreateEmptyGroup(smesh.VOLUME, "Volume < " + `volume_margin`) aGroup = mesh.CreateEmptyGroup(SMESH.VOLUME, "Volume < " + `volume_margin`)
aGroup.Add(anIds) aGroup.Add(anIds)

View File

@ -9,7 +9,7 @@ salome = SMESH_mechanic_tetra.salome
# Criterion : ELEMENT DIAMETER 3D > 10 # Criterion : ELEMENT DIAMETER 3D > 10
mel_3d_margin = 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) anIds = mesh.GetIdsFromFilter(aFilter)
@ -24,7 +24,7 @@ for i in range(len(anIds)):
print "" print ""
# create a group # 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) aGroup.Add(anIds)
salome.sg.updateObjBrowser(1) salome.sg.updateObjBrowser(1)

View File

@ -1,11 +1,18 @@
# Scale # 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) Box = geompy.MakeBoxDXDYDZ(200, 200, 200)
f = geompy.SubShapeAllSorted(Box, geompy.ShapeType["FACE"]) f = geompy.SubShapeAllSorted(Box, geompy.ShapeType["FACE"])
import smesh,SMESH
import StdMeshers
Mesh1 = smesh.Mesh(f[0]) Mesh1 = smesh.Mesh(f[0])
Regular_1D = Mesh1.Segment() Regular_1D = Mesh1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(3) Nb_Segments_1 = Regular_1D.NumberOfSegments(3)

View File

@ -1,8 +1,15 @@
# Merging Elements # Merging Elements
import salome import salome
import geompy salome.salome_init()
import smesh 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 # create a face to be meshed
px = geompy.MakeVertex(100., 0. , 0. ) px = geompy.MakeVertex(100., 0. , 0. )

View File

@ -1,7 +1,15 @@
# Sew Meshes Border to Side # 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 # create two faces of a box
box1 = geompy.MakeBox(0., 0., -10., 30., 20., 25.) box1 = geompy.MakeBox(0., 0., -10., 30., 20., 25.)

View File

@ -1,7 +1,17 @@
# Sew Conform Free Borders # 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 # create two faces of the box
box1 = geompy.MakeBox(0., 0., -10., 20., 20., 15.) box1 = geompy.MakeBox(0., 0., -10., 20., 20., 15.)

View File

@ -1,7 +1,15 @@
# Sew Free Borders # 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 # create two faces of the box
box1 = geompy.MakeBox(0., 0., 0., 20., 20., 15.) box1 = geompy.MakeBox(0., 0., 0., 20., 20., 15.)

View File

@ -1,7 +1,14 @@
# Sew Side Elements # Sew Side Elements
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)
# create two boxes # create two boxes
box1 = geompy.MakeBox(0., 0., 0., 10., 10., 10.) box1 = geompy.MakeBox(0., 0., 0., 10., 10., 10.)

View File

@ -1,8 +1,15 @@
# Duplicate nodes # Duplicate nodes
import salome import salome
import geompy salome.salome_init()
import smesh 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 # Create a box
@ -20,11 +27,11 @@ mesh.Compute()
# Without the duplication of border elements # Without the duplication of border elements
# Nodes to duplicate # Nodes to duplicate
nodes1 = mesh.CreateEmptyGroup( smesh.NODE, 'nodes1' ) nodes1 = mesh.CreateEmptyGroup( SMESH.NODE, 'nodes1' )
nodes1.Add( [ 119, 125, 131, 137 ] ) nodes1.Add( [ 119, 125, 131, 137 ] )
# Group of faces to replace nodes with new ones # 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 ] ) faces1.Add( [ 144, 151, 158 ] )
# Duplicate nodes # Duplicate nodes
@ -44,15 +51,15 @@ print "Quadrangles : ", mesh.NbQuadrangles()
# With the duplication of border elements # With the duplication of border elements
# Edges to duplicate # Edges to duplicate
edges = mesh.CreateEmptyGroup( smesh.EDGE, 'edges' ) edges = mesh.CreateEmptyGroup( SMESH.EDGE, 'edges' )
edges.Add( [ 32, 33, 34 ] ) edges.Add( [ 32, 33, 34 ] )
# Nodes not to duplicate # Nodes not to duplicate
nodes2 = mesh.CreateEmptyGroup( smesh.NODE, 'nodes2' ) nodes2 = mesh.CreateEmptyGroup( SMESH.NODE, 'nodes2' )
nodes2.Add( [ 35, 38 ] ) nodes2.Add( [ 35, 38 ] )
# Group of faces to replace nodes with new ones # 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 ] ) faces2.Add( [ 141, 148, 155 ] )
# Duplicate nodes # Duplicate nodes

View File

@ -1,7 +1,17 @@
# Create boundary elements # 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) box = geompy.MakeBoxDXDYDZ(100, 100, 100)
gFaces = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"]) gFaces = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])

View File

@ -1,6 +1,17 @@
# Reorient faces by vector # 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 # create a geometry consisting of two faces
box = geompy.MakeBoxDXDYDZ( 10, 10, 10 ) box = geompy.MakeBoxDXDYDZ( 10, 10, 10 )

View File

@ -1,6 +1,17 @@
# Use existing faces algorithm # 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 import numpy as np
# define my 2D algorithm # define my 2D algorithm

View File

@ -1,8 +1,15 @@
# Viewing Mesh Infos # Viewing Mesh Infos
import geompy
import smesh 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)
# create a box # create a box
box = geompy.MakeBox(0., 0., 0., 20., 20., 20.) box = geompy.MakeBox(0., 0., 0., 20., 20., 20.)

View File

@ -1,8 +1,15 @@
# Find Element by Point # Find Element by Point
import geompy
import smesh 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)
# Create a geometry to mesh # Create a geometry to mesh
box = geompy.MakeBoxDXDYDZ(100,100,100) box = geompy.MakeBoxDXDYDZ(100,100,100)

View File

@ -23,8 +23,8 @@ Python scripts.
\section filter_aspect_ratio Aspect ratio \section filter_aspect_ratio Aspect ratio
Filter 2D mesh elements (faces) according to the aspect ratio value: Filter 2D mesh elements (faces) according to the aspect ratio value:
- element type should be \a smesh.FACE - element type should be \a SMESH.FACE
- functor type should be \a smesh.FT_AspectRatio - functor type should be \a SMESH.FT_AspectRatio
- threshold is floating point value (aspect ratio) - threshold is floating point value (aspect ratio)
\tui_script{filters_ex01.py} \tui_script{filters_ex01.py}
@ -34,8 +34,8 @@ Filter 2D mesh elements (faces) according to the aspect ratio value:
\section filter_aspect_ratio_3d Aspect ratio 3D \section filter_aspect_ratio_3d Aspect ratio 3D
Filter 3D mesh elements (volumes) according to the aspect ratio value: Filter 3D mesh elements (volumes) according to the aspect ratio value:
- element type is \a smesh.VOLUME - element type is \a SMESH.VOLUME
- functor type is \a smesh.FT_AspectRatio3D - functor type is \a SMESH.FT_AspectRatio3D
- threshold is floating point value (aspect ratio) - threshold is floating point value (aspect ratio)
\tui_script{filters_ex02.py} \tui_script{filters_ex02.py}
@ -45,8 +45,8 @@ Filter 3D mesh elements (volumes) according to the aspect ratio value:
\section filter_warping_angle Warping angle \section filter_warping_angle Warping angle
Filter 2D mesh elements (faces) according to the warping angle value: Filter 2D mesh elements (faces) according to the warping angle value:
- element type is \a smesh.FACE - element type is \a SMESH.FACE
- functor type is \a smesh.FT_Warping - functor type is \a SMESH.FT_Warping
- threshold is floating point value (warping angle) - threshold is floating point value (warping angle)
\tui_script{filters_ex03.py} \tui_script{filters_ex03.py}
@ -56,8 +56,8 @@ Filter 2D mesh elements (faces) according to the warping angle value:
\section filter_minimum_angle Minimum angle \section filter_minimum_angle Minimum angle
Filter 2D mesh elements (faces) according to the minimum angle value: Filter 2D mesh elements (faces) according to the minimum angle value:
- element type is \a smesh.FACE - element type is \a SMESH.FACE
- functor type is \a smesh.FT_MinimumAngle - functor type is \a SMESH.FT_MinimumAngle
- threshold is floating point value (minimum angle) - threshold is floating point value (minimum angle)
\tui_script{filters_ex04.py} \tui_script{filters_ex04.py}
@ -67,8 +67,8 @@ Filter 2D mesh elements (faces) according to the minimum angle value:
\section filter_taper Taper \section filter_taper Taper
Filter 2D mesh elements (faces) according to the taper value: Filter 2D mesh elements (faces) according to the taper value:
- element type is \a smesh.FACE - element type is \a SMESH.FACE
- functor type is \a smesh.FT_Taper - functor type is \a SMESH.FT_Taper
- threshold is floating point value (taper) - threshold is floating point value (taper)
\tui_script{filters_ex05.py} \tui_script{filters_ex05.py}
@ -78,8 +78,8 @@ Filter 2D mesh elements (faces) according to the taper value:
\section filter_skew Skew \section filter_skew Skew
Filter 2D mesh elements (faces) according to the skew value: Filter 2D mesh elements (faces) according to the skew value:
- element type is \a smesh.FACE - element type is \a SMESH.FACE
- functor type is \a smesh.FT_Skew - functor type is \a SMESH.FT_Skew
- threshold is floating point value (skew) - threshold is floating point value (skew)
\tui_script{filters_ex06.py} \tui_script{filters_ex06.py}
@ -89,8 +89,8 @@ Filter 2D mesh elements (faces) according to the skew value:
\section filter_area Area \section filter_area Area
Filter 2D mesh elements (faces) according to the area value: Filter 2D mesh elements (faces) according to the area value:
- element type is \a smesh.FACE - element type is \a SMESH.FACE
- functor type is \a smesh.FT_Area - functor type is \a SMESH.FT_Area
- threshold is floating point value (area) - threshold is floating point value (area)
\tui_script{filters_ex07.py} \tui_script{filters_ex07.py}
@ -100,8 +100,8 @@ Filter 2D mesh elements (faces) according to the area value:
\section filter_volume Volume \section filter_volume Volume
Filter 3D mesh elements (volumes) according to the volume value: Filter 3D mesh elements (volumes) according to the volume value:
- element type is \a smesh.VOLUME - element type is \a SMESH.VOLUME
- functor type is \a smesh.FT_Volume3D - functor type is \a SMESH.FT_Volume3D
- threshold is floating point value (volume) - threshold is floating point value (volume)
\tui_script{filters_ex08.py} \tui_script{filters_ex08.py}
@ -111,8 +111,8 @@ Filter 3D mesh elements (volumes) according to the volume value:
\section filter_free_borders Free borders \section filter_free_borders Free borders
Filter 1D mesh elements (edges) which represent free borders of a mesh: Filter 1D mesh elements (edges) which represent free borders of a mesh:
- element type is \a smesh.EDGE - element type is \a SMESH.EDGE
- functor type is \a smesh.FT_FreeBorders - functor type is \a SMESH.FT_FreeBorders
- threshold value is not required - threshold value is not required
\tui_script{filters_ex09.py} \tui_script{filters_ex09.py}
@ -123,8 +123,8 @@ Filter 1D mesh elements (edges) which represent free borders of a mesh:
Filter 2D mesh elements (faces) consisting of edges belonging to one Filter 2D mesh elements (faces) consisting of edges belonging to one
element of mesh only: element of mesh only:
- element type is \a smesh.FACE - element type is \a SMESH.FACE
- functor type is \a smesh.FT_FreeEdges - functor type is \a SMESH.FT_FreeEdges
- threshold value is not required - threshold value is not required
\tui_script{filters_ex10.py} \tui_script{filters_ex10.py}
@ -134,8 +134,8 @@ element of mesh only:
\section filter_free_nodes Free nodes \section filter_free_nodes Free nodes
Filter free nodes: Filter free nodes:
- element type is \a smesh.NODE - element type is \a SMESH.NODE
- functor type is \a smesh.FT_FreeNodes - functor type is \a SMESH.FT_FreeNodes
- threshold value is not required - threshold value is not required
\tui_script{filters_ex11.py} \tui_script{filters_ex11.py}
@ -145,8 +145,8 @@ Filter free nodes:
\section filter_free_faces Free faces \section filter_free_faces Free faces
Filter free faces: Filter free faces:
- element type is \a smesh.FACE - element type is \a SMESH.FACE
- functor type is \a smesh.FT_FreeFaces - functor type is \a SMESH.FT_FreeFaces
- threshold value is not required - threshold value is not required
\tui_script{filters_ex12.py} \tui_script{filters_ex12.py}
@ -156,8 +156,8 @@ Filter free faces:
\section filter_bare_border_faces Bare border faces \section filter_bare_border_faces Bare border faces
Filter faces with bare borders: Filter faces with bare borders:
- element type is \a smesh.FACE - element type is \a SMESH.FACE
- functor type is \a smesh.FT_BareBorderFace - functor type is \a SMESH.FT_BareBorderFace
- threshold value is not required - threshold value is not required
\tui_script{filters_ex13.py} \tui_script{filters_ex13.py}
@ -167,8 +167,8 @@ Filter faces with bare borders:
\section filter_coplanar_faces Coplanar faces \section filter_coplanar_faces Coplanar faces
Filter faces with bare borders: Filter faces with bare borders:
- element type is \a smesh.FACE - element type is \a SMESH.FACE
- functor type is \a smesh.FT_CoplanarFaces - functor type is \a SMESH.FT_CoplanarFaces
- threshold value is the face ID - threshold value is the face ID
- tolerance is in degrees - tolerance is in degrees
@ -177,8 +177,8 @@ Filter faces with bare borders:
\section filter_over_constrained_faces Over-constrained faces \section filter_over_constrained_faces Over-constrained faces
Filter over-constrained faces: Filter over-constrained faces:
- element type is \a smesh.FACE - element type is \a SMESH.FACE
- functor type is \a smesh.FT_OverConstrainedFace - functor type is \a SMESH.FT_OverConstrainedFace
- threshold value is not required - threshold value is not required
\tui_script{filters_ex15.py} \tui_script{filters_ex15.py}
@ -188,9 +188,9 @@ Filter over-constrained faces:
\section filter_double_elements Double edges, Double faces, Double volumes \section filter_double_elements Double edges, Double faces, Double volumes
filter mesh elements basing on the same set of nodes: filter mesh elements basing on the same set of nodes:
- element type is either \a smesh.EGDE, \a smesh.FACE or \a smesh.VOLUME - element type is either \a smesh.EGDE, \a SMESH.FACE or \a SMESH.VOLUME
- functor type is either \a smesh.FT_EqualEdges, \a - functor type is either \a SMESH.FT_EqualEdges, \a
smesh.FT_EqualFaces or \a smesh.FT_EqualVolumes, SMESH.FT_EqualFaces or \a SMESH.FT_EqualVolumes,
- threshold value is not required - threshold value is not required
\tui_script{filters_ex16.py} \tui_script{filters_ex16.py}
@ -199,8 +199,8 @@ filter mesh elements basing on the same set of nodes:
\section tui_double_nodes_control Double nodes \section tui_double_nodes_control Double nodes
filters mesh nodes which are coincident with other nodes (within a given tolerance): filters mesh nodes which are coincident with other nodes (within a given tolerance):
- element type is \a smesh.NODE - element type is \a SMESH.NODE
- functor type is \a smesh.FT_EqualNodes - functor type is \a SMESH.FT_EqualNodes
- threshold value is not required - threshold value is not required
- default tolerance is 1.0e-7 - default tolerance is 1.0e-7
@ -211,8 +211,8 @@ filters mesh nodes which are coincident with other nodes (within a given toleran
Filter border 1D mesh elements (edges) according to the specified number of Filter border 1D mesh elements (edges) according to the specified number of
connections (faces belonging the border edges) connections (faces belonging the border edges)
- element type is \a smesh.EDGE - element type is \a SMESH.EDGE
- functor type is \a smesh.FT_MultiConnection - functor type is \a SMESH.FT_MultiConnection
- threshold is integer value (number of connections) - threshold is integer value (number of connections)
\tui_script{filters_ex18.py} \tui_script{filters_ex18.py}
@ -223,8 +223,8 @@ connections (faces belonging the border edges)
Filter 2D mesh elements (faces) which consist of edges belonging Filter 2D mesh elements (faces) which consist of edges belonging
to the specified number of mesh elements to the specified number of mesh elements
- element type is \a smesh.FACE - element type is \a SMESH.FACE
- functor type is \a smesh.FT_MultiConnection2D - functor type is \a SMESH.FT_MultiConnection2D
- threshold is integer value (number of connections) - threshold is integer value (number of connections)
\tui_script{filters_ex19.py} \tui_script{filters_ex19.py}
@ -234,8 +234,8 @@ to the specified number of mesh elements
\section filter_length Length \section filter_length Length
Filter 1D mesh elements (edges) according to the edge length value: Filter 1D mesh elements (edges) according to the edge length value:
- element type should be \a smesh.EDGE - element type should be \a SMESH.EDGE
- functor type should be \a smesh.FT_Length - functor type should be \a SMESH.FT_Length
- threshold is floating point value (length) - threshold is floating point value (length)
\tui_script{filters_ex20.py} \tui_script{filters_ex20.py}
@ -246,8 +246,8 @@ Filter 1D mesh elements (edges) according to the edge length value:
Filter 2D mesh elements (faces) corresponding to the maximum length. Filter 2D mesh elements (faces) corresponding to the maximum length.
value of its edges: value of its edges:
- element type should be \a smesh.FACE - element type should be \a SMESH.FACE
- functor type should be \a smesh.FT_Length2D - functor type should be \a SMESH.FT_Length2D
- threshold is floating point value (edge length) - threshold is floating point value (edge length)
\tui_script{filters_ex21.py} \tui_script{filters_ex21.py}
@ -258,8 +258,8 @@ value of its edges:
Filter 2D mesh elements (faces) corresponding to the maximum length Filter 2D mesh elements (faces) corresponding to the maximum length
value of its edges and diagonals: value of its edges and diagonals:
- element type should be \a smesh.FACE - element type should be \a SMESH.FACE
- functor type should be \a smesh.FT_MaxElementLength2D - functor type should be \a SMESH.FT_MaxElementLength2D
- threshold is floating point value (edge/diagonal length) - threshold is floating point value (edge/diagonal length)
\tui_script{filters_ex22.py} \tui_script{filters_ex22.py}
@ -270,8 +270,8 @@ value of its edges and diagonals:
Filter 3D mesh elements (volumes) corresponding to the maximum length Filter 3D mesh elements (volumes) corresponding to the maximum length
value of its edges and diagonals: value of its edges and diagonals:
- element type should be \a smesh.VOLUME - element type should be \a SMESH.VOLUME
- functor type should be \a smesh.FT_MaxElementLength3D - functor type should be \a SMESH.FT_MaxElementLength3D
- threshold is floating point value (edge/diagonal length) - threshold is floating point value (edge/diagonal length)
\tui_script{filters_ex23.py} \tui_script{filters_ex23.py}
@ -281,8 +281,8 @@ value of its edges and diagonals:
\section filter_bare_border_volumes Bare border volumes \section filter_bare_border_volumes Bare border volumes
Filter 3D mesh elements with bare borders: Filter 3D mesh elements with bare borders:
- element type is \a smesh.VOLUME - element type is \a SMESH.VOLUME
- functor type is \a smesh.FT_BareBorderVolume - functor type is \a SMESH.FT_BareBorderVolume
- threshold value is not required - threshold value is not required
\tui_script{filters_ex24.py} \tui_script{filters_ex24.py}
@ -292,8 +292,8 @@ Filter 3D mesh elements with bare borders:
\section filter_over_constrained_volumes Over-constrained volumes \section filter_over_constrained_volumes Over-constrained volumes
Filter over-constrained volumes: Filter over-constrained volumes:
- element type is \a smesh.VOLUME - element type is \a SMESH.VOLUME
- functor type is \a smesh.FT_OverConstrainedVolume - functor type is \a SMESH.FT_OverConstrainedVolume
- threshold value is not required - threshold value is not required
\tui_script{filters_ex25.py} \tui_script{filters_ex25.py}
@ -304,8 +304,8 @@ Filter over-constrained volumes:
Filter mesh entities (nodes or elements) which all nodes lie on the Filter mesh entities (nodes or elements) which all nodes lie on the
shape defined by threshold value: shape defined by threshold value:
- element type can be any entity type, from \a smesh.NODE to \a smesh.VOLUME - element type can be any entity type, from \a SMESH.NODE to \a SMESH.VOLUME
- functor type should be \a smesh.FT_BelongToGeom - functor type should be \a SMESH.FT_BelongToGeom
- threshold is geometrical object - threshold is geometrical object
\tui_script{filters_ex26.py} \tui_script{filters_ex26.py}
@ -314,8 +314,8 @@ shape defined by threshold value:
Filter mesh entities (nodes or elements) at least one node of which lies on the Filter mesh entities (nodes or elements) at least one node of which lies on the
shape defined by threshold value: shape defined by threshold value:
- element type can be any entity type, from \a smesh.NODE to \a smesh.VOLUME - element type can be any entity type, from \a SMESH.NODE to \a SMESH.VOLUME
- functor type should be \a smesh.FT_LyingOnGeom - functor type should be \a SMESH.FT_LyingOnGeom
- threshold is geometrical object - threshold is geometrical object
\tui_script{filters_ex27.py} \tui_script{filters_ex27.py}
@ -324,8 +324,8 @@ shape defined by threshold value:
Filter mesh entities (nodes or elements) which all nodes belong to the Filter mesh entities (nodes or elements) which all nodes belong to the
plane defined by threshold value with the given tolerance: plane defined by threshold value with the given tolerance:
- element type can be: \a smesh.NODE, \a smesh.EDGE, \a smesh.FACE - element type can be: \a SMESH.NODE, \a SMESH.EDGE, \a SMESH.FACE
- functor type should be \a smesh.FT_BelongToPlane - functor type should be \a SMESH.FT_BelongToPlane
- threshold is geometrical object (plane) - threshold is geometrical object (plane)
- default tolerance is 1.0e-7 - default tolerance is 1.0e-7
@ -335,8 +335,8 @@ plane defined by threshold value with the given tolerance:
Filter mesh entities (nodes or elements) which all nodes belong to the Filter mesh entities (nodes or elements) which all nodes belong to the
cylindrical face defined by threshold value with the given tolerance: cylindrical face defined by threshold value with the given tolerance:
- element type can be: \a smesh.NODE, \a smesh.EDGE, \a smesh.FACE - element type can be: \a , \a SMESH.EDGE, \a SMESH.FACE
- functor type should be \a smesh.FT_BelongToCylinder - functor type should be \a SMESH.FT_BelongToCylinder
- threshold is geometrical object (cylindrical face) - threshold is geometrical object (cylindrical face)
- default tolerance is 1.0e-7 - default tolerance is 1.0e-7
@ -346,8 +346,8 @@ cylindrical face defined by threshold value with the given tolerance:
Filter mesh entities (nodes or elements) which all nodes belong to the Filter mesh entities (nodes or elements) which all nodes belong to the
arbitrary surface defined by threshold value with the given tolerance: arbitrary surface defined by threshold value with the given tolerance:
- element type can be: \a smesh.NODE, \a smesh.EDGE, \a smesh.FACE - element type can be: \a SMESH.NODE, \a SMESH.EDGE, \a SMESH.FACE
- functor type should be \a smesh.FT_BelongToGenSurface - functor type should be \a SMESH.FT_BelongToGenSurface
- threshold is geometrical object (arbitrary surface) - threshold is geometrical object (arbitrary surface)
- default tolerance is 1.0e-7 - default tolerance is 1.0e-7
@ -357,8 +357,8 @@ arbitrary surface defined by threshold value with the given tolerance:
Filter mesh entities elements (nodes or elements) according to the Filter mesh entities elements (nodes or elements) according to the
specified identifiers range: specified identifiers range:
- element type can be any entity type, from \a smesh.NODE to \a smesh.VOLUME - element type can be any entity type, from \a SMESH.NODE to \a SMESH.VOLUME
- functor type is \a smesh.FT_RangeOfIds - 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" - 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} \tui_script{filters_ex31.py}
@ -367,8 +367,8 @@ specified identifiers range:
Filter 3D mesh elements (volumes), which are incorrectly oriented from Filter 3D mesh elements (volumes), which are incorrectly oriented from
the point of view of MED convention. the point of view of MED convention.
- element type should be \a smesh.VOLUME - element type should be \a SMESH.VOLUME
- functor type is \a smesh.FT_BadOrientedVolume - functor type is \a SMESH.FT_BadOrientedVolume
- threshold is not required - threshold is not required
\tui_script{filters_ex32.py} \tui_script{filters_ex32.py}
@ -376,10 +376,10 @@ the point of view of MED convention.
\section filter_linear_or_quadratic Linear / quadratic \section filter_linear_or_quadratic Linear / quadratic
Filter linear / quadratic mesh elements: Filter linear / quadratic mesh elements:
- element type should be any element type, e.g.: \a smesh.EDGE, \a smesh.FACE, \a smesh.VOLUME - 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 - functor type is \a SMESH.FT_LinearOrQuadratic
- threshold is not required - 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 elements are selected, otherwise (by default) linear elements are selected
\tui_script{filters_ex33.py} \tui_script{filters_ex33.py}
@ -387,8 +387,8 @@ elements are selected, otherwise (by default) linear elements are selected
\section filter_group_color Group color \section filter_group_color Group color
Filter mesh entities, belonging to the group with the color defined by the threshold value. 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 - element type can be any entity type, from \a SMESH.NODE to \a SMESH.VOLUME
- functor type is \a smesh.FT_GroupColor - functor type is \a SMESH.FT_GroupColor
- threshold should be of SALOMEDS.Color type - threshold should be of SALOMEDS.Color type
\tui_script{filters_ex34.py} \tui_script{filters_ex34.py}
@ -398,8 +398,8 @@ Filter mesh entities, belonging to the group with the color defined by the thres
Filter mesh elements by the geometric type defined with the threshold Filter mesh elements by the geometric type defined with the threshold
value. The list of available geometric types depends on the element value. The list of available geometric types depends on the element
entity type. entity type.
- element type should be any element type, e.g.: \a smesh.EDGE, \a smesh.FACE, \a smesh.VOLUME - 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 - functor type should be \a SMESH.FT_ElemGeomType
- threshold is of smesh.GeometryType value - threshold is of smesh.GeometryType value
\tui_script{filters_ex35.py} \tui_script{filters_ex35.py}