mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-28 18:30:35 +05:00
PR: examples adaptation
This commit is contained in:
parent
682bea02c0
commit
1d6c201310
@ -1,7 +1,14 @@
|
|||||||
# Arithmetic 1D
|
# Arithmetic 1D
|
||||||
|
|
||||||
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 a box
|
# create a box
|
||||||
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
|
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
# Deflection 1D and Number of Segments
|
# Deflection 1D and Number of Segments
|
||||||
|
|
||||||
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 a face from arc and straight segment
|
# create a face from arc and straight segment
|
||||||
px = geompy.MakeVertex(100., 0. , 0. )
|
px = geompy.MakeVertex(100., 0. , 0. )
|
||||||
|
@ -1,16 +1,23 @@
|
|||||||
# Start and End Length
|
# Start and End Length
|
||||||
|
|
||||||
from geompy import *
|
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 = MakeBoxDXDYDZ(10., 10., 10.)
|
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
|
||||||
addToStudy(box, "Box")
|
geompy.addToStudy(box, "Box")
|
||||||
|
|
||||||
# get one edge of the box to put local hypothesis on
|
# get one edge of the box to put local hypothesis on
|
||||||
p5 = MakeVertex(5., 0., 0.)
|
p5 = geompy.MakeVertex(5., 0., 0.)
|
||||||
EdgeX = GetEdgeNearPoint(box, p5)
|
EdgeX = geompy.GetEdgeNearPoint(box, p5)
|
||||||
addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
|
geompy.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
|
||||||
|
|
||||||
# create a hexahedral mesh on the box
|
# create a hexahedral mesh on the box
|
||||||
hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
|
hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
|
||||||
|
@ -1,16 +1,23 @@
|
|||||||
# Local Length
|
# Local Length
|
||||||
|
|
||||||
from geompy import *
|
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 = MakeBoxDXDYDZ(10., 10., 10.)
|
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
|
||||||
addToStudy(box, "Box")
|
geompy.addToStudy(box, "Box")
|
||||||
|
|
||||||
# get one edge of the box to put local hypothesis on
|
# get one edge of the box to put local hypothesis on
|
||||||
p5 = MakeVertex(5., 0., 0.)
|
p5 = geompy.MakeVertex(5., 0., 0.)
|
||||||
EdgeX = GetEdgeNearPoint(box, p5)
|
EdgeX = geompy.GetEdgeNearPoint(box, p5)
|
||||||
addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
|
geompy.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
|
||||||
|
|
||||||
# create a hexahedral mesh on the box
|
# create a hexahedral mesh on the box
|
||||||
hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
|
hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
# Maximum Element Area
|
# Maximum Element Area
|
||||||
|
|
||||||
import geompy
|
|
||||||
import smesh
|
|
||||||
import salome
|
import salome
|
||||||
|
salome.salome_init()
|
||||||
|
import GEOM
|
||||||
|
from salome.geom import geomBuilder
|
||||||
|
geompy = geomBuilder.New(salome.myStudy)
|
||||||
|
|
||||||
|
import SMESH, SALOMEDS
|
||||||
|
from salome.smesh import smeshBuilder
|
||||||
|
smesh = smeshBuilder.New(salome.myStudy)
|
||||||
|
|
||||||
# create a face
|
# create a face
|
||||||
px = geompy.MakeVertex(100., 0. , 0. )
|
px = geompy.MakeVertex(100., 0. , 0. )
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
# Maximum Element Volume
|
# Maximum Element Volume
|
||||||
|
|
||||||
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 a cylinder
|
# create a cylinder
|
||||||
cyl = geompy.MakeCylinderRH(30., 50.)
|
cyl = geompy.MakeCylinderRH(30., 50.)
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
# Length from Edges
|
# Length from Edges
|
||||||
|
|
||||||
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 sketchers
|
# create sketchers
|
||||||
sketcher1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
|
sketcher1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
|
||||||
|
@ -1,16 +1,23 @@
|
|||||||
# Propagation
|
# Propagation
|
||||||
|
|
||||||
from geompy import *
|
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 = MakeBoxDXDYDZ(10., 10., 10.)
|
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
|
||||||
addToStudy(box, "Box")
|
geompy.addToStudy(box, "Box")
|
||||||
|
|
||||||
# get one edge of the box to put local hypothesis on
|
# get one edge of the box to put local hypothesis on
|
||||||
p5 = MakeVertex(5., 0., 0.)
|
p5 = geompy.MakeVertex(5., 0., 0.)
|
||||||
EdgeX = GetEdgeNearPoint(box, p5)
|
EdgeX = geompy.GetEdgeNearPoint(box, p5)
|
||||||
addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
|
geompy.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
|
||||||
|
|
||||||
# create a hexahedral mesh on the box
|
# create a hexahedral mesh on the box
|
||||||
hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
|
hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
# Defining Meshing Algorithms
|
# Defining Meshing Algorithms
|
||||||
|
|
||||||
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 a box
|
# create a box
|
||||||
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
|
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
|
||||||
|
@ -2,7 +2,15 @@
|
|||||||
|
|
||||||
# Project prisms from one meshed box to another mesh on the same box
|
# 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
|
# Prepare geometry
|
||||||
|
|
||||||
@ -36,7 +44,7 @@ geompy.addToStudyInFather( box, edgesF2, "edgesF2" )
|
|||||||
|
|
||||||
|
|
||||||
# Make the source mesh with prisms
|
# 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.Segment().NumberOfSegments(9,10)
|
||||||
src_mesh.Quadrangle()
|
src_mesh.Quadrangle()
|
||||||
src_mesh.Hexahedron()
|
src_mesh.Hexahedron()
|
||||||
@ -47,7 +55,7 @@ src_mesh.Compute()
|
|||||||
# Mesh the box using projection algoritms
|
# Mesh the box using projection algoritms
|
||||||
|
|
||||||
# Define the same global 1D and 2D hypotheses
|
# 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.Segment().NumberOfSegments(9,10,UseExisting=True)
|
||||||
tgt_mesh.Quadrangle()
|
tgt_mesh.Quadrangle()
|
||||||
|
|
||||||
@ -73,4 +81,4 @@ proj3D.SourceShape3D( box, src_mesh, v1F1, v1F2, v2F1, v2F2 )
|
|||||||
tgt_mesh.Compute()
|
tgt_mesh.Compute()
|
||||||
|
|
||||||
# Move the source mesh to visualy compare the two meshes
|
# 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
|
# 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
|
# Prepare geometry
|
||||||
|
|
||||||
@ -20,7 +28,7 @@ geompy.addToStudyInFather( box, Face_1, 'Face_1' )
|
|||||||
geompy.addToStudyInFather( box, Face_2, 'Face_2' )
|
geompy.addToStudyInFather( box, Face_2, 'Face_2' )
|
||||||
|
|
||||||
# Make the source mesh with Netgem2D
|
# 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.Segment().NumberOfSegments(15)
|
||||||
src_mesh.Triangle()
|
src_mesh.Triangle()
|
||||||
src_mesh.Compute()
|
src_mesh.Compute()
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
# 1D Mesh with Fixed Points example
|
# 1D Mesh with Fixed Points example
|
||||||
|
|
||||||
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)
|
||||||
import StdMeshers
|
import StdMeshers
|
||||||
|
|
||||||
# Create face and explode it on edges
|
# Create face and explode it on edges
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
# Radial Quadrangle 1D2D example
|
# 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
|
# 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])
|
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
|
# Define geometry for mesh, and Radial Quadrange algorithm
|
||||||
mesh = smesh.Mesh(Face)
|
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
|
# The Radial Quadrange algorithm can work without any hypothesis
|
||||||
# In this case it uses "Default Nb of Segments" preferences parameter to discretize edges
|
# 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)
|
# Quadrangle Parameters example 1 (meshing a face with 3 edges)
|
||||||
|
|
||||||
from smesh import *
|
import salome
|
||||||
SetCurrentStudy(salome.myStudy)
|
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.
|
# Get 1/4 part from the disk face.
|
||||||
Box_1 = geompy.MakeBoxDXDYDZ(100, 100, 100)
|
Box_1 = geompy.MakeBoxDXDYDZ(100, 100, 100)
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
# Quadrangle Parameters example 2 (using different types)
|
# Quadrangle Parameters example 2 (using different types)
|
||||||
|
|
||||||
import geompy
|
import salome
|
||||||
import smesh
|
salome.salome_init()
|
||||||
|
import GEOM
|
||||||
|
from salome.geom import geomBuilder
|
||||||
|
geompy = geomBuilder.New(salome.myStudy)
|
||||||
|
|
||||||
|
import SMESH, SALOMEDS
|
||||||
|
from salome.smesh import smeshBuilder
|
||||||
|
smesh = smeshBuilder.New(salome.myStudy)
|
||||||
import StdMeshers
|
import StdMeshers
|
||||||
|
|
||||||
# Make quadrangle face and explode it on edges.
|
# Make quadrangle face and explode it on edges.
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
# "Use Existing Elements" example
|
# "Use Existing Elements" example
|
||||||
|
|
||||||
from smesh import *
|
import salome
|
||||||
SetCurrentStudy(salome.myStudy)
|
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
|
# 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
|
# 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)
|
nSeg1 = srcMesh.Segment().NumberOfSegments(4)
|
||||||
srcMesh.Quadrangle()
|
srcMesh.Quadrangle()
|
||||||
srcMesh.Compute()
|
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
|
# 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)
|
importAlgo = tgtMesh.UseExisting2DElements(midFace1)
|
||||||
import2hyp = importAlgo.SourceFaces( [srcFaceGroup] )
|
import2hyp = importAlgo.SourceFaces( [srcFaceGroup] )
|
||||||
tgtMesh.Segment().NumberOfSegments(3)
|
tgtMesh.Segment().NumberOfSegments(3)
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
# Viscous layers construction
|
# Viscous layers construction
|
||||||
|
|
||||||
from smesh import *
|
import salome
|
||||||
SetCurrentStudy(salome.myStudy)
|
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 )
|
X = geompy.MakeVectorDXDYDZ( 1,0,0 )
|
||||||
O = geompy.MakeVertex( 100,50,50 )
|
O = geompy.MakeVertex( 100,50,50 )
|
||||||
@ -19,7 +26,7 @@ geompy.addToStudy( shape, "shape" )
|
|||||||
geompy.addToStudyInFather( shape, face1, "face1")
|
geompy.addToStudyInFather( shape, face1, "face1")
|
||||||
|
|
||||||
|
|
||||||
mesh = Mesh(shape, "CFD")
|
mesh = smesh.Mesh(shape, "CFD")
|
||||||
|
|
||||||
mesh.Segment().NumberOfSegments( 4 )
|
mesh.Segment().NumberOfSegments( 4 )
|
||||||
|
|
||||||
@ -35,6 +42,6 @@ layersHyp = algo3D.ViscousLayers(thickness,numberOfLayers,stretchFactor,ignoreFa
|
|||||||
|
|
||||||
mesh.Compute()
|
mesh.Compute()
|
||||||
|
|
||||||
mesh.MakeGroup("Tetras",VOLUME,FT_ElemGeomType,"=",Geom_TETRA)
|
mesh.MakeGroup("Tetras",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_TETRA)
|
||||||
mesh.MakeGroup("Pyras",VOLUME,FT_ElemGeomType,"=",Geom_PYRAMID)
|
mesh.MakeGroup("Pyras",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_PYRAMID)
|
||||||
mesh.MakeGroup("Prims",VOLUME,FT_ElemGeomType,"=",Geom_PENTA)
|
mesh.MakeGroup("Prims",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_PENTA)
|
||||||
|
@ -28,8 +28,14 @@
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
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)
|
||||||
|
|
||||||
import StdMeshers
|
import StdMeshers
|
||||||
|
|
||||||
|
@ -21,8 +21,15 @@
|
|||||||
# =======================================
|
# =======================================
|
||||||
# Procedure that take a triangulation and split all triangles in 4 others triangles
|
# Procedure that take a triangulation and split all triangles in 4 others triangles
|
||||||
#
|
#
|
||||||
import geompy
|
import salome
|
||||||
import smesh
|
salome.salome_init()
|
||||||
|
import GEOM
|
||||||
|
from salome.geom import geomBuilder
|
||||||
|
geompy = geomBuilder.New(salome.myStudy)
|
||||||
|
|
||||||
|
import SMESH, SALOMEDS
|
||||||
|
from salome.smesh import smeshBuilder
|
||||||
|
smesh = smeshBuilder.New(salome.myStudy)
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@ -81,10 +88,10 @@ def triangle(m, f, n1, n2, n3):
|
|||||||
|
|
||||||
def SplitTrianglesIn4(m):
|
def SplitTrianglesIn4(m):
|
||||||
# Get all triangles
|
# Get all triangles
|
||||||
triangles = m.GetElementsByType(smesh.FACE)
|
triangles = m.GetElementsByType(SMESH.FACE)
|
||||||
|
|
||||||
# Remove all edges
|
# Remove all edges
|
||||||
m.RemoveElements(m.GetElementsByType(smesh.EDGE))
|
m.RemoveElements(m.GetElementsByType(SMESH.EDGE))
|
||||||
|
|
||||||
# Get the list of nodes (ids) associated with the CAD vertices
|
# Get the list of nodes (ids) associated with the CAD vertices
|
||||||
shape = m.GetShape()
|
shape = m.GetShape()
|
||||||
@ -222,4 +229,4 @@ MyMesh.ExportMED(path+str(NbCells4)+"_triangles.med", 0)
|
|||||||
# Update the object browser
|
# Update the object browser
|
||||||
# -------------------------
|
# -------------------------
|
||||||
|
|
||||||
geompy.salome.sg.updateObjBrowser(1)
|
salome.sg.updateObjBrowser(1)
|
||||||
|
@ -18,18 +18,17 @@
|
|||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
|
||||||
import salome
|
import salome
|
||||||
import geompy
|
|
||||||
import math
|
|
||||||
import SALOMEDS
|
|
||||||
import SMESH
|
|
||||||
import smesh
|
|
||||||
|
|
||||||
salome.salome_init()
|
salome.salome_init()
|
||||||
aStudyId = salome.myStudy._get_StudyId()
|
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
|
||||||
|
|
||||||
geompy.init_geom(salome.myStudy)
|
|
||||||
global Face_1
|
global Face_1
|
||||||
Face_1 = geompy.MakeFaceHW(100, 100, 1)
|
Face_1 = geompy.MakeFaceHW(100, 100, 1)
|
||||||
geompy.addToStudy( Face_1, "Face_1" )
|
geompy.addToStudy( Face_1, "Face_1" )
|
||||||
@ -51,7 +50,7 @@ aListOfElems = [ 52, 53, 54, 55, 56, 57,
|
|||||||
72, 73, 74, 75, 76, 77,
|
72, 73, 74, 75, 76, 77,
|
||||||
82, 83, 84, 85, 86, 87 ]
|
82, 83, 84, 85, 86, 87 ]
|
||||||
|
|
||||||
aRedGroup = Mesh_1.GetMesh().CreateGroup( smesh.FACE, "Red" )
|
aRedGroup = Mesh_1.GetMesh().CreateGroup( SMESH.FACE, "Red" )
|
||||||
aRedGroup.Add( aListOfElems );
|
aRedGroup.Add( aListOfElems );
|
||||||
aRedGroup.SetColor( SALOMEDS.Color( 1, 0, 0 ) )
|
aRedGroup.SetColor( SALOMEDS.Color( 1, 0, 0 ) )
|
||||||
|
|
||||||
@ -64,7 +63,7 @@ aListOfElems = [ 55, 56, 57, 58, 59,
|
|||||||
115, 116, 117, 118, 119,
|
115, 116, 117, 118, 119,
|
||||||
125, 126, 127, 128, 129 ]
|
125, 126, 127, 128, 129 ]
|
||||||
|
|
||||||
aGreenGroup = Mesh_1.GetMesh().CreateGroup( smesh.FACE, "Green" )
|
aGreenGroup = Mesh_1.GetMesh().CreateGroup( SMESH.FACE, "Green" )
|
||||||
aGreenGroup.Add( aListOfElems );
|
aGreenGroup.Add( aListOfElems );
|
||||||
aGreenGroup.SetColor( SALOMEDS.Color( 0, 1, 0 ) )
|
aGreenGroup.SetColor( SALOMEDS.Color( 0, 1, 0 ) )
|
||||||
|
|
||||||
@ -75,7 +74,7 @@ aListOfElems = [ 63, 64, 65, 66, 67, 68,
|
|||||||
103, 104, 105, 106, 107, 108,
|
103, 104, 105, 106, 107, 108,
|
||||||
113, 114, 115, 116, 117, 118 ]
|
113, 114, 115, 116, 117, 118 ]
|
||||||
|
|
||||||
aBlueGroup = Mesh_1.GetMesh().CreateGroup( smesh.FACE, "Blue" )
|
aBlueGroup = Mesh_1.GetMesh().CreateGroup( SMESH.FACE, "Blue" )
|
||||||
aBlueGroup.Add( aListOfElems );
|
aBlueGroup.Add( aListOfElems );
|
||||||
aBlueGroup.SetColor( SALOMEDS.Color( 0, 0, 1 ) )
|
aBlueGroup.SetColor( SALOMEDS.Color( 0, 0, 1 ) )
|
||||||
|
|
||||||
|
@ -22,8 +22,15 @@
|
|||||||
#
|
#
|
||||||
import os
|
import os
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
# Parameters
|
# Parameters
|
||||||
# ----------
|
# ----------
|
||||||
@ -53,7 +60,7 @@ m = smesh.Mesh(cylinder)
|
|||||||
# 2D mesh with BLSURF
|
# 2D mesh with BLSURF
|
||||||
# -------------------
|
# -------------------
|
||||||
|
|
||||||
algo2d = m.Triangle(smesh.BLSURF)
|
algo2d = m.Triangle(smeshBuilder.BLSURF)
|
||||||
|
|
||||||
algo2d.SetPhysicalMesh(1)
|
algo2d.SetPhysicalMesh(1)
|
||||||
algo2d.SetPhySize(5)
|
algo2d.SetPhySize(5)
|
||||||
@ -63,7 +70,7 @@ algo2d.SetGeometricMesh(0)
|
|||||||
# 3D mesh with tepal
|
# 3D mesh with tepal
|
||||||
# ------------------
|
# ------------------
|
||||||
|
|
||||||
algo3d = m.Tetrahedron(smesh.GHS3DPRL)
|
algo3d = m.Tetrahedron(smeshBuilder.GHS3DPRL)
|
||||||
|
|
||||||
algo3d.SetMEDName(results)
|
algo3d.SetMEDName(results)
|
||||||
algo3d.SetNbPart(4)
|
algo3d.SetNbPart(4)
|
||||||
|
@ -18,20 +18,17 @@
|
|||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
|
||||||
import salome
|
import salome
|
||||||
import geompy
|
|
||||||
import math
|
|
||||||
import SALOMEDS
|
|
||||||
import SMESH
|
|
||||||
import smesh
|
|
||||||
|
|
||||||
salome.salome_init()
|
salome.salome_init()
|
||||||
aStudyId = salome.myStudy._get_StudyId()
|
import GEOM
|
||||||
|
from salome.geom import geomBuilder
|
||||||
|
geompy = geomBuilder.New(salome.myStudy)
|
||||||
|
|
||||||
geompy.init_geom(salome.myStudy)
|
import SMESH, SALOMEDS
|
||||||
|
from salome.smesh import smeshBuilder
|
||||||
|
smesh = smeshBuilder.New(salome.myStudy)
|
||||||
|
import math
|
||||||
|
|
||||||
geompy.init_geom(salome.myStudy)
|
|
||||||
global Box_1
|
global Box_1
|
||||||
Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
|
Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
|
||||||
geompy.addToStudy( Box_1, "Box_1" )
|
geompy.addToStudy( Box_1, "Box_1" )
|
||||||
@ -50,18 +47,18 @@ isDone = Mesh_1.Compute()
|
|||||||
|
|
||||||
aListOf3d_1=range(721,821)
|
aListOf3d_1=range(721,821)
|
||||||
|
|
||||||
aGrp3D_1=Mesh_1.GetMesh().CreateGroup( smesh.VOLUME, "Src 3D 1" )
|
aGrp3D_1=Mesh_1.GetMesh().CreateGroup( SMESH.VOLUME, "Src 3D 1" )
|
||||||
aGrp3D_1.Add( aListOf3d_1 )
|
aGrp3D_1.Add( aListOf3d_1 )
|
||||||
|
|
||||||
aListOf3d_2=range(821, 921)
|
aListOf3d_2=range(821, 921)
|
||||||
aGrp3D_2=Mesh_1.GetMesh().CreateGroup( smesh.VOLUME, "Src 3D 2" )
|
aGrp3D_2=Mesh_1.GetMesh().CreateGroup( SMESH.VOLUME, "Src 3D 2" )
|
||||||
aGrp3D_2.Add( aListOf3d_2 )
|
aGrp3D_2.Add( aListOf3d_2 )
|
||||||
|
|
||||||
aGrp2D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], smesh.FACE, "Faces" )
|
aGrp2D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], SMESH.FACE, "Faces" )
|
||||||
|
|
||||||
aGrp1D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], smesh.EDGE, "Edges" )
|
aGrp1D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], SMESH.EDGE, "Edges" )
|
||||||
|
|
||||||
aGrp0D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], smesh.NODE, "Nodes" )
|
aGrp0D = Mesh_1.CreateDimGroup( [aGrp3D_1, aGrp3D_2], SMESH.NODE, "Nodes" )
|
||||||
|
|
||||||
salome.sg.updateObjBrowser( 1 )
|
salome.sg.updateObjBrowser( 1 )
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user