mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-24 16:30:34 +05:00
Merge from BR_plugins_pbyacs 03/04/2013
This commit is contained in:
parent
1cd84a9d45
commit
54182913fb
@ -64,7 +64,7 @@ fi
|
||||
|
||||
#CCRTif test -f ${SMESH_DIR}/bin/salome/libSMESH_Swig.py ; then
|
||||
#if test -f ${SMESH_DIR}/bin/salome/MED_Test ; then
|
||||
if test -f ${SMESH_DIR}/bin/salome/smesh.py ; then
|
||||
if test -f ${SMESH_DIR}/bin/salome/SMESH_test.py ; then
|
||||
SMesh_ok=yes
|
||||
AC_MSG_RESULT(Using SMesh module distribution in ${SMESH_DIR})
|
||||
|
||||
|
@ -1,7 +1,14 @@
|
||||
# 3d mesh generation
|
||||
|
||||
from geompy import *
|
||||
import smesh
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
###
|
||||
# Geometry: an assembly of a box, a cylinder and a truncated cone
|
||||
@ -18,33 +25,33 @@ radius_2 = 40
|
||||
height = 100
|
||||
|
||||
# Build a box
|
||||
box = MakeBox(-cote, -cote, -cote, +cote, +cote, +cote)
|
||||
box = geompy.MakeBox(-cote, -cote, -cote, +cote, +cote, +cote)
|
||||
|
||||
# Build a cylinder
|
||||
pt1 = MakeVertex(0, 0, cote/3)
|
||||
di1 = MakeVectorDXDYDZ(0, 0, 1)
|
||||
cyl = MakeCylinder(pt1, di1, section, size)
|
||||
pt1 = geompy.MakeVertex(0, 0, cote/3)
|
||||
di1 = geompy.MakeVectorDXDYDZ(0, 0, 1)
|
||||
cyl = geompy.MakeCylinder(pt1, di1, section, size)
|
||||
|
||||
# Build a truncated cone
|
||||
pt2 = MakeVertex(0, 0, size)
|
||||
cone = MakeCone(pt2, di1, radius_1, radius_2, height)
|
||||
pt2 = geompy.MakeVertex(0, 0, size)
|
||||
cone = geompy.MakeCone(pt2, di1, radius_1, radius_2, height)
|
||||
|
||||
# Fuse
|
||||
box_cyl = MakeFuse(box, cyl)
|
||||
piece = MakeFuse(box_cyl, cone)
|
||||
box_cyl = geompy.MakeFuse(box, cyl)
|
||||
piece = geompy.MakeFuse(box_cyl, cone)
|
||||
|
||||
# Add to the study
|
||||
addToStudy(piece, name)
|
||||
geompy.addToStudy(piece, name)
|
||||
|
||||
# Create a group of faces
|
||||
group = CreateGroup(piece, ShapeType["FACE"])
|
||||
group = geompy.CreateGroup(piece, geompy.ShapeType["FACE"])
|
||||
group_name = name + "_grp"
|
||||
addToStudy(group, group_name)
|
||||
geompy.addToStudy(group, group_name)
|
||||
group.SetName(group_name)
|
||||
|
||||
# Add faces to the group
|
||||
faces = SubShapeAllIDs(piece, ShapeType["FACE"])
|
||||
UnionIDs(group, faces)
|
||||
faces = geompy.SubShapeAllIDs(piece, geompy.ShapeType["FACE"])
|
||||
geompy.UnionIDs(group, faces)
|
||||
|
||||
###
|
||||
# Create a mesh
|
||||
|
@ -1,14 +1,24 @@
|
||||
# Usage of Body Fitting algorithm
|
||||
|
||||
from smesh import *
|
||||
SetCurrentStudy(salome.myStudy)
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
import salome_notebook
|
||||
|
||||
|
||||
# create a sphere
|
||||
sphere = geompy.MakeSphereR( 50 )
|
||||
geompy.addToStudy( sphere, "sphere" )
|
||||
|
||||
# create a mesh and assign a "Body Fitting" algo
|
||||
mesh = Mesh( sphere )
|
||||
mesh = smesh.Mesh( sphere )
|
||||
cartAlgo = mesh.BodyFitted()
|
||||
|
||||
# define a cartesian grid using Coordinates
|
||||
|
@ -1,7 +1,14 @@
|
||||
# Construction of a Mesh
|
||||
|
||||
import geompy
|
||||
import smesh
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# create a box
|
||||
box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
|
||||
|
@ -1,16 +1,23 @@
|
||||
# Construction of a Submesh
|
||||
|
||||
from geompy import *
|
||||
import smesh
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# create a box
|
||||
box = MakeBoxDXDYDZ(10., 10., 10.)
|
||||
addToStudy(box, "Box")
|
||||
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
|
||||
geompy.addToStudy(box, "Box")
|
||||
|
||||
# select one edge of the box for definition of a local hypothesis
|
||||
p5 = MakeVertex(5., 0., 0.)
|
||||
EdgeX = GetEdgeNearPoint(box, p5)
|
||||
addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
|
||||
p5 = geompy.MakeVertex(5., 0., 0.)
|
||||
EdgeX = geompy.GetEdgeNearPoint(box, p5)
|
||||
geompy.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
|
||||
|
||||
# create a hexahedral mesh on the box
|
||||
quadra = smesh.Mesh(box, "Box : quadrangle 2D mesh")
|
||||
|
@ -1,9 +1,14 @@
|
||||
# Change priority of submeshes in Mesh
|
||||
|
||||
import salome
|
||||
import geompy
|
||||
import smesh
|
||||
import SMESH
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
|
||||
[Face_1,Face_2,Face_3,Face_4,Face_5,Face_6] = geompy.SubShapeAllSorted(Box_1, geompy.ShapeType["FACE"])
|
||||
@ -24,7 +29,7 @@ Max_Element_Volume_1 = Tetrahedron.MaxElementVolume(40000)
|
||||
Regular_1D_1 = Mesh_1.Segment(geom=Face_1)
|
||||
Nb_Segments_2 = Regular_1D_1.NumberOfSegments(4)
|
||||
Nb_Segments_2.SetDistrType( 0 )
|
||||
MEFISTO_2D_1 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_1)
|
||||
MEFISTO_2D_1 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_1)
|
||||
Length_From_Edges_2D = MEFISTO_2D_1.LengthFromEdges()
|
||||
SubMesh_1 = MEFISTO_2D_1.GetSubMesh()
|
||||
|
||||
@ -32,7 +37,7 @@ SubMesh_1 = MEFISTO_2D_1.GetSubMesh()
|
||||
Regular_1D_2 = Mesh_1.Segment(geom=Face_2)
|
||||
Nb_Segments_3 = Regular_1D_2.NumberOfSegments(8)
|
||||
Nb_Segments_3.SetDistrType( 0 )
|
||||
MEFISTO_2D_2 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_2)
|
||||
MEFISTO_2D_2 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_2)
|
||||
Length_From_Edges_2D_1 = MEFISTO_2D_2.LengthFromEdges()
|
||||
SubMesh_2 = MEFISTO_2D_2.GetSubMesh()
|
||||
|
||||
@ -40,7 +45,7 @@ SubMesh_2 = MEFISTO_2D_2.GetSubMesh()
|
||||
Regular_1D_3 = Mesh_1.Segment(geom=Face_3)
|
||||
Nb_Segments_4 = Regular_1D_3.NumberOfSegments(12)
|
||||
Nb_Segments_4.SetDistrType( 0 )
|
||||
MEFISTO_2D_3 = Mesh_1.Triangle(algo=smesh.MEFISTO,geom=Face_3)
|
||||
MEFISTO_2D_3 = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO,geom=Face_3)
|
||||
Length_From_Edges_2D_2 = MEFISTO_2D_3.LengthFromEdges()
|
||||
SubMesh_3 = MEFISTO_2D_3.GetSubMesh()
|
||||
|
||||
|
@ -1,7 +1,14 @@
|
||||
# Editing of a mesh
|
||||
|
||||
import geompy
|
||||
import smesh
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
def PrintMeshInfo(theMesh):
|
||||
aMesh = theMesh.GetMesh()
|
||||
|
@ -1,7 +1,14 @@
|
||||
# Export of a Mesh
|
||||
|
||||
import geompy
|
||||
import smesh
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# create a box
|
||||
box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
|
||||
|
@ -1,12 +1,17 @@
|
||||
# Creating a hexahedral mesh on a cylinder.
|
||||
# Note: it is a copy of 'ex24_cylinder.py' from SMESH_SWIG
|
||||
|
||||
import math
|
||||
|
||||
import geompy
|
||||
import smesh
|
||||
import salome
|
||||
geo = geompy
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
import math
|
||||
|
||||
# Parameters
|
||||
# ----------
|
||||
@ -17,62 +22,62 @@ height = 200
|
||||
# Build a cylinder
|
||||
# ----------------
|
||||
|
||||
base = geo.MakeVertex(0, 0, 0)
|
||||
direction = geo.MakeVectorDXDYDZ(0, 0, 1)
|
||||
base = geompy.MakeVertex(0, 0, 0)
|
||||
direction = geompy.MakeVectorDXDYDZ(0, 0, 1)
|
||||
|
||||
cylinder = geo.MakeCylinder(base, direction, radius, height)
|
||||
cylinder = geompy.MakeCylinder(base, direction, radius, height)
|
||||
|
||||
geo.addToStudy(cylinder, "cylinder")
|
||||
geompy.addToStudy(cylinder, "cylinder")
|
||||
|
||||
# Build blocks
|
||||
# ------------
|
||||
|
||||
size = radius/2.0
|
||||
|
||||
box_rot = geo.MakeBox(-size, -size, 0, +size, +size, height)
|
||||
box_axis = geo.MakeLine(base, direction)
|
||||
box = geo.MakeRotation(box_rot, box_axis, math.pi/4)
|
||||
box_rot = geompy.MakeBox(-size, -size, 0, +size, +size, height)
|
||||
box_axis = geompy.MakeLine(base, direction)
|
||||
box = geompy.MakeRotation(box_rot, box_axis, math.pi/4)
|
||||
|
||||
hole = geo.MakeCut(cylinder, box)
|
||||
hole = geompy.MakeCut(cylinder, box)
|
||||
|
||||
plane_trim = 2000
|
||||
|
||||
plane_a = geo.MakePlane(base, geo.MakeVectorDXDYDZ(1, 0, 0), plane_trim)
|
||||
plane_b = geo.MakePlane(base, geo.MakeVectorDXDYDZ(0, 1, 0), plane_trim)
|
||||
plane_a = geompy.MakePlane(base, geompy.MakeVectorDXDYDZ(1, 0, 0), plane_trim)
|
||||
plane_b = geompy.MakePlane(base, geompy.MakeVectorDXDYDZ(0, 1, 0), plane_trim)
|
||||
|
||||
blocks_part = geo.MakePartition([hole], [plane_a, plane_b], [], [], geo.ShapeType["SOLID"])
|
||||
blocks_list = [box] + geo.SubShapeAll(blocks_part, geo.ShapeType["SOLID"])
|
||||
blocks_all = geo.MakeCompound(blocks_list)
|
||||
blocks = geo.MakeGlueFaces(blocks_all, 0.0001)
|
||||
blocks_part = geompy.MakePartition([hole], [plane_a, plane_b], [], [], geompy.ShapeType["SOLID"])
|
||||
blocks_list = [box] + geompy.SubShapeAll(blocks_part, geompy.ShapeType["SOLID"])
|
||||
blocks_all = geompy.MakeCompound(blocks_list)
|
||||
blocks = geompy.MakeGlueFaces(blocks_all, 0.0001)
|
||||
|
||||
geo.addToStudy(blocks, "cylinder:blocks")
|
||||
geompy.addToStudy(blocks, "cylinder:blocks")
|
||||
|
||||
# Build geometric groups
|
||||
# ----------------------
|
||||
|
||||
def group(name, shape, type, base=None, direction=None):
|
||||
t = geo.ShapeType[type]
|
||||
g = geo.CreateGroup(shape, t)
|
||||
t = geompy.ShapeType[type]
|
||||
g = geompy.CreateGroup(shape, t)
|
||||
|
||||
geo.addToStudy(g, name)
|
||||
geompy.addToStudy(g, name)
|
||||
g.SetName(name)
|
||||
|
||||
if base!=None:
|
||||
l = geo.GetShapesOnPlaneWithLocationIDs(shape, t, direction, base, geo.GEOM.ST_ON)
|
||||
geo.UnionIDs(g, l)
|
||||
l = geompy.GetShapesOnPlaneWithLocationIDs(shape, t, direction, base, GEOM.ST_ON)
|
||||
geompy.UnionIDs(g, l)
|
||||
|
||||
return g
|
||||
|
||||
group_a = group("baseA", blocks, "FACE", base, direction)
|
||||
|
||||
base_b = geo.MakeVertex(0, 0, height)
|
||||
base_b = geompy.MakeVertex(0, 0, height)
|
||||
group_b = group("baseB", blocks, "FACE", base_b, direction)
|
||||
|
||||
group_1 = group("limit", blocks, "SOLID")
|
||||
group_1_all = geo.SubShapeAllIDs(blocks, geo.ShapeType["SOLID"])
|
||||
geo.UnionIDs(group_1, group_1_all)
|
||||
group_1_box = geo.GetBlockNearPoint(blocks, base)
|
||||
geo.DifferenceList(group_1, [group_1_box])
|
||||
group_1_all = geompy.SubShapeAllIDs(blocks, geompy.ShapeType["SOLID"])
|
||||
geompy.UnionIDs(group_1, group_1_all)
|
||||
group_1_box = geompy.GetBlockNearPoint(blocks, base)
|
||||
geompy.DifferenceList(group_1, [group_1_box])
|
||||
|
||||
# Mesh the blocks with hexahedral
|
||||
# -------------------------------
|
||||
@ -80,8 +85,8 @@ geo.DifferenceList(group_1, [group_1_box])
|
||||
smesh.SetCurrentStudy(salome.myStudy)
|
||||
|
||||
def discretize(x, y, z, n, s=blocks):
|
||||
p = geo.MakeVertex(x, y, z)
|
||||
e = geo.GetEdgeNearPoint(s, p)
|
||||
p = geompy.MakeVertex(x, y, z)
|
||||
e = geompy.GetEdgeNearPoint(s, p)
|
||||
a = hexa.Segment(e)
|
||||
a.NumberOfSegments(n)
|
||||
a.Propagation()
|
||||
|
@ -2,8 +2,14 @@
|
||||
# Note: it is a copy of 'SMESH_BuildCompound.py' from SMESH_SWIG
|
||||
|
||||
import salome
|
||||
import geompy
|
||||
import smesh
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
## create a bottom box
|
||||
Box_inf = geompy.MakeBox(0., 0., 0., 200., 200., 50.)
|
||||
@ -65,9 +71,9 @@ Ginf2=Mesh_sup.Group(Finf2, "Inf")
|
||||
## create compounds
|
||||
# create a compound of two meshes with renaming groups with the same names and
|
||||
# merging of elements with the given tolerance
|
||||
Compound1 = smesh.smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 0, 1, 1e-05)
|
||||
Compound1 = smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 0, 1, 1e-05)
|
||||
smesh.SetName(Compound1, 'Compound_with_RenamedGrps_and_MergeElems')
|
||||
# create a compound of two meshes with uniting groups with the same names and
|
||||
# creating groups of all elements
|
||||
Compound2 = smesh.smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 1, 0, 1e-05, True)
|
||||
Compound2 = smesh.Concatenate([Mesh_inf.GetMesh(), Mesh_sup.GetMesh()], 1, 0, 1e-05, True)
|
||||
smesh.SetName(Compound2, 'Compound_with_UniteGrps_and_GrpsOfAllElems')
|
||||
|
@ -1,40 +1,47 @@
|
||||
# Mesh Copying
|
||||
|
||||
from smesh import *
|
||||
SetCurrentStudy(salome.myStudy)
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# make geometry of a box
|
||||
box = geompy.MakeBoxDXDYDZ(100,100,100)
|
||||
face = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])[0]
|
||||
|
||||
# generate 3D mesh
|
||||
mesh = Mesh(box)
|
||||
mesh = smesh.Mesh(box)
|
||||
localAlgo = mesh.Triangle(face)
|
||||
mesh.AutomaticHexahedralization()
|
||||
|
||||
# objects to copy
|
||||
fGroup = mesh.GroupOnGeom( face, "2D on face")
|
||||
nGroup = mesh.GroupOnGeom( face, "nodes on face", NODE)
|
||||
nGroup = mesh.GroupOnGeom( face, "nodes on face", SMESH.NODE)
|
||||
subMesh = localAlgo.GetSubMesh()
|
||||
|
||||
# make a new mesh by copying different parts of the mesh
|
||||
|
||||
# 1. copy the whole mesh
|
||||
newMesh = CopyMesh( mesh, "whole mesh copy")
|
||||
newMesh = smesh.CopyMesh( mesh, "whole mesh copy")
|
||||
|
||||
# 2. copy a group of 2D elements along with groups
|
||||
newMesh = CopyMesh( fGroup, "face group copy with groups",toCopyGroups=True)
|
||||
newMesh = smesh.CopyMesh( fGroup, "face group copy with groups",toCopyGroups=True)
|
||||
|
||||
# 3. copy a group of nodes with preseving their ids
|
||||
newMesh = CopyMesh( nGroup, "node group copy", toKeepIDs=True)
|
||||
newMesh = smesh.CopyMesh( nGroup, "node group copy", toKeepIDs=True)
|
||||
|
||||
# 4. copy some faces
|
||||
faceIds = fGroup.GetIDs()[-10:]
|
||||
newMesh = CopyMesh( mesh.GetIDSource( faceIds, FACE ), "some faces copy")
|
||||
newMesh = smesh.CopyMesh( mesh.GetIDSource( faceIds, SMESH.FACE ), "some faces copy")
|
||||
|
||||
# 5. copy some nodes
|
||||
nodeIds = nGroup.GetIDs()[-10:]
|
||||
newMesh = CopyMesh( mesh.GetIDSource( nodeIds, NODE), "some nodes copy")
|
||||
newMesh = smesh.CopyMesh( mesh.GetIDSource( nodeIds, SMESH.NODE), "some nodes copy")
|
||||
|
||||
# 6. copy a sub-mesh
|
||||
newMesh = CopyMesh( subMesh, "submesh copy" )
|
||||
newMesh = smesh.CopyMesh( subMesh, "submesh copy" )
|
||||
|
@ -1,7 +1,14 @@
|
||||
# Arithmetic 1D
|
||||
|
||||
import geompy
|
||||
import smesh
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# create a box
|
||||
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
|
||||
|
@ -1,7 +1,14 @@
|
||||
# Deflection 1D and Number of Segments
|
||||
|
||||
import geompy
|
||||
import smesh
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# create a face from arc and straight segment
|
||||
px = geompy.MakeVertex(100., 0. , 0. )
|
||||
|
@ -1,16 +1,23 @@
|
||||
# Start and End Length
|
||||
|
||||
from geompy import *
|
||||
import smesh
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# create a box
|
||||
box = MakeBoxDXDYDZ(10., 10., 10.)
|
||||
addToStudy(box, "Box")
|
||||
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
|
||||
geompy.addToStudy(box, "Box")
|
||||
|
||||
# get one edge of the box to put local hypothesis on
|
||||
p5 = MakeVertex(5., 0., 0.)
|
||||
EdgeX = GetEdgeNearPoint(box, p5)
|
||||
addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
|
||||
p5 = geompy.MakeVertex(5., 0., 0.)
|
||||
EdgeX = geompy.GetEdgeNearPoint(box, p5)
|
||||
geompy.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
|
||||
|
||||
# create a hexahedral mesh on the box
|
||||
hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
|
||||
|
@ -1,16 +1,23 @@
|
||||
# Local Length
|
||||
|
||||
from geompy import *
|
||||
import smesh
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# create a box
|
||||
box = MakeBoxDXDYDZ(10., 10., 10.)
|
||||
addToStudy(box, "Box")
|
||||
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
|
||||
geompy.addToStudy(box, "Box")
|
||||
|
||||
# get one edge of the box to put local hypothesis on
|
||||
p5 = MakeVertex(5., 0., 0.)
|
||||
EdgeX = GetEdgeNearPoint(box, p5)
|
||||
addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
|
||||
p5 = geompy.MakeVertex(5., 0., 0.)
|
||||
EdgeX = geompy.GetEdgeNearPoint(box, p5)
|
||||
geompy.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
|
||||
|
||||
# create a hexahedral mesh on the box
|
||||
hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
|
||||
|
@ -1,8 +1,14 @@
|
||||
# Maximum Element Area
|
||||
|
||||
import geompy
|
||||
import smesh
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# create a face
|
||||
px = geompy.MakeVertex(100., 0. , 0. )
|
||||
|
@ -1,7 +1,14 @@
|
||||
# Maximum Element Volume
|
||||
|
||||
import geompy
|
||||
import smesh
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# create a cylinder
|
||||
cyl = geompy.MakeCylinderRH(30., 50.)
|
||||
|
@ -1,7 +1,14 @@
|
||||
# Length from Edges
|
||||
|
||||
import geompy
|
||||
import smesh
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# create sketchers
|
||||
sketcher1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
|
||||
|
@ -1,16 +1,23 @@
|
||||
# Propagation
|
||||
|
||||
from geompy import *
|
||||
import smesh
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# create a box
|
||||
box = MakeBoxDXDYDZ(10., 10., 10.)
|
||||
addToStudy(box, "Box")
|
||||
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
|
||||
geompy.addToStudy(box, "Box")
|
||||
|
||||
# get one edge of the box to put local hypothesis on
|
||||
p5 = MakeVertex(5., 0., 0.)
|
||||
EdgeX = GetEdgeNearPoint(box, p5)
|
||||
addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
|
||||
p5 = geompy.MakeVertex(5., 0., 0.)
|
||||
EdgeX = geompy.GetEdgeNearPoint(box, p5)
|
||||
geompy.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
|
||||
|
||||
# create a hexahedral mesh on the box
|
||||
hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
|
||||
|
@ -1,7 +1,14 @@
|
||||
# Defining Meshing Algorithms
|
||||
|
||||
import geompy
|
||||
import smesh
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# create a box
|
||||
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
|
||||
|
@ -2,7 +2,15 @@
|
||||
|
||||
# Project prisms from one meshed box to another mesh on the same box
|
||||
|
||||
from smesh import *
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# Prepare geometry
|
||||
|
||||
@ -36,7 +44,7 @@ geompy.addToStudyInFather( box, edgesF2, "edgesF2" )
|
||||
|
||||
|
||||
# Make the source mesh with prisms
|
||||
src_mesh = Mesh(box, "Source mesh")
|
||||
src_mesh = smesh.Mesh(box, "Source mesh")
|
||||
src_mesh.Segment().NumberOfSegments(9,10)
|
||||
src_mesh.Quadrangle()
|
||||
src_mesh.Hexahedron()
|
||||
@ -47,7 +55,7 @@ src_mesh.Compute()
|
||||
# Mesh the box using projection algoritms
|
||||
|
||||
# Define the same global 1D and 2D hypotheses
|
||||
tgt_mesh = Mesh(box, "Target mesh")
|
||||
tgt_mesh = smesh.Mesh(box, "Target mesh")
|
||||
tgt_mesh.Segment().NumberOfSegments(9,10,UseExisting=True)
|
||||
tgt_mesh.Quadrangle()
|
||||
|
||||
@ -73,4 +81,4 @@ proj3D.SourceShape3D( box, src_mesh, v1F1, v1F2, v2F1, v2F2 )
|
||||
tgt_mesh.Compute()
|
||||
|
||||
# Move the source mesh to visualy compare the two meshes
|
||||
src_mesh.TranslateObject( src_mesh, MakeDirStruct( 210, 0, 0 ), Copy=False)
|
||||
src_mesh.TranslateObject( src_mesh, smesh.MakeDirStruct( 210, 0, 0 ), Copy=False)
|
||||
|
@ -2,7 +2,15 @@
|
||||
|
||||
# Project triangles from one meshed face to another mesh on the same box
|
||||
|
||||
from smesh import *
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# Prepare geometry
|
||||
|
||||
@ -20,7 +28,7 @@ geompy.addToStudyInFather( box, Face_1, 'Face_1' )
|
||||
geompy.addToStudyInFather( box, Face_2, 'Face_2' )
|
||||
|
||||
# Make the source mesh with Netgem2D
|
||||
src_mesh = Mesh(Face_1, "Source mesh")
|
||||
src_mesh = smesh.Mesh(Face_1, "Source mesh")
|
||||
src_mesh.Segment().NumberOfSegments(15)
|
||||
src_mesh.Triangle()
|
||||
src_mesh.Compute()
|
||||
|
@ -1,8 +1,14 @@
|
||||
# 1D Mesh with Fixed Points example
|
||||
|
||||
import salome
|
||||
import geompy
|
||||
import smesh
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
import StdMeshers
|
||||
|
||||
# Create face and explode it on edges
|
||||
|
@ -1,8 +1,14 @@
|
||||
# Radial Quadrangle 1D2D example
|
||||
|
||||
from smesh import *
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
SetCurrentStudy(salome.myStudy)
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# Create face from the wire and add to study
|
||||
Face = geompy.MakeSketcher("Sketcher:F 0 0:TT 20 0:R 90:C 20 90:WF", [0, 0, 0, 1, 0, 0, 0, 0, 1])
|
||||
@ -16,7 +22,7 @@ geompy.addToStudyInFather(Face, circle,"circle")
|
||||
|
||||
# Define geometry for mesh, and Radial Quadrange algorithm
|
||||
mesh = smesh.Mesh(Face)
|
||||
radial_Quad_algo = mesh.Quadrangle(algo=RADIAL_QUAD)
|
||||
radial_Quad_algo = mesh.Quadrangle(algo=smeshBuilder.RADIAL_QUAD)
|
||||
|
||||
# The Radial Quadrange algorithm can work without any hypothesis
|
||||
# In this case it uses "Default Nb of Segments" preferences parameter to discretize edges
|
||||
|
@ -1,7 +1,14 @@
|
||||
# Quadrangle Parameters example 1 (meshing a face with 3 edges)
|
||||
|
||||
from smesh import *
|
||||
SetCurrentStudy(salome.myStudy)
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# Get 1/4 part from the disk face.
|
||||
Box_1 = geompy.MakeBoxDXDYDZ(100, 100, 100)
|
||||
|
@ -1,7 +1,14 @@
|
||||
# Quadrangle Parameters example 2 (using different types)
|
||||
|
||||
import geompy
|
||||
import smesh
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
import StdMeshers
|
||||
|
||||
# Make quadrangle face and explode it on edges.
|
||||
|
@ -1,7 +1,14 @@
|
||||
# "Use Existing Elements" example
|
||||
|
||||
from smesh import *
|
||||
SetCurrentStudy(salome.myStudy)
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# Make a patritioned box
|
||||
|
||||
@ -23,15 +30,15 @@ geompy.addToStudyInFather( boxes[1], midFace1, "middle Face")
|
||||
|
||||
# Mesh one of boxes with quadrangles. It is a source mesh
|
||||
|
||||
srcMesh = Mesh(boxes[0], "source mesh") # box coloser to CS origin
|
||||
srcMesh = smesh.Mesh(boxes[0], "source mesh") # box coloser to CS origin
|
||||
nSeg1 = srcMesh.Segment().NumberOfSegments(4)
|
||||
srcMesh.Quadrangle()
|
||||
srcMesh.Compute()
|
||||
srcFaceGroup = srcMesh.GroupOnGeom( midFace0, "src faces", FACE )
|
||||
srcFaceGroup = srcMesh.GroupOnGeom( midFace0, "src faces", SMESH.FACE )
|
||||
|
||||
# Import faces from midFace0 to the target mesh
|
||||
|
||||
tgtMesh = Mesh(boxes[1], "target mesh")
|
||||
tgtMesh = smesh.Mesh(boxes[1], "target mesh")
|
||||
importAlgo = tgtMesh.UseExisting2DElements(midFace1)
|
||||
import2hyp = importAlgo.SourceFaces( [srcFaceGroup] )
|
||||
tgtMesh.Segment().NumberOfSegments(3)
|
||||
|
@ -1,7 +1,14 @@
|
||||
# Viscous layers construction
|
||||
|
||||
from smesh import *
|
||||
SetCurrentStudy(salome.myStudy)
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
X = geompy.MakeVectorDXDYDZ( 1,0,0 )
|
||||
O = geompy.MakeVertex( 100,50,50 )
|
||||
@ -19,7 +26,7 @@ geompy.addToStudy( shape, "shape" )
|
||||
geompy.addToStudyInFather( shape, face1, "face1")
|
||||
|
||||
|
||||
mesh = Mesh(shape, "CFD")
|
||||
mesh = smesh.Mesh(shape, "CFD")
|
||||
|
||||
mesh.Segment().NumberOfSegments( 4 )
|
||||
|
||||
@ -35,6 +42,6 @@ layersHyp = algo3D.ViscousLayers(thickness,numberOfLayers,stretchFactor,ignoreFa
|
||||
|
||||
mesh.Compute()
|
||||
|
||||
mesh.MakeGroup("Tetras",VOLUME,FT_ElemGeomType,"=",Geom_TETRA)
|
||||
mesh.MakeGroup("Pyras",VOLUME,FT_ElemGeomType,"=",Geom_PYRAMID)
|
||||
mesh.MakeGroup("Prims",VOLUME,FT_ElemGeomType,"=",Geom_PENTA)
|
||||
mesh.MakeGroup("Tetras",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_TETRA)
|
||||
mesh.MakeGroup("Pyras",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_PYRAMID)
|
||||
mesh.MakeGroup("Prims",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_PENTA)
|
||||
|
@ -3,6 +3,6 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# get faces with aspect ratio > 6.5
|
||||
filter = smesh.GetFilter(smesh.FACE, smesh.FT_AspectRatio, smesh.FT_MoreThan, 6.5)
|
||||
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, 6.5)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of faces with aspect ratio > 6.5:", len(ids)
|
||||
|
@ -5,6 +5,6 @@ from SMESH_mechanic import *
|
||||
mesh.Tetrahedron()
|
||||
mesh.Compute()
|
||||
# get volumes with aspect ratio < 2.0
|
||||
filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_AspectRatio3D, smesh.FT_LessThan, 2.0)
|
||||
filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_AspectRatio3D, SMESH.FT_LessThan, 2.0)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of volumes with aspect ratio < 2.0:", len(ids)
|
||||
|
@ -3,7 +3,7 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# get faces with warping angle = 2.0e-13 with tolerance 5.0e-14
|
||||
criterion = smesh.GetCriterion(smesh.FACE, smesh.FT_Warping, smesh.FT_EqualTo, 2.0e-13)
|
||||
criterion = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Warping, SMESH.FT_EqualTo, 2.0e-13)
|
||||
criterion.Tolerance = 5.0e-14
|
||||
filter = smesh.CreateFilterManager().CreateFilter()
|
||||
filter.SetCriteria([criterion])
|
||||
|
@ -3,6 +3,6 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# get faces with minimum angle > 75
|
||||
filter = smesh.GetFilter(smesh.FACE, smesh.FT_MinimumAngle,">", 75)
|
||||
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MinimumAngle,">", 75)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of faces with minimum angle > 75:", len(ids)
|
||||
|
@ -3,6 +3,6 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# get faces with taper < 1.e-15
|
||||
filter = smesh.GetFilter(smesh.FACE, smesh.FT_Taper, smesh.FT_LessThan, 1.e-15)
|
||||
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Taper, SMESH.FT_LessThan, 1.e-15)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of faces with taper < 1.e-15:", len(ids)
|
||||
|
@ -3,6 +3,6 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# get faces with skew > 50
|
||||
filter = smesh.GetFilter(smesh.FACE, smesh.FT_Skew, smesh.FT_MoreThan, 50)
|
||||
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Skew, SMESH.FT_MoreThan, 50)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of faces with skew > 50:", len(ids)
|
||||
|
@ -3,9 +3,9 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# get faces with area > 60 and < 90
|
||||
criterion1 = smesh.GetCriterion(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 60,\
|
||||
smesh.FT_Undefined, smesh.FT_LogicalAND)
|
||||
criterion2 = smesh.GetCriterion(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 90)
|
||||
criterion1 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 60,\
|
||||
SMESH.FT_Undefined, SMESH.FT_LogicalAND)
|
||||
criterion2 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 90)
|
||||
filter = smesh.CreateFilterManager().CreateFilter()
|
||||
filter.SetCriteria([criterion1,criterion2])
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
|
@ -5,6 +5,6 @@ from SMESH_mechanic import *
|
||||
mesh.Tetrahedron()
|
||||
mesh.Compute()
|
||||
# get volumes faces with volume > 100
|
||||
filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_Volume3D, smesh.FT_MoreThan, 100)
|
||||
filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_Volume3D, SMESH.FT_MoreThan, 100)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of volumes with volume > 100:", len(ids)
|
||||
|
@ -1,7 +1,17 @@
|
||||
# Free borders
|
||||
|
||||
# create mesh
|
||||
import geompy, smesh, StdMeshers
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
face = geompy.MakeFaceHW(100, 100, 1)
|
||||
geompy.addToStudy( face, "quadrangle" )
|
||||
mesh = smesh.Mesh(face)
|
||||
@ -9,6 +19,6 @@ mesh.Segment().NumberOfSegments(10)
|
||||
mesh.Triangle().MaxElementArea(25)
|
||||
mesh.Compute()
|
||||
# get all free borders
|
||||
filter = smesh.GetFilter(smesh.EDGE, smesh.FT_FreeBorders)
|
||||
filter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_FreeBorders)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of edges on free borders:", len(ids)
|
||||
|
@ -1,7 +1,17 @@
|
||||
# Free edges
|
||||
|
||||
# create mesh
|
||||
import geompy, smesh, StdMeshers
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
face = geompy.MakeFaceHW(100, 100, 1)
|
||||
geompy.addToStudy( face, "quadrangle" )
|
||||
mesh = smesh.Mesh(face)
|
||||
@ -9,6 +19,6 @@ mesh.Segment().NumberOfSegments(10)
|
||||
mesh.Triangle().MaxElementArea(25)
|
||||
mesh.Compute()
|
||||
# get all faces with free edges
|
||||
filter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeEdges)
|
||||
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_FreeEdges)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of faces with free edges:", len(ids)
|
||||
|
@ -5,6 +5,6 @@ from SMESH_mechanic import *
|
||||
# add node
|
||||
mesh.AddNode(0,0,0)
|
||||
# get all free nodes
|
||||
filter = smesh.GetFilter(smesh.NODE, smesh.FT_FreeNodes)
|
||||
filter = smesh.GetFilter(SMESH.NODE, SMESH.FT_FreeNodes)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of free nodes:", len(ids)
|
||||
|
@ -3,6 +3,6 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# get all free faces
|
||||
filter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeFaces)
|
||||
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_FreeFaces)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of free faces:", len(ids)
|
||||
|
@ -3,8 +3,8 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# remove some faces to have faces with bare borders
|
||||
mesh.RemoveElements( mesh.GetElementsByType(smesh.FACE)[0:5] )
|
||||
mesh.RemoveElements( mesh.GetElementsByType(SMESH.FACE)[0:5] )
|
||||
# get all faces bare borders
|
||||
filter = smesh.GetFilter(smesh.FACE, smesh.FT_BareBorderFace)
|
||||
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BareBorderFace)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Faces with bare borders:", ids
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
faceID = mesh.GetElementsByType(smesh.FACE)[0]
|
||||
faceID = mesh.GetElementsByType(SMESH.FACE)[0]
|
||||
# get all faces co-planar to the first face with tolerance 5 degrees
|
||||
filter = smesh.GetFilter(smesh.FACE, smesh.FT_CoplanarFaces,faceID,Tolerance=5.0)
|
||||
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_CoplanarFaces,faceID,Tolerance=5.0)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of faces coplanar with the first one:", len(ids)
|
||||
|
@ -2,6 +2,6 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# get all over-constrained faces
|
||||
filter = smesh.GetFilter(smesh.FACE, smesh.FT_OverConstrainedFace)
|
||||
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_OverConstrainedFace)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Over-constrained faces:", ids
|
||||
|
@ -1,20 +1,31 @@
|
||||
# Double edges, Double faces, Double volumes
|
||||
|
||||
from smesh import *
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
import salome_notebook
|
||||
|
||||
# make a mesh on a box
|
||||
box = geompy.MakeBoxDXDYDZ(100,100,100)
|
||||
mesh = Mesh( box, "Box" )
|
||||
mesh = smesh.Mesh( box, "Box" )
|
||||
mesh.Segment().NumberOfSegments(10)
|
||||
mesh.Quadrangle()
|
||||
mesh.Hexahedron()
|
||||
mesh.Compute()
|
||||
# copy all elements with translation and Merge nodes
|
||||
mesh.TranslateObject( mesh, MakeDirStruct( 10,0,0), Copy=True )
|
||||
mesh.TranslateObject( mesh, smesh.MakeDirStruct( 10,0,0), Copy=True )
|
||||
mesh.MergeNodes( mesh.FindCoincidentNodes(1e-7) )
|
||||
# create filters to find equal elements
|
||||
equalEdgesFilter = GetFilter(SMESH.EDGE, FT_EqualEdges)
|
||||
equalFacesFilter = GetFilter(SMESH.FACE, FT_EqualFaces)
|
||||
equalVolumesFilter = GetFilter(SMESH.VOLUME, FT_EqualVolumes)
|
||||
equalEdgesFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_EqualEdges)
|
||||
equalFacesFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_EqualFaces)
|
||||
equalVolumesFilter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_EqualVolumes)
|
||||
# get equal elements
|
||||
print "Number of equal edges:", len( mesh.GetIdsFromFilter( equalEdgesFilter ))
|
||||
print "Number of equal faces:", len( mesh.GetIdsFromFilter( equalFacesFilter ))
|
||||
|
@ -1,16 +1,27 @@
|
||||
# Double nodes
|
||||
|
||||
from smesh import *
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
import salome_notebook
|
||||
|
||||
# make a mesh on a box
|
||||
box = geompy.MakeBoxDXDYDZ(100,100,100)
|
||||
mesh = Mesh( box, "Box" )
|
||||
mesh = smesh.Mesh( box, "Box" )
|
||||
mesh.Segment().NumberOfSegments(10)
|
||||
mesh.Quadrangle()
|
||||
mesh.Hexahedron()
|
||||
mesh.Compute()
|
||||
# copy all elements with translation
|
||||
mesh.TranslateObject( mesh, MakeDirStruct( 10,0,0), Copy=True )
|
||||
mesh.TranslateObject( mesh, smesh.MakeDirStruct( 10,0,0), Copy=True )
|
||||
# create filters to find nodes equal within tolerance of 1e-5
|
||||
filter = GetFilter(SMESH.NODE, FT_EqualNodes, Tolerance=1e-5)
|
||||
filter = smesh.GetFilter(SMESH.NODE, SMESH.FT_EqualNodes, Tolerance=1e-5)
|
||||
# get equal nodes
|
||||
print "Number of equal nodes:", len( mesh.GetIdsFromFilter( filter ))
|
||||
|
@ -3,6 +3,6 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# get border edges with number of connected faces = 5
|
||||
filter = smesh.GetFilter(smesh.EDGE, smesh.FT_MultiConnection, 5)
|
||||
filter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_MultiConnection, 5)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of border edges with 5 faces connected:", len(ids)
|
||||
|
@ -3,6 +3,6 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# get faces which consist of edges belonging to 2 mesh elements
|
||||
filter = smesh.GetFilter(smesh.FACE, smesh.FT_MultiConnection2D, 2)
|
||||
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MultiConnection2D, 2)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of faces consisting of edges belonging to 2 faces:", len(ids)
|
||||
|
@ -3,6 +3,6 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# get edges with length > 14
|
||||
filter = smesh.GetFilter(smesh.EDGE, smesh.FT_Length, smesh.FT_MoreThan, 14)
|
||||
filter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_Length, SMESH.FT_MoreThan, 14)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of edges with length > 14:", len(ids)
|
||||
|
@ -3,6 +3,6 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# get all faces that have edges with length > 14
|
||||
filter = smesh.GetFilter(smesh.FACE, smesh.FT_Length2D, smesh.FT_MoreThan, 14)
|
||||
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Length2D, SMESH.FT_MoreThan, 14)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of faces with maximum edge length > 14:", len(ids)
|
||||
|
@ -3,6 +3,6 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# get all faces that have elements with length > 10
|
||||
filter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength2D, smesh.FT_MoreThan, 10)
|
||||
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MaxElementLength2D, SMESH.FT_MoreThan, 10)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of faces with maximum element length > 10:", len(ids)
|
||||
|
@ -5,6 +5,6 @@ from SMESH_mechanic import *
|
||||
mesh.Tetrahedron()
|
||||
mesh.Compute()
|
||||
# get all volumes that have elements with length > 10
|
||||
filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_MaxElementLength3D, smesh.FT_MoreThan, 10)
|
||||
filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_MaxElementLength3D, SMESH.FT_MoreThan, 10)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of volumes with maximum element length > 10:", len(ids)
|
||||
|
@ -7,6 +7,6 @@ mesh.Compute()
|
||||
# remove some volumes to have volumes with bare borders
|
||||
mesh.RemoveElements( mesh.GetElementsByType(VOLUME)[0:5] )
|
||||
# get all volumes with bare borders
|
||||
filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_BareBorderVolume)
|
||||
filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_BareBorderVolume)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Volumes with bare borders:", ids
|
||||
|
@ -5,6 +5,6 @@ from SMESH_mechanic import *
|
||||
mesh.Tetrahedron()
|
||||
mesh.Compute()
|
||||
# get all over-constrained volumes
|
||||
filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_OverConstrainedVolume)
|
||||
filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_OverConstrainedVolume)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Over-constrained volumes:", ids
|
||||
|
@ -3,6 +3,6 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# get all faces which nodes lie on the face sub_face3
|
||||
filter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToGeom, sub_face3)
|
||||
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BelongToGeom, sub_face3)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of faces which nodes lie on sub_face3:", len(ids)
|
||||
|
@ -3,6 +3,6 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# get all faces at least one node of each lies on the face sub_face3
|
||||
filter = smesh.GetFilter(smesh.FACE, smesh.FT_LyingOnGeom, sub_face3)
|
||||
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_LyingOnGeom, sub_face3)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of faces at least one node of each lies on sub_face3:", len(ids)
|
||||
|
@ -3,10 +3,9 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# create plane
|
||||
import geompy
|
||||
plane_1 = geompy.MakePlane(p3,seg1,2000)
|
||||
geompy.addToStudy(plane_1, "plane_1")
|
||||
# get all nodes which lie on the plane \a plane_1
|
||||
filter = smesh.GetFilter(smesh.NODE, smesh.FT_BelongToPlane, plane_1)
|
||||
filter = smesh.GetFilter(SMESH.NODE, SMESH.FT_BelongToPlane, plane_1)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of nodes which lie on the plane plane_1:", len(ids)
|
||||
|
@ -3,6 +3,6 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# get all faces which lie on the cylindrical face \a sub_face1
|
||||
filter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToCylinder, sub_face1)
|
||||
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BelongToCylinder, sub_face1)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of faces which lie on the cylindrical surface sub_face1:", len(ids)
|
||||
|
@ -7,6 +7,6 @@ spline_1 = geompy.MakeInterpol([p4,p6,p3,p1])
|
||||
surface_1 = geompy.MakePrismVecH( spline_1, vz, 70.0 )
|
||||
geompy.addToStudy(surface_1, "surface_1")
|
||||
# get all nodes which lie on the surface \a surface_1
|
||||
filter = smesh.GetFilter(smesh.NODE, smesh.FT_BelongToGenSurface, surface_1)
|
||||
filter = smesh.GetFilter(SMESH.NODE, SMESH.FT_BelongToGenSurface, surface_1)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of nodes which lie on the surface surface_1:", len(ids)
|
||||
|
@ -3,9 +3,9 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# get nodes with identifiers [5-10] and [15-30]
|
||||
criterion1 = smesh.GetCriterion(smesh.NODE, smesh.FT_RangeOfIds, Threshold="5-10",\
|
||||
BinaryOp=smesh.FT_LogicalOR)
|
||||
criterion2 = smesh.GetCriterion(smesh.NODE, smesh.FT_RangeOfIds, Threshold="15-30")
|
||||
criterion1 = smesh.GetCriterion(SMESH.NODE, SMESH.FT_RangeOfIds, Threshold="5-10",\
|
||||
BinaryOp=SMESH.FT_LogicalOR)
|
||||
criterion2 = smesh.GetCriterion(SMESH.NODE, SMESH.FT_RangeOfIds, Threshold="15-30")
|
||||
filter = smesh.CreateFilterManager().CreateFilter()
|
||||
filter.SetCriteria([criterion1,criterion2])
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
|
@ -5,6 +5,6 @@ from SMESH_mechanic import *
|
||||
mesh.Tetrahedron()
|
||||
mesh.Compute()
|
||||
# get all badly oriented volumes
|
||||
filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_BadOrientedVolume)
|
||||
filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_BadOrientedVolume)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of badly oriented volumes:", len(ids)
|
||||
|
@ -3,8 +3,8 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# get number of linear and quadratic edges
|
||||
filter_linear = smesh.GetFilter(smesh.EDGE, smesh.FT_LinearOrQuadratic)
|
||||
filter_quadratic = smesh.GetFilter(smesh.EDGE, smesh.FT_LinearOrQuadratic, smesh.FT_LogicalNOT)
|
||||
filter_linear = smesh.GetFilter(SMESH.EDGE, SMESH.FT_LinearOrQuadratic)
|
||||
filter_quadratic = smesh.GetFilter(SMESH.EDGE, SMESH.FT_LinearOrQuadratic, SMESH.FT_LogicalNOT)
|
||||
ids_linear = mesh.GetIdsFromFilter(filter_linear)
|
||||
ids_quadratic = mesh.GetIdsFromFilter(filter_quadratic)
|
||||
print "Number of linear edges:", len(ids_linear), "; number of quadratic edges:", len(ids_quadratic)
|
||||
|
@ -3,12 +3,12 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# create group of edges
|
||||
all_edges = mesh.GetElementsByType(smesh.EDGE)
|
||||
grp = mesh.MakeGroupByIds("edges group", smesh.EDGE, all_edges[:len(all_edges)/4])
|
||||
all_edges = mesh.GetElementsByType(SMESH.EDGE)
|
||||
grp = mesh.MakeGroupByIds("edges group", SMESH.EDGE, all_edges[:len(all_edges)/4])
|
||||
import SALOMEDS
|
||||
c = SALOMEDS.Color(0.1, 0.5, 1.0)
|
||||
grp.SetColor(c)
|
||||
# get number of the edges not belonging to the group with the given color
|
||||
filter = smesh.GetFilter(smesh.EDGE, smesh.FT_GroupColor, c, smesh.FT_LogicalNOT)
|
||||
filter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_GroupColor, c, SMESH.FT_LogicalNOT)
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
print "Number of edges not beloging to the group with color (0.1, 0.5, 1.0):", len(ids)
|
||||
|
@ -5,10 +5,10 @@ from SMESH_mechanic import *
|
||||
mesh.Tetrahedron()
|
||||
mesh.Compute()
|
||||
# get all triangles, quadrangles, tetrahedrons, pyramids
|
||||
filter_tri = smesh.GetFilter(smesh.FACE, smesh.FT_ElemGeomType, smesh.Geom_TRIANGLE)
|
||||
filter_qua = smesh.GetFilter(smesh.FACE, smesh.FT_ElemGeomType, smesh.Geom_QUADRANGLE)
|
||||
filter_tet = smesh.GetFilter(smesh.VOLUME, smesh.FT_ElemGeomType, smesh.Geom_TETRA)
|
||||
filter_pyr = smesh.GetFilter(smesh.VOLUME, smesh.FT_ElemGeomType, smesh.Geom_PYRAMID)
|
||||
filter_tri = smesh.GetFilter(SMESH.FACE, SMESH.FT_ElemGeomType, smesh.Geom_TRIANGLE)
|
||||
filter_qua = smesh.GetFilter(SMESH.FACE, SMESH.FT_ElemGeomType, smesh.Geom_QUADRANGLE)
|
||||
filter_tet = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_ElemGeomType, smesh.Geom_TETRA)
|
||||
filter_pyr = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_ElemGeomType, smesh.Geom_PYRAMID)
|
||||
ids_tri = mesh.GetIdsFromFilter(filter_tri)
|
||||
ids_qua = mesh.GetIdsFromFilter(filter_qua)
|
||||
ids_tet = mesh.GetIdsFromFilter(filter_tet)
|
||||
|
@ -3,11 +3,11 @@
|
||||
# create mesh
|
||||
from SMESH_mechanic import *
|
||||
# get all the quadrangle faces ...
|
||||
criterion1 = smesh.GetCriterion(smesh.FACE, smesh.FT_ElemGeomType, smesh.Geom_QUADRANGLE, smesh.FT_LogicalAND)
|
||||
criterion1 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_ElemGeomType, SMESH.Geom_QUADRANGLE, SMESH.FT_LogicalAND)
|
||||
# ... AND do NOT get those from sub_face3
|
||||
criterion2 = smesh.GetCriterion(smesh.FACE, smesh.FT_BelongToGeom, sub_face3, smesh.FT_LogicalNOT)
|
||||
criterion2 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_BelongToGeom, sub_face3, SMESH.FT_LogicalNOT)
|
||||
filter = smesh.CreateFilterManager().CreateFilter()
|
||||
filter.SetCriteria([criterion1,criterion2])
|
||||
ids = mesh.GetIdsFromFilter(filter)
|
||||
|
||||
myGroup = mesh.MakeGroupByIds("Quads_on_cylindrical_faces",smesh.FACE,ids)
|
||||
myGroup = mesh.MakeGroupByIds("Quads_on_cylindrical_faces",SMESH.FACE,ids)
|
||||
|
@ -3,9 +3,17 @@
|
||||
# This example represents an iron cable (a thin cylinder) in a concrete bloc (a big cylinder).
|
||||
# The big cylinder is defined by two geometric volumes.
|
||||
|
||||
import geompy
|
||||
import smesh
|
||||
import SMESH
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
|
||||
# geometry
|
||||
|
||||
@ -21,22 +29,22 @@ Vertex_3 = geompy.MakeVertex(250, 200, 200)
|
||||
Box_1 = geompy.MakeBoxTwoPnt(Vertex_2, Vertex_3)
|
||||
Fuse_1 = geompy.MakeFuse(Cylinder_1, Cylinder_2)
|
||||
Partition_1 = geompy.MakePartition([Fuse_1], [Cylinder_1, Box_1], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
|
||||
[Solid_1,Solid_2] = geompy.GetShapesOnShape(Cylinder_1, Partition_1, geompy.ShapeType["SOLID"], geompy.GEOM.ST_IN)
|
||||
[Solid_3,Solid_4] = geompy.GetShapesOnShape(Cylinder_2, Partition_1, geompy.ShapeType["SOLID"], geompy.GEOM.ST_IN)
|
||||
[Solid_1,Solid_2] = geompy.GetShapesOnShape(Cylinder_1, Partition_1, geompy.ShapeType["SOLID"], GEOM.ST_IN)
|
||||
[Solid_3,Solid_4] = geompy.GetShapesOnShape(Cylinder_2, Partition_1, geompy.ShapeType["SOLID"], GEOM.ST_IN)
|
||||
Vertex_4 = geompy.MakeVertex(450, 0, 0)
|
||||
Vertex_5 = geompy.MakeVertex(500, 0, 0)
|
||||
Vertex_6 = geompy.MakeVertex(550, 0, 0)
|
||||
vec1 = geompy.MakeVector(Vertex_4, Vertex_5)
|
||||
vec2 = geompy.MakeVector(Vertex_5, Vertex_6)
|
||||
[Face_1] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec1, geompy.GEOM.ST_ON)
|
||||
[Face_2] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec2, geompy.GEOM.ST_ON)
|
||||
[Face_1] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec1, GEOM.ST_ON)
|
||||
[Face_2] = geompy.GetShapesOnPlane(Partition_1, geompy.ShapeType["FACE"], vec2, GEOM.ST_ON)
|
||||
|
||||
# meshing (we have linear tetrahedrons here, but other elements are OK)
|
||||
|
||||
Mesh_1 = smesh.Mesh(Partition_1)
|
||||
Regular_1D = Mesh_1.Segment()
|
||||
Nb_Segments_1 = Regular_1D.NumberOfSegments(15)
|
||||
MEFISTO_2D = Mesh_1.Triangle(algo=smesh.MEFISTO)
|
||||
MEFISTO_2D = Mesh_1.Triangle(algo=smeshBuilder.MEFISTO)
|
||||
Length_From_Edges_2D = MEFISTO_2D.LengthFromEdges()
|
||||
ALGO3D = Mesh_1.Tetrahedron()
|
||||
isDone = Mesh_1.Compute()
|
||||
|
@ -1,21 +1,22 @@
|
||||
# Create a Standalone Group
|
||||
|
||||
import SMESH_mechanic
|
||||
import SMESH
|
||||
|
||||
smesh = SMESH_mechanic.smesh
|
||||
mesh = SMESH_mechanic.mesh
|
||||
salome = SMESH_mechanic.salome
|
||||
|
||||
# Get ids of all faces with area > 100
|
||||
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 100.)
|
||||
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 100.)
|
||||
|
||||
anIds = mesh.GetIdsFromFilter(aFilter)
|
||||
|
||||
# create a group consisting of faces with area > 100
|
||||
aGroup1 = mesh.MakeGroupByIds("Area > 100", smesh.FACE, anIds)
|
||||
aGroup1 = mesh.MakeGroupByIds("Area > 100", SMESH.FACE, anIds)
|
||||
|
||||
# create a group that contains all nodes from the mesh
|
||||
aGroup2 = mesh.CreateEmptyGroup(smesh.NODE, "all nodes")
|
||||
aGroup2 = mesh.CreateEmptyGroup(SMESH.NODE, "all nodes")
|
||||
aGroup2.AddFrom(mesh.mesh)
|
||||
|
||||
salome.sg.updateObjBrowser(1)
|
||||
|
@ -1,8 +1,15 @@
|
||||
# Create a Group on Geometry
|
||||
|
||||
|
||||
import salome
|
||||
import geompy
|
||||
import smesh
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# create a box
|
||||
box = geompy.MakeBox(0., 0., 0., 100., 100., 100.)
|
||||
|
@ -1,23 +1,33 @@
|
||||
# Create a Group on Filter
|
||||
|
||||
from smesh import *
|
||||
SetCurrentStudy(salome.myStudy)
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
import salome_notebook
|
||||
|
||||
|
||||
box = geompy.MakeBoxDXDYDZ(10,10,10)
|
||||
|
||||
# make a mesh with quadrangles of different area in range [1,16]
|
||||
mesh = Mesh(box,"Quad mesh")
|
||||
mesh = smesh.Mesh(box,"Quad mesh")
|
||||
hyp1D = mesh.Segment().StartEndLength( 1, 4 )
|
||||
mesh.Quadrangle()
|
||||
mesh.Compute()
|
||||
|
||||
# create a group on filter selecting faces of medium size
|
||||
critaria = [ \
|
||||
GetCriterion(FACE, FT_Area, ">", 1.1, BinaryOp=FT_LogicalAND ),
|
||||
GetCriterion(FACE, FT_Area, "<", 15.0 )
|
||||
smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, ">", 1.1, BinaryOp=SMESH.FT_LogicalAND ),
|
||||
smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, "<", 15.0 )
|
||||
]
|
||||
filt = GetFilterFromCriteria( critaria )
|
||||
filtGroup = mesh.GroupOnFilter( FACE, "group on filter", filt )
|
||||
filt = smesh.GetFilterFromCriteria( critaria )
|
||||
filtGroup = mesh.GroupOnFilter( SMESH.FACE, "group on filter", filt )
|
||||
print "Group on filter contains %s elemens" % filtGroup.Size()
|
||||
|
||||
# group on filter is updated if the mesh is modified
|
||||
@ -27,12 +37,12 @@ mesh.Compute()
|
||||
print "After mesh change, group on filter contains %s elemens" % filtGroup.Size()
|
||||
|
||||
# set a new filter defining the group
|
||||
filt2 = GetFilter( FACE, FT_RangeOfIds, "1-50" )
|
||||
filt2 = smesh.GetFilter( SMESH.FACE, SMESH.FT_RangeOfIds, "1-50" )
|
||||
filtGroup.SetFilter( filt2 )
|
||||
print "With a new filter, group on filter contains %s elemens" % filtGroup.Size()
|
||||
|
||||
# group is updated at modification of the filter
|
||||
filt2.SetCriteria( [ GetCriterion( FACE, FT_RangeOfIds, "1-70" )])
|
||||
filt2.SetCriteria( [ smesh.GetCriterion( SMESH.FACE, SMESH.FT_RangeOfIds, "1-70" )])
|
||||
filtIDs3 = filtGroup.GetIDs()
|
||||
print "After filter modification, group on filter contains %s elemens" % filtGroup.Size()
|
||||
|
||||
|
@ -1,24 +1,25 @@
|
||||
# Edit a Group
|
||||
|
||||
import SMESH_mechanic
|
||||
import SMESH
|
||||
|
||||
smesh = SMESH_mechanic.smesh
|
||||
mesh = SMESH_mechanic.mesh
|
||||
salome = SMESH_mechanic.salome
|
||||
|
||||
# Get ids of all faces with area > 35
|
||||
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 35.)
|
||||
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 35.)
|
||||
|
||||
anIds = mesh.GetIdsFromFilter(aFilter)
|
||||
|
||||
print "Criterion: Area > 35, Nb = ", len(anIds)
|
||||
|
||||
# create a group by adding elements with area > 35
|
||||
aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Area > 35")
|
||||
aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 35")
|
||||
aGroup.Add(anIds)
|
||||
|
||||
# Get ids of all faces with area > 40
|
||||
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 40.)
|
||||
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 40.)
|
||||
|
||||
anIds = mesh.GetIdsFromFilter(aFilter)
|
||||
|
||||
|
@ -1,31 +1,32 @@
|
||||
# Union of groups
|
||||
|
||||
import SMESH_mechanic
|
||||
import SMESH
|
||||
|
||||
smesh = SMESH_mechanic.smesh
|
||||
mesh = SMESH_mechanic.mesh
|
||||
salome = SMESH_mechanic.salome
|
||||
|
||||
# Criterion : AREA > 20
|
||||
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.)
|
||||
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 20.)
|
||||
|
||||
anIds = mesh.GetIdsFromFilter(aFilter)
|
||||
|
||||
print "Criterion: Area > 20, Nb = ", len( anIds )
|
||||
|
||||
# create a group by adding elements with area > 20
|
||||
aGroup1 = mesh.CreateEmptyGroup(smesh.FACE, "Area > 20")
|
||||
aGroup1 = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 20")
|
||||
aGroup1.Add(anIds)
|
||||
|
||||
# Criterion : AREA = 20
|
||||
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_EqualTo, 20.)
|
||||
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_EqualTo, 20.)
|
||||
|
||||
anIds = mesh.GetIdsFromFilter(aFilter)
|
||||
|
||||
print "Criterion: Area = 20, Nb = ", len( anIds )
|
||||
|
||||
# create a group by adding elements with area = 20
|
||||
aGroup2 = mesh.CreateEmptyGroup( smesh.FACE, "Area = 20" )
|
||||
aGroup2 = mesh.CreateEmptyGroup( SMESH.FACE, "Area = 20" )
|
||||
|
||||
aGroup2.Add(anIds)
|
||||
|
||||
@ -35,14 +36,14 @@ print "Criterion: Area >= 20, Nb = ", len(aGroup3.GetListOfID())
|
||||
# Please note that also there is UnionGroups() method which works with two groups only
|
||||
|
||||
# Criterion : AREA < 20
|
||||
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 20.)
|
||||
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 20.)
|
||||
|
||||
anIds = mesh.GetIdsFromFilter(aFilter)
|
||||
|
||||
print "Criterion: Area < 20, Nb = ", len(anIds)
|
||||
|
||||
# create a group by adding elements with area < 20
|
||||
aGroup4 = mesh.CreateEmptyGroup(smesh.FACE, "Area < 20")
|
||||
aGroup4 = mesh.CreateEmptyGroup(SMESH.FACE, "Area < 20")
|
||||
aGroup4.Add(anIds)
|
||||
|
||||
# create union group : area >= 20 and area < 20
|
||||
|
@ -1,31 +1,32 @@
|
||||
# Intersection of groups
|
||||
|
||||
import SMESH_mechanic
|
||||
import SMESH
|
||||
|
||||
smesh = SMESH_mechanic.smesh
|
||||
mesh = SMESH_mechanic.mesh
|
||||
salome = SMESH_mechanic.salome
|
||||
|
||||
# Criterion : AREA > 20
|
||||
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.)
|
||||
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 20.)
|
||||
|
||||
anIds = mesh.GetIdsFromFilter(aFilter)
|
||||
|
||||
print "Criterion: Area > 20, Nb = ", len(anIds)
|
||||
|
||||
# create a group by adding elements with area > 20
|
||||
aGroup1 = mesh.CreateEmptyGroup(smesh.FACE, "Area > 20")
|
||||
aGroup1 = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 20")
|
||||
aGroup1.Add(anIds)
|
||||
|
||||
# Criterion : AREA < 60
|
||||
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 60.)
|
||||
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 60.)
|
||||
|
||||
anIds = mesh.GetIdsFromFilter(aFilter)
|
||||
|
||||
print "Criterion: Area < 60, Nb = ", len(anIds)
|
||||
|
||||
# create a group by adding elements with area < 60
|
||||
aGroup2 = mesh.CreateEmptyGroup(smesh.FACE, "Area < 60")
|
||||
aGroup2 = mesh.CreateEmptyGroup(SMESH.FACE, "Area < 60")
|
||||
aGroup2.Add(anIds)
|
||||
|
||||
# create an intersection of groups : 20 < area < 60
|
||||
|
@ -1,30 +1,31 @@
|
||||
# Cut of groups
|
||||
|
||||
import SMESH_mechanic
|
||||
import SMESH
|
||||
|
||||
smesh = SMESH_mechanic.smesh
|
||||
mesh = SMESH_mechanic.mesh
|
||||
salome = SMESH_mechanic.salome
|
||||
|
||||
# Criterion : AREA > 20
|
||||
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 20.)
|
||||
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 20.)
|
||||
|
||||
anIds = mesh.GetIdsFromFilter(aFilter)
|
||||
|
||||
print "Criterion: Area > 20, Nb = ", len(anIds)
|
||||
|
||||
# create a group by adding elements with area > 20
|
||||
aGroupMain = mesh.MakeGroupByIds("Area > 20", smesh.FACE, anIds)
|
||||
aGroupMain = mesh.MakeGroupByIds("Area > 20", SMESH.FACE, anIds)
|
||||
|
||||
# Criterion : AREA < 60
|
||||
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 60.)
|
||||
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 60.)
|
||||
|
||||
anIds = mesh.GetIdsFromFilter(aFilter)
|
||||
|
||||
print "Criterion: Area < 60, Nb = ", len(anIds)
|
||||
|
||||
# create a group by adding elements with area < 60
|
||||
aGroupTool = mesh.MakeGroupByIds("Area < 60", smesh.FACE, anIds)
|
||||
aGroupTool = mesh.MakeGroupByIds("Area < 60", SMESH.FACE, anIds)
|
||||
|
||||
# create a cut of groups : area >= 60
|
||||
aGroupRes = mesh.CutGroups(aGroupMain, aGroupTool, "Area >= 60")
|
||||
|
@ -1,35 +1,36 @@
|
||||
# Creating groups of entities from existing groups of superior dimensions
|
||||
|
||||
import SMESH_mechanic
|
||||
import SMESH
|
||||
|
||||
smesh = SMESH_mechanic.smesh
|
||||
mesh = SMESH_mechanic.mesh
|
||||
salome = SMESH_mechanic.salome
|
||||
|
||||
# Criterion : AREA > 100
|
||||
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 100.)
|
||||
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 100.)
|
||||
|
||||
anIds = mesh.GetIdsFromFilter(aFilter)
|
||||
|
||||
print "Criterion: Area > 100, Nb = ", len(anIds)
|
||||
|
||||
# create a group by adding elements with area > 100
|
||||
aSrcGroup1 = mesh.MakeGroupByIds("Area > 100", smesh.FACE, anIds)
|
||||
aSrcGroup1 = mesh.MakeGroupByIds("Area > 100", SMESH.FACE, anIds)
|
||||
|
||||
# Criterion : AREA < 30
|
||||
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, 30.)
|
||||
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 30.)
|
||||
|
||||
anIds = mesh.GetIdsFromFilter(aFilter)
|
||||
|
||||
print "Criterion: Area < 30, Nb = ", len(anIds)
|
||||
|
||||
# create a group by adding elements with area < 30
|
||||
aSrcGroup2 = mesh.MakeGroupByIds("Area < 30", smesh.FACE, anIds)
|
||||
aSrcGroup2 = mesh.MakeGroupByIds("Area < 30", SMESH.FACE, anIds)
|
||||
|
||||
# Create group of edges using source groups of faces
|
||||
aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], smesh.EDGE, "Edges" )
|
||||
aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], SMESH.EDGE, "Edges" )
|
||||
|
||||
# Create group of nodes using source groups of faces
|
||||
aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], smesh.NODE, "Nodes" )
|
||||
aGrp = mesh.CreateDimGroup( [aSrcGroup1, aSrcGroup2], SMESH.NODE, "Nodes" )
|
||||
|
||||
salome.sg.updateObjBrowser(1)
|
||||
|
@ -1,6 +1,16 @@
|
||||
# Minimum Distance
|
||||
|
||||
import smesh
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
import salome_notebook
|
||||
|
||||
from SMESH_mechanic import mesh as mesh1
|
||||
from SMESH_test1 import mesh as mesh2
|
||||
|
||||
|
@ -1,6 +1,17 @@
|
||||
# Bounding Box
|
||||
|
||||
import smesh
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
import salome_notebook
|
||||
|
||||
from SMESH_mechanic import mesh as mesh1
|
||||
from SMESH_test1 import mesh as mesh2
|
||||
|
||||
|
@ -1,6 +1,17 @@
|
||||
# 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()
|
||||
|
||||
|
@ -1,6 +1,17 @@
|
||||
# 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()
|
||||
|
||||
|
@ -1,6 +1,17 @@
|
||||
# Add 0D Element on Element Nodes
|
||||
|
||||
import smesh, SMESH, geompy
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
import salome_notebook
|
||||
|
||||
|
||||
# create a geometry
|
||||
box = geompy.MakeBoxDXDYDZ( 10, 10, 10 )
|
||||
|
@ -1,9 +1,18 @@
|
||||
# Add Polygon
|
||||
|
||||
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
|
||||
mesh = smesh.Mesh()
|
||||
|
@ -1,7 +1,17 @@
|
||||
# Add Polyhedron
|
||||
|
||||
|
||||
import salome
|
||||
import smesh
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
import salome_notebook
|
||||
|
||||
import math
|
||||
|
||||
# create an empty mesh structure
|
||||
|
@ -1,18 +1,28 @@
|
||||
# Moving Nodes
|
||||
|
||||
from geompy import *
|
||||
from smesh import *
|
||||
|
||||
box = MakeBoxDXDYDZ(200, 200, 200)
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
mesh = Mesh( box )
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
import salome_notebook
|
||||
|
||||
|
||||
box = geompy.MakeBoxDXDYDZ(200, 200, 200)
|
||||
|
||||
mesh = smesh.Mesh( box )
|
||||
mesh.Segment().AutomaticLength(0.1)
|
||||
mesh.Quadrangle()
|
||||
mesh.Compute()
|
||||
|
||||
# find node at (0,0,0)
|
||||
node000 = None
|
||||
for vId in SubShapeAllIDs( box, ShapeType["VERTEX"]):
|
||||
for vId in geompy.SubShapeAllIDs( box, geompy.ShapeType["VERTEX"]):
|
||||
if node000: break
|
||||
nodeIds = mesh.GetSubMeshNodesId( vId, True )
|
||||
for node in nodeIds:
|
||||
|
@ -1,7 +1,17 @@
|
||||
# Diagonal Inversion
|
||||
|
||||
|
||||
import salome
|
||||
import smesh
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
import salome_notebook
|
||||
|
||||
|
||||
# create an empty mesh structure
|
||||
mesh = smesh.Mesh()
|
||||
|
@ -1,7 +1,17 @@
|
||||
# Uniting two Triangles
|
||||
|
||||
|
||||
import salome
|
||||
import smesh
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
import salome_notebook
|
||||
|
||||
|
||||
# create an empty mesh structure
|
||||
mesh = smesh.Mesh()
|
||||
|
@ -1,7 +1,17 @@
|
||||
# Uniting a Set of Triangles
|
||||
|
||||
|
||||
import salome
|
||||
import smesh
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
import salome_notebook
|
||||
|
||||
|
||||
# create an empty mesh structure
|
||||
mesh = smesh.Mesh()
|
||||
@ -37,7 +47,7 @@ ff[5] = mesh.AddFace([bb[2], tt[3], tt[2]])
|
||||
|
||||
# unite a set of triangles
|
||||
print "\nUnite a set of triangles ... ",
|
||||
res = mesh.TriToQuad([ff[2], ff[3], ff[4], ff[5]], smesh.FT_MinimumAngle, 60.)
|
||||
res = mesh.TriToQuad([ff[2], ff[3], ff[4], ff[5]], SMESH.FT_MinimumAngle, 60.)
|
||||
if not res: print "failed!"
|
||||
else: print "done."
|
||||
|
||||
|
@ -1,7 +1,17 @@
|
||||
# Orientation
|
||||
|
||||
|
||||
import salome
|
||||
import smesh
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
import salome_notebook
|
||||
|
||||
|
||||
# create an empty mesh structure
|
||||
mesh = smesh.Mesh()
|
||||
|
@ -1,9 +1,10 @@
|
||||
# Cutting Quadrangles
|
||||
|
||||
import SMESH_mechanic
|
||||
import SMESH
|
||||
|
||||
smesh = SMESH_mechanic.smesh
|
||||
mesh = SMESH_mechanic.mesh
|
||||
|
||||
# cut two quadrangles: 405 and 406
|
||||
mesh.QuadToTri([405, 406], smesh.FT_MinimumAngle)
|
||||
mesh.QuadToTri([405, 406], SMESH.FT_MinimumAngle)
|
||||
|
@ -1,11 +1,19 @@
|
||||
# Smoothing
|
||||
|
||||
|
||||
import salome
|
||||
import geompy
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH_mechanic
|
||||
|
||||
smesh = SMESH_mechanic.smesh
|
||||
#smesh = SMESH_mechanic.smesh
|
||||
mesh = SMESH_mechanic.mesh
|
||||
|
||||
# select the top face
|
||||
@ -14,7 +22,7 @@ face = faces[3]
|
||||
geompy.addToStudyInFather(SMESH_mechanic.shape_mesh, face, "face planar with hole")
|
||||
|
||||
# create a group of faces to be smoothed
|
||||
GroupSmooth = mesh.GroupOnGeom(face, "Group of faces (smooth)", smesh.FACE)
|
||||
GroupSmooth = mesh.GroupOnGeom(face, "Group of faces (smooth)", SMESH.FACE)
|
||||
|
||||
# perform smoothing
|
||||
|
||||
|
@ -1,11 +1,19 @@
|
||||
# Extrusion
|
||||
|
||||
|
||||
import salome
|
||||
import geompy
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH_mechanic
|
||||
|
||||
smesh = SMESH_mechanic.smesh
|
||||
#smesh = SMESH_mechanic.smesh
|
||||
mesh = SMESH_mechanic.mesh
|
||||
|
||||
# select the top face
|
||||
@ -14,11 +22,11 @@ face = faces[7]
|
||||
geompy.addToStudyInFather(SMESH_mechanic.shape_mesh, face, "face circular top")
|
||||
|
||||
# create a vector for extrusion
|
||||
point = smesh.PointStruct(0., 0., 5.)
|
||||
vector = smesh.DirStruct(point)
|
||||
point = SMESH.PointStruct(0., 0., 5.)
|
||||
vector = SMESH.DirStruct(point)
|
||||
|
||||
# create a group to be extruded
|
||||
GroupTri = mesh.GroupOnGeom(face, "Group of faces (extrusion)", smesh.FACE)
|
||||
GroupTri = mesh.GroupOnGeom(face, "Group of faces (extrusion)", SMESH.FACE)
|
||||
|
||||
# perform extrusion of the group
|
||||
mesh.ExtrusionSweepObject(GroupTri, vector, 5)
|
||||
|
@ -1,10 +1,16 @@
|
||||
# Extrusion along a Path
|
||||
|
||||
import math
|
||||
import salome
|
||||
|
||||
# Geometry
|
||||
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)
|
||||
|
||||
# 1. Create points
|
||||
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
|
||||
|
||||
# Mesh
|
||||
import smesh
|
||||
|
||||
# Mesh the given shape with the given 1d hypothesis
|
||||
def Mesh1D(shape1d, nbSeg, name):
|
||||
@ -91,7 +96,7 @@ Edge_Circle_mesh = Mesh1D(Edge_Circle , 8, "Edge_Circle")
|
||||
# ExtrusionAlongPath
|
||||
# IDsOfElements, PathMesh, PathShape, NodeStart,
|
||||
# HasAngles, Angles, HasRefPoint, RefPoint
|
||||
refPoint = smesh.PointStruct(0, 0, 0)
|
||||
refPoint = SMESH.PointStruct(0, 0, 0)
|
||||
a10 = 10.0*math.pi/180.0
|
||||
a45 = 45.0*math.pi/180.0
|
||||
|
||||
|
@ -1,7 +1,15 @@
|
||||
# Pattern Mapping
|
||||
|
||||
import geompy
|
||||
import smesh
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# define the geometry
|
||||
Box_1 = geompy.MakeBoxDXDYDZ(200., 200., 200.)
|
||||
@ -41,7 +49,7 @@ isDone = pattern.LoadFromFace(Mesh_2.GetMesh(), Face_2, 0)
|
||||
if (isDone != 1): print 'LoadFromFace :', pattern.GetErrorCode()
|
||||
|
||||
# apply the pattern to a face of the first mesh
|
||||
facesToSplit = Mesh_1.GetElementsByType(smesh.SMESH.FACE)
|
||||
facesToSplit = Mesh_1.GetElementsByType(SMESH.FACE)
|
||||
print "Splitting %d rectangular face(s) to %d triangles..."%(len(facesToSplit), 2*len(facesToSplit))
|
||||
pattern.ApplyToMeshFaces(Mesh_1.GetMesh(), facesToSplit, 0, 0)
|
||||
isDone = pattern.MakeMesh(Mesh_1.GetMesh(), 0, 0)
|
||||
@ -84,7 +92,7 @@ smp_hexa = """!!! Nb of points:
|
||||
pattern_hexa.LoadFromFile(smp_hexa)
|
||||
|
||||
# apply the pattern to a mesh
|
||||
volsToSplit = Mesh_3.GetElementsByType(smesh.SMESH.VOLUME)
|
||||
volsToSplit = Mesh_3.GetElementsByType(SMESH.VOLUME)
|
||||
print "Splitting %d hexa volume(s) to %d hexas..."%(len(volsToSplit), 4*len(volsToSplit))
|
||||
pattern_hexa.ApplyToHexahedrons(Mesh_3.GetMesh(), volsToSplit,0,3)
|
||||
isDone = pattern_hexa.MakeMesh(Mesh_3.GetMesh(), True, True)
|
||||
@ -123,7 +131,7 @@ smp_pyra = """!!! Nb of points:
|
||||
pattern_pyra.LoadFromFile(smp_pyra)
|
||||
|
||||
# apply the pattern to a face mesh
|
||||
volsToSplit = Mesh_4.GetElementsByType(smesh.SMESH.VOLUME)
|
||||
volsToSplit = Mesh_4.GetElementsByType(SMESH.VOLUME)
|
||||
print "Splitting %d hexa volume(s) to %d hexas..."%(len(volsToSplit), 6*len(volsToSplit))
|
||||
pattern_pyra.ApplyToHexahedrons(Mesh_4.GetMesh(), volsToSplit,1,0)
|
||||
isDone = pattern_pyra.MakeMesh(Mesh_4.GetMesh(), True, True)
|
||||
|
@ -1,7 +1,15 @@
|
||||
# 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
|
||||
|
||||
|
@ -1,7 +1,15 @@
|
||||
# Using SALOME NoteBook
|
||||
|
||||
import geompy
|
||||
import smesh
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
import salome_notebook
|
||||
|
||||
# set variables
|
||||
@ -34,6 +42,6 @@ algo3D.MaxElementVolume("MaxElementVolume")
|
||||
ret = tetra.Compute()
|
||||
|
||||
# translate the mesh
|
||||
point = smesh.PointStruct("Offset", 0., 0.)
|
||||
vector = smesh.DirStruct(point)
|
||||
point = SMESH.PointStruct("Offset", 0., 0.)
|
||||
vector = SMESH.DirStruct(point)
|
||||
tetra.TranslateObject(tetra, vector, 0)
|
||||
|
@ -1,9 +1,15 @@
|
||||
# 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
|
||||
box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
|
||||
@ -21,7 +27,7 @@ algo.MaxElementArea(20.)
|
||||
mesh.Compute()
|
||||
|
||||
# criterion : free borders
|
||||
aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_FreeBorders)
|
||||
aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_FreeBorders)
|
||||
anIds = mesh.GetIdsFromFilter(aFilter)
|
||||
|
||||
# print the result
|
||||
@ -35,7 +41,7 @@ for i in range(len(anIds)):
|
||||
print ""
|
||||
|
||||
# create a group
|
||||
aGroup = mesh.GetMesh().CreateGroup(smesh.EDGE, "Free borders")
|
||||
aGroup = mesh.GetMesh().CreateGroup(SMESH.EDGE, "Free borders")
|
||||
aGroup.Add(anIds)
|
||||
|
||||
salome.sg.updateObjBrowser(1)
|
||||
|
@ -1,10 +1,15 @@
|
||||
# Borders at Multiconnection
|
||||
|
||||
import salome
|
||||
import geompy
|
||||
|
||||
import smesh
|
||||
import SMESH
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# create open shell: a box without one plane
|
||||
box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
|
||||
@ -24,7 +29,7 @@ mesh.Compute()
|
||||
# Criterion : Borders at multi-connection
|
||||
nb_conn = 2
|
||||
|
||||
aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_MultiConnection, smesh.FT_EqualTo, nb_conn)
|
||||
aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_MultiConnection, SMESH.FT_EqualTo, nb_conn)
|
||||
anIds = mesh.GetIdsFromFilter(aFilter)
|
||||
|
||||
# print the result
|
||||
@ -38,7 +43,7 @@ for i in range(len(anIds)):
|
||||
print ""
|
||||
|
||||
# create a group
|
||||
aGroup = mesh.GetMesh().CreateGroup(smesh.EDGE, "Borders at multi-connections")
|
||||
aGroup = mesh.GetMesh().CreateGroup(SMESH.EDGE, "Borders at multi-connections")
|
||||
aGroup.Add(anIds)
|
||||
|
||||
salome.sg.updateObjBrowser(1)
|
||||
|
@ -1,9 +1,15 @@
|
||||
# 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
|
||||
box = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
|
||||
@ -23,7 +29,7 @@ mesh.Compute()
|
||||
# Criterion : Length > 3.
|
||||
length_margin = 3.
|
||||
|
||||
aFilter = smesh.GetFilter(smesh.EDGE, smesh.FT_Length, smesh.FT_MoreThan, length_margin)
|
||||
aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_Length, SMESH.FT_MoreThan, length_margin)
|
||||
anIds = mesh.GetIdsFromFilter(aFilter)
|
||||
|
||||
# print the result
|
||||
@ -37,7 +43,7 @@ for i in range(len(anIds)):
|
||||
print ""
|
||||
|
||||
# create a group
|
||||
aGroup = mesh.GetMesh().CreateGroup(smesh.EDGE, "Edges with length > " + `length_margin`)
|
||||
aGroup = mesh.GetMesh().CreateGroup(SMESH.EDGE, "Edges with length > " + `length_margin`)
|
||||
aGroup.Add(anIds)
|
||||
|
||||
salome.sg.updateObjBrowser(1)
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Free Edges
|
||||
|
||||
import SMESH_mechanic
|
||||
import SMESH
|
||||
|
||||
smesh = SMESH_mechanic.smesh
|
||||
mesh = SMESH_mechanic.mesh
|
||||
@ -12,7 +13,7 @@ aFilterMgr = smesh.CreateFilterManager()
|
||||
# Criterion : AREA > 95.
|
||||
area_margin = 95.
|
||||
|
||||
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, area_margin)
|
||||
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, area_margin)
|
||||
|
||||
anIds = mesh.GetIdsFromFilter(aFilter)
|
||||
|
||||
@ -22,8 +23,8 @@ mesh.RemoveElements(anIds)
|
||||
aBorders = mesh.GetFreeBorders()
|
||||
|
||||
# create groups
|
||||
aGroupF = mesh.CreateEmptyGroup(smesh.FACE, "Faces with free edges")
|
||||
aGroupN = mesh.CreateEmptyGroup(smesh.NODE, "Nodes on free edges")
|
||||
aGroupF = mesh.CreateEmptyGroup(SMESH.FACE, "Faces with free edges")
|
||||
aGroupN = mesh.CreateEmptyGroup(SMESH.NODE, "Nodes on free edges")
|
||||
|
||||
# fill groups with elements, corresponding to the criterion
|
||||
print ""
|
||||
|
@ -1,9 +1,15 @@
|
||||
# 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
|
||||
box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
|
||||
@ -13,7 +19,7 @@ idbox = geompy.addToStudy(box, "box")
|
||||
mesh = smesh.Mesh(box, "Mesh_free_nodes")
|
||||
algo = mesh.Segment()
|
||||
algo.NumberOfSegments(10)
|
||||
algo = mesh.Triangle(smesh.MEFISTO)
|
||||
algo = mesh.Triangle(smeshBuilder.MEFISTO)
|
||||
algo.MaxElementArea(150.)
|
||||
mesh.Compute()
|
||||
|
||||
@ -21,18 +27,18 @@ mesh.Compute()
|
||||
# Criterion : AREA < 80.
|
||||
area_margin = 80.
|
||||
|
||||
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_LessThan, area_margin)
|
||||
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, area_margin)
|
||||
|
||||
anIds = mesh.GetIdsFromFilter(aFilter)
|
||||
|
||||
mesh.RemoveElements(anIds)
|
||||
|
||||
# criterion : free nodes
|
||||
aFilter = smesh.GetFilter(smesh.NODE, smesh.FT_FreeNodes)
|
||||
aFilter = smesh.GetFilter(SMESH.NODE, SMESH.FT_FreeNodes)
|
||||
anNodeIds = mesh.GetIdsFromFilter(aFilter)
|
||||
|
||||
# create a group
|
||||
aGroup = mesh.CreateEmptyGroup(smesh.NODE, "Free_nodes")
|
||||
aGroup = mesh.CreateEmptyGroup(SMESH.NODE, "Free_nodes")
|
||||
aGroup.Add(anNodeIds)
|
||||
|
||||
# print the result
|
||||
|
@ -1,7 +1,15 @@
|
||||
# Free Faces
|
||||
|
||||
|
||||
import salome
|
||||
import geompy
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
####### GEOM part ########
|
||||
|
||||
@ -30,9 +38,6 @@ geompy.addToStudyInFather( Box_1, Box_1_vertex_21, "Box_1:vertex_21" )
|
||||
geompy.addToStudy( Plane_2, "Plane_2" )
|
||||
|
||||
###### SMESH part ######
|
||||
import smesh
|
||||
|
||||
import StdMeshers
|
||||
|
||||
Mesh_1 = smesh.Mesh(Partition_1)
|
||||
Regular_1D = Mesh_1.Segment()
|
||||
@ -42,10 +47,10 @@ Tetrahedronn = Mesh_1.Tetrahedron()
|
||||
isDone = Mesh_1.Compute()
|
||||
|
||||
# create a group of free faces
|
||||
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeFaces )
|
||||
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_FreeFaces )
|
||||
aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
|
||||
|
||||
aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Free_faces")
|
||||
aGroup = Mesh_1.CreateEmptyGroup(SMESH.FACE, "Free_faces")
|
||||
aGroup.Add(aFaceIds)
|
||||
|
||||
# print the result
|
||||
@ -59,15 +64,15 @@ for i in range(len(aFaceIds)):
|
||||
print ""
|
||||
|
||||
#filter faces from plane 2
|
||||
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToPlane, Plane_2)
|
||||
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BelongToPlane, Plane_2)
|
||||
aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
|
||||
aGroup.Remove(aFaceIds)
|
||||
|
||||
# create a group of shared faces (located on partition boundary inside box)
|
||||
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_BelongToPlane, Plane_1)
|
||||
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BelongToPlane, Plane_1)
|
||||
aFaceIds = Mesh_1.GetIdsFromFilter(aFilter)
|
||||
|
||||
aGroup = Mesh_1.CreateEmptyGroup(smesh.FACE, "Shared_faces")
|
||||
aGroup = Mesh_1.CreateEmptyGroup(SMESH.FACE, "Shared_faces")
|
||||
aGroup.Add(aFaceIds)
|
||||
|
||||
salome.sg.updateObjBrowser(1)
|
||||
|
@ -1,7 +1,17 @@
|
||||
# Bare border faces
|
||||
|
||||
from smesh import *
|
||||
SetCurrentStudy(salome.myStudy)
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
import salome_notebook
|
||||
|
||||
|
||||
box = geompy.MakeBoxDXDYDZ(100, 100, 100)
|
||||
geompy.addToStudy( box, "box" )
|
||||
@ -12,8 +22,8 @@ mesh.Quadrangle()
|
||||
mesh.Compute()
|
||||
|
||||
# remove 2 faces
|
||||
allFaces = mesh.GetElementsByType(FACE)
|
||||
allFaces = mesh.GetElementsByType(SMESH.FACE)
|
||||
mesh.RemoveElements( allFaces[0:2])
|
||||
|
||||
bareGroup = mesh.MakeGroup("bare faces", FACE, FT_BareBorderFace)
|
||||
bareGroup = mesh.MakeGroup("bare faces", SMESH.FACE, SMESH.FT_BareBorderFace)
|
||||
assert(bareGroup.Size() == 3)
|
||||
|
@ -1,7 +1,17 @@
|
||||
# Bare border volumes
|
||||
|
||||
from smesh import *
|
||||
SetCurrentStudy(salome.myStudy)
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
import salome_notebook
|
||||
|
||||
|
||||
box = geompy.MakeBoxDXDYDZ(100, 30, 10)
|
||||
# the smallest face of the box
|
||||
@ -10,7 +20,7 @@ face = geompy.SubShapeAllSorted( box, geompy.ShapeType["FACE"])[0]
|
||||
geompy.addToStudy( box, "box" )
|
||||
geompy.addToStudyInFather( box, face, "face" )
|
||||
|
||||
mesh = Mesh(box)
|
||||
mesh = smesh.Mesh(box)
|
||||
mesh.AutomaticHexahedralization();
|
||||
|
||||
# remove half of mesh faces from the smallest face
|
||||
@ -19,5 +29,5 @@ faceToRemove = faceFaces[: len(faceFaces)/2]
|
||||
mesh.RemoveElements( faceToRemove )
|
||||
|
||||
# make a group of volumes missing the removed faces
|
||||
bareGroup = mesh.MakeGroup("bare volumes", VOLUME, FT_BareBorderVolume)
|
||||
bareGroup = mesh.MakeGroup("bare volumes", SMESH.VOLUME, SMESH.FT_BareBorderVolume)
|
||||
assert(bareGroup.Size() == len( faceToRemove))
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user