X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=doc%2Fsalome%2Fgui%2FSMESH%2Ftransforming_meshes.htm;h=f425f345bcc4ac6784c222a3356e28efc38015be;hb=d491005a536421427251784108cfea5d35ccc762;hp=1020cdf63682e6766e47a56b631dbec87a2e6f11;hpb=57b43b4d010e2d0a1529d3c131bbb9d416e63258;p=modules%2Fsmesh.git diff --git a/doc/salome/gui/SMESH/transforming_meshes.htm b/doc/salome/gui/SMESH/transforming_meshes.htm index 1020cdf63..f425f345b 100755 --- a/doc/salome/gui/SMESH/transforming_meshes.htm +++ b/doc/salome/gui/SMESH/transforming_meshes.htm @@ -10,8 +10,9 @@ h3.whs1 { margin-top:0pt; margin-bottom:0pt; } h4.whs2 { margin-top:0pt; margin-bottom:0pt; } p.whs3 { font-family:'Lucida Console' , monospace; margin-top:0pt; margin-bottom:0pt; } -p.whs4 { margin-top:0pt; margin-bottom:0pt; } -p.whs5 { margin-top:0pt; margin-bottom:0pt; font-family:'Lucida Console' , monospace; } +p.whs4 { margin-top:0pt; margin-bottom:0pt; font-family:'Lucida Console' , monospace; } +p.whs5 { margin-top:0pt; margin-bottom:0pt; font-family:'Times New Roman' , serif; } +p.whs6 { margin-top:0pt; margin-bottom:0pt; } --> - -
+ +-
import SMESH
- -import SMESH_mechanic
+import SMESH_mechanic
-+
-
mesh = - SMESH_mechanic.mesh
+smesh + = SMESH_mechanic.smesh
-salome = SMESH_mechanic.salome
+mesh = SMESH_mechanic.mesh +
-
# translate a mesh
+# define translation + vector
-anEditor = mesh.GetMeshEditor()
+point + = smesh.PointStruct(-150., -150., 0.)
-point = SMESH.PointStruct(-150, -150, - 0)
+vector =smesh.DirStruct(point) +
-vector = SMESH.DirStruct(point)
++ +
# translate a mesh
-anEditor.TranslateObject(mesh, vector, - 1)
+doCopy = 1
-
salome.sg.updateObjBrowser(1) -
+mesh.Translate([], + vector, doCopy)
-+
-
import SMESH
+import math
import SMESH_mechanic
-
import math
+smesh + = SMESH_mechanic.smesh
-mesh = - SMESH_mechanic.mesh
+mesh = SMESH_mechanic.mesh
-salome = SMESH_mechanic.salome
- -- -
# rotate a mesh
- -anEditor = mesh.GetMeshEditor()
+-
axisXYZ = SMESH.AxisStruct(0, 0, 0, 5, - 5, 20)
+# define rotation axis + and angle
-angle180 = 1.5*math.pi
+axisXYZ = smesh.AxisStruct(0., 0., 0., + 5., 5., 20.)
-anEditor.RotateObject(mesh, axisXYZ, angle180, - 1)
+angle270 = 1.5 * math.pi
-
salome.sg.updateObjBrowser(1)
+# rotate a mesh
-+
mesh.Rotate([], + axisXYZ, angle270, 1)
-+
-
import SMESH
+import math
+ +
import SMESH_mechanic
-
import math
- -mesh = - SMESH_mechanic.mesh
+smesh + = SMESH_mechanic.smesh
-salome = SMESH_mechanic.salome
+mesh = SMESH_mechanic.mesh
-+
-
# create a symmetrical +
# create a symmetrical copy of the mesh mirrored through a point
-anEditor = mesh.GetMeshEditor()
- -anEditor.MirrorObject(mesh, SMESH.AxisStruct(0, - 0, 0, 0, 0, 0), SMESH.SMESH_MeshEditor.POINT, 1)
+axis = SMESH.AxisStruct(0, 0, 0, 0, 0, + 0)
-
salome.sg.updateObjBrowser(1) +
mesh.Mirror([], axis, smesh.POINT, 1)
-- -
+
-
import SMESH
- -import SMESH_mechanic
- -- -
smesh = - SMESH_mechanic.smesh
- -mesh = - SMESH_mechanic.mesh
+import SMESH_mechanic
-salome = SMESH_mechanic.salome
+mesh = SMESH_mechanic.mesh
-
# merge nodes
- -aMeshEditor = mesh.GetMeshEditor()
- -Tolerance = 25.0
- -+
# merge nodes
-GroupsOfNodes = aMeshEditor.FindCoincidentNodes(Tolerance)
+Tolerance = 25.0
-aMeshEditor.MergeNodes(GroupsOfNodes)
+-
+
GroupsOfNodes = + mesh.FindCoincidentNodes(Tolerance)
-salome.sg.updateObjBrowser(1) -
+mesh.MergeNodes(GroupsOfNodes) +
-+
import geompy
+import salome
-import smesh
+import geompy
-import salome
- -import SMESH
+import smesh
-
# create a face to be meshed
+# create a face to + be meshed
-px = geompy.MakeVertex(100., +
px = geompy.MakeVertex(100., 0. , 0. )
-py = geompy.MakeVertex(0. +
py = geompy.MakeVertex(0. , 100., 0. )
-pz = geompy.MakeVertex(0. +
pz = geompy.MakeVertex(0. , 0. , 100.)
-+
-
vxy = geompy.MakeVector(px, +
vxy = geompy.MakeVector(px, py)
-arc = geompy.MakeArc(py, +
arc = geompy.MakeArc(py, pz, px)
-+
-
wire = geompy.MakeWire([vxy, +
wire = geompy.MakeWire([vxy, arc])
-isPlanarFace = 1
+isPlanarFace = 1
-+
-
face1 = geompy.MakeFace(wire, +
face1 = geompy.MakeFace(wire, isPlanarFace)
-id_face1 = geompy.addToStudy(face1, +
id_face1 = geompy.addToStudy(face1, "Face1")
-
# create a 2D mesh on the - face
- -trias = smesh.Mesh(face1, - "Face : 2D mesh")
- -+
# create a circle to + be an extrusion path
-algo = trias.Segment()
+px1 = geompy.MakeVertex( + 100., 100., + 0.)
-algo.NumberOfSegments(6)
+py1 = geompy.MakeVertex(-100., + -100., 0.)
-+
pz1 = geompy.MakeVertex( + 0., + 0., + 50.)
-algo = trias.Triangle()
+-
algo.LengthFromEdges()
+circle = geompy.MakeCircleThreePnt(py1, + pz1, px1)
-+
id_circle = geompy.addToStudy(circle, + "Path")
-trias.Compute()
+-
+
# create a 2D mesh + on the face
-tri_mesh = trias.GetMesh()
+trias = smesh.Mesh(face1, + "Face : 2D mesh")
-
# create a path mesh
- -px1 = geompy.MakeVertex(100., - 100. , - 0. )
+algo1D = trias.Segment()
-py1 = geompy.MakeVertex(-100. - , -100., - 0. )
+algo1D.NumberOfSegments(6)
-pz1 = geompy.MakeVertex(0. - , 0. , - 50.)
+algo2D = trias.Triangle()
-+
algo2D.LengthFromEdges()
-circle = geompy.MakeCircleThreePnt(py1, - pz1, px1)
+-
id_circle = geompy.addToStudy(circle, - "Path")
+trias.Compute()
-
circlemesh = smesh.Mesh(circle, +
# create a path mesh
+ +circlemesh = smesh.Mesh(circle, "Path mesh")
-+
algo = circlemesh.Segment()
-algo = circlemesh.Segment()
+algo.NumberOfSegments(10)
-algo.NumberOfSegments(10)
+circlemesh.Compute()
-
circlemesh.Compute()
- -+
# extrusion of the + mesh
-# extrusion of the mesh
+trias.ExtrusionAlongPath([], + circlemesh, circle,
-aMeshEditor = tri_mesh.GetMeshEditor()
- -aMeshEditor.ExtrusionAlongPathObject(tri_mesh, - circlemesh.GetMesh(), circle, 1, 0, [], 0, SMESH.PointStruct(0, 0, 0))
+1, + 0, [], 0, smesh.PointStruct(0, 0, 0))
-
# merge nodes
+# merge nodes
-print "Number - of nodes before MergeNodes:", tri_mesh.NbNodes()
+print "Number + of nodes before MergeNodes:",
-+
trias.NbNodes()
-tolerance = 0.001
+tolerance = 0.001
-array_of_nodes_groups - = aMeshEditor.FindCoincidentNodes(tolerance)
+array_of_nodes_groups + = trias.FindCoincidentNodes(tolerance)
-aMeshEditor.MergeNodes(array_of_nodes_groups)
+-
+
trias.MergeNodes(array_of_nodes_groups)
-print "Number - of nodes after MergeNodes:", tri_mesh.NbNodes()
+-
print ""
+print "Number + of nodes after MergeNodes:", trias.NbNodes()
-print "Number +
print ""
+ +print "Number of elements before MergeEqualElements:"
-print "Edges +
print "Edges : - ", tri_mesh.NbEdges()
+ ", trias.NbEdges() -print "Triangles +
print "Triangles : ", - tri_mesh.NbTriangles()
+ trias.NbTriangles() -print "Quadrangles: - ", tri_mesh.NbQuadrangles()
+print "Quadrangles: + ", trias.NbQuadrangles()
-print "Volumes +
print "Volumes : - ", tri_mesh.NbVolumes()
+ ", trias.NbVolumes()-
# merge elements
- -aMeshEditor.MergeEqualElements()
+# merge elements
-+
trias.MergeEqualElements()
-print "Number +
print "Number of elements after MergeEqualElements:"
-print "Edges +
print "Edges : - ", tri_mesh.NbEdges()
+ ", trias.NbEdges() -print "Triangles +
print "Triangles : ", - tri_mesh.NbTriangles()
+ trias.NbTriangles() -print "Quadrangles: - ", tri_mesh.NbQuadrangles()
+print "Quadrangles: + ", trias.NbQuadrangles()
-print "Volumes +
print "Volumes : - ", tri_mesh.NbVolumes()
+ ", trias.NbVolumes() -+
-
salome.sg.updateObjBrowser(1) +
salome.sg.updateObjBrowser(1)
++
import salome
- -import geompy
+import geompy
-import smesh
+import smesh
-
# create two faces of a - box
+# create two faces + of a box
-box1 = geompy.MakeBox(0., +
box1 = geompy.MakeBox(0., 0., -10., 30., 20., 25.)
-subShapeList1 = - geompy.SubShapeAll(box1, geompy.ShapeType["FACE"])
- -- -
box2 = geompy.MakeBox(0., - 5., 0., 20., 20., 15.)
- -subShapeList2 = - geompy.SubShapeAll(box2, geompy.ShapeType["FACE"])
- -EdgesList = geompy.SubShapeAll(subShapeList2[ - 1 ], geompy.ShapeType["EDGE"])
- -+
facesList1 = geompy.SubShapeAll(box1, + geompy.ShapeType["FACE"])
-aComp = geompy.MakeCompound( - [subShapeList1[ 2 ], subShapeList2[ 1 ]] )
+face1 = facesList1[2]
-idComp = geompy.addToStudy( - aComp, "Two faces" )
+-
aCompobj = - salome.IDToObject( idComp )
+box2 = geompy.MakeBox(0., + 5., 0., 20., 20., 15.)
-+
facesList2 = geompy.SubShapeAll(box2, + geompy.ShapeType["FACE"])
-# create a mesh on two - faces
+face2 = facesList2[1]
-
mesh = smesh.Mesh(aCompobj, - "Two faces : quadrangle mesh")
+edgesList = geompy.SubShapeAll(face2, + geompy.ShapeType["EDGE"])
-algo = mesh.Segment()
+edge1 = edgesList[2]
-+
-
# define "NumberOfSegments" - hypothesis to cut an edge in a fixed number of segments
+aComp = geompy.MakeCompound([face1, + face2])
-algo.NumberOfSegments(9)
+geompy.addToStudy(aComp, + "Two faces")
-
# create a quadrangle 2D - algorithm for faces
+# create a mesh on + two faces
-mesh.Quadrangle()
+mesh = smesh.Mesh(aComp, + "Two faces : quadrangle mesh")
-
# create a local hypothesis
+algo1D = mesh.Segment()
-algo = mesh.Segment(EdgesList[2])
+algo1D.NumberOfSegments(9)
+ +algo2D = mesh.Quadrangle()
-
# define "Arithmetic1D" - hypothesis to cut an edge in several segments with increasing arithmetic - length
+algo_local = mesh.Segment(edge1)
-algo.Arithmetic1D(1, +
algo_local.Arithmetic1D(1, 4)
-- -
# define "Propagation" - hypothesis that propagates all other hypothesis on all edges on the opposite - side in case of quadrangular faces
+algo_local.Propagation()
-algo.Propagation()
+-
mesh.Compute()
+mesh.Compute()
-
# sew free borders
- -anEditor = mesh.GetMesh().GetMeshEditor()
+# sew border to side
-anEditor.SewBorderToSide(5, - 45, 6, 113, 109, 0, 0)
+# FirstNodeIDOnFreeBorder, + SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder,
-+
# FirstNodeIDOnSide, + LastNodeIDOnSide,
-salome.sg.updateObjBrowser(1) -
+# CreatePolygons, CreatePolyedrs
-+
mesh.SewBorderToSide(5, + 45, 6, 113, 109, 0, 0)
import salome
- -import geompy
+import geompy
-import smesh
+import smesh
-
# create two faces of the - box
+# create two faces + of the box
-box1 = geompy.MakeBox(0., +
box1 = geompy.MakeBox(0., 0., -10., 20., 20., 15.)
-subShapeList1 = - geompy.SubShapeAll(box1, geompy.ShapeType["FACE"])
+facesList1 = geompy.SubShapeAll(box1, + geompy.ShapeType["FACE"])
-- -
box2 = geompy.MakeBox(0., - 5., 0., 20., 20., 15.)
- -subShapeList2 = - geompy.SubShapeAll(box2, geompy.ShapeType["FACE"])
- -EdgesList = geompy.SubShapeAll(subShapeList2[ - 1 ], geompy.ShapeType["EDGE"])
- -- -
aComp = geompy.MakeCompound( - [subShapeList1[ 2 ], subShapeList2[ 1 ]] )
- -idComp = geompy.addToStudy( - aComp, "Two faces" )
- -aCompobj = - salome.IDToObject( idComp )
+face1 = facesList1[2]
-
# create a mesh on two - faces
+box2 = geompy.MakeBox(0., + 5., 0., 20., 20., 15.)
-mesh = smesh.Mesh(aCompobj, - "Two faces : quadrangle mesh")
+facesList2 = geompy.SubShapeAll(box2, + geompy.ShapeType["FACE"])
-algo = mesh.Segment()
+face2 = facesList2[1]
-
# define "NumberOfSegments" - hypothesis to cut an edge in a fixed number of segments
+edgesList = geompy.SubShapeAll(face2, + geompy.ShapeType["EDGE"])
-algo.NumberOfSegments(9)
+edge1 = edgesList[2]
-
# create a quadrangle 2D - algorithm for faces
+aComp = geompy.MakeCompound([face1, + face2])
-mesh.Quadrangle()
+geompy.addToStudy(aComp, + "Two faces")
-
# create a local hypothesis
+# create a mesh on + two faces
-algo = mesh.Segment(EdgesList[2])
+mesh = smesh.Mesh(aComp, + "Two faces : quadrangle mesh")
-
# define "Arithmetic1D" - hypothesis to cut an edge in several segments with increasing arithmetic - length
+algo1D = mesh.Segment()
-algo.Arithmetic1D(1, - 4)
+algo1D.NumberOfSegments(9)
+ +algo2D = mesh.Quadrangle()
-
# define "Propagation" - hypothesis that propagate all other hypothesis on all edges on - the opposite side in case of quadrangular faces
+algo_local = mesh.Segment(edge1)
-algo.Propagation()
+algo_local.Arithmetic1D(1, + 4)
-mesh.Compute()
+algo_local.Propagation()
-
# sew free borders
+mesh.Compute()
-anEditor = mesh.GetMesh().GetMeshEditor()
+-
anEditor.SewConformFreeBorders(5, - 45, 6, 3, 24)
+# sew conform free + borders
-salome.sg.updateObjBrowser(1) -
+# FirstNodeID1, SecondNodeID1, + LastNodeID1, FirstNodeID2, SecondNodeID2
-+
mesh.SewConformFreeBorders(5, + 45, 6, 3, 24)
import salome
+import geompy
-import geompy
- -import smesh
+import smesh
-
# create two faces of the - box
+# create two faces + of the box
-box1 = geompy.MakeBox(0., +
box1 = geompy.MakeBox(0., 0., 0., 20., 20., 15.)
-subShapeList1 = - geompy.SubShapeAll(box1, geompy.ShapeType["FACE"])
+facesList1 = geompy.SubShapeAll(box1, + geompy.ShapeType["FACE"])
+ +face1 = facesList1[2]
-
box2 = geompy.MakeBox(0., +
box2 = geompy.MakeBox(0., 5., 0., 20., 20., 15.)
-subShapeList2 = - geompy.SubShapeAll(box2, geompy.ShapeType["FACE"])
- -EdgesList = geompy.SubShapeAll(subShapeList2[ - 1 ], geompy.ShapeType["EDGE"])
- -- -
aComp = geompy.MakeCompound( - [subShapeList1[ 2 ], subShapeList2[ 1 ]] )
+facesList2 = geompy.SubShapeAll(box2, + geompy.ShapeType["FACE"])
-idComp = geompy.addToStudy( - aComp, "Two faces" )
- -aCompobj = - salome.IDToObject( idComp )
- -- -
# create a mesh on two - faces
- -mesh = smesh.Mesh(aCompobj, - "Two faces : quadrangle mesh")
- -algo = mesh.Segment()
+face2 = facesList2[1]
-
# define "NumberOfSegments" - hypothesis to cut an edge in a fixed number of segments
+edgesList = geompy.SubShapeAll(face2, + geompy.ShapeType["EDGE"])
-algo.NumberOfSegments(4)
+edge1 = edgesList[2]
-
# creates a quadrangle - 2D algorithm for faces
+aComp = geompy.MakeCompound([face1, + face2])
-mesh.Quadrangle()
+geompy.addToStudy(aComp, + "Two faces")
-
# create a local hypothesis
+# create a mesh on + two faces
-algo = mesh.Segment(EdgesList[2])
+mesh = smesh.Mesh(aComp, + "Two faces : quadrangle mesh")
-
# define "Arithmetic1D" - hypothesis to cut an edge in several segments with increasing - arithmetic length
+algo1D = mesh.Segment()
-algo.Arithmetic1D(1, - 4)
+algo1D.NumberOfSegments(4)
+ +algo2D = mesh.Quadrangle()
-
# define "Propagation" - hypothesis that propagate all other hypothesis on all edges on - the opposite side in case of quadrangular faces
+algo_local = mesh.Segment(edge1)
-algo.Propagation()
+algo_local.Arithmetic1D(1, + 4)
-mesh.Compute()
+algo_local.Propagation()
-
# sew free borders
+mesh.Compute()
-anEditor = mesh.GetMesh().GetMeshEditor()
+-
anEditor.SewFreeBorders(6, - 21, 5, 1, 12, 3, 0, 0)
+# sew free borders
-+
# FirstNodeID1, SecondNodeID1, + LastNodeID1,
-salome.sg.updateObjBrowser(1) -
+# FirstNodeID2, SecondNodeID2, + LastNodeID2, CreatePolygons, CreatePolyedrs
-+
mesh.SewFreeBorders(6, + 21, 5, 1, 12, 3, 0, 0)
import salome
- -import geompy
+import geompy
-import smesh
+import smesh
-+
-
# create two faces of the - box
+# create two boxes
-box1 = geompy.MakeBox(0., +
box1 = geompy.MakeBox(0., 0., 0., 10., 10., 10.)
-box2 = geompy.MakeBox(0., +
box2 = geompy.MakeBox(0., 15., 0., 20., 25., 10.)
-EdgesList = geompy.SubShapeAll(box2, +
+ +
EdgesList = geompy.SubShapeAll(box2, geompy.ShapeType["EDGE"])
-
aComp = geompy.MakeCompound( - [box1, box2] )
- -idComp = geompy.addToStudy( - aComp, "Two faces" )
+aComp = geompy.MakeCompound([box1, + box2])
-aCompobj = - salome.IDToObject( idComp )
+geompy.addToStudy(aComp, + "Two boxes")
-+
-
# create a mesh on two - faces
+# create a mesh on + two boxes
-mesh = smesh.Mesh(aCompobj, +
mesh = smesh.Mesh(aComp, "Two faces : quadrangle mesh")
-algo = mesh.Segment()
--
# define "NumberOfSegments" - hypothesis to cut an edge in a fixed number of segments
- -algo.NumberOfSegments(2)
+algo1D = mesh.Segment()
-- -
# create a quadrangle 2D - algorithm for faces
+algo1D.NumberOfSegments(2)
-mesh.Quadrangle()
+algo2D = mesh.Quadrangle()
-
# create a local hypothesis
+algo_local = mesh.Segment(EdgesList[8])
-algo = mesh.Segment(EdgesList[8])
+algo_local.NumberOfSegments(4)
-- -
# define "Arithmetic1D" - hypothesis to cut an edge in several segments with increasing arithmetic - length
- -algo.NumberOfSegments(4)
+algo_local.Propagation()
-
# define "Propagation" - hypothesis that propagates all other hypothesis on all edges on the opposite side in case - of quadrangular faces
- -algo.Propagation()
- -mesh.Compute()
+mesh.Compute()
-
# sew free borders
+# sew side elements
-anEditor = mesh.GetMesh().GetMeshEditor()
+# IDsOfSide1Elements, + IDsOfSide2Elements,
-anEditor.SewSideElements([69, - 70, 71, 72], [91, 92, 89, 90], 8, 38, 23, 58)
+# NodeID1OfSide1ToMerge, + NodeID1OfSide2ToMerge, NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge
-salome.sg.updateObjBrowser(1) -
+mesh.SewSideElements([69, + 70, 71, 72], [91, 92, 89, 90], 8, 38, 23, 58)