X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=doc%2Fsalome%2Fgui%2FSMESH%2Ftransforming_meshes.htm;h=4f740bb60f0e8b299f345e157db301a65b11124b;hp=f70f20b44b33aae9b04949a0ec8e588303e252eb;hb=9d11375af40826e967ab2c3bcb77d1f9d439c90c;hpb=529a4c0bfc7d5f67647141ed1ed03fe493f51802 diff --git a/doc/salome/gui/SMESH/transforming_meshes.htm b/doc/salome/gui/SMESH/transforming_meshes.htm index f70f20b44..4f740bb60 100755 --- a/doc/salome/gui/SMESH/transforming_meshes.htm +++ b/doc/salome/gui/SMESH/transforming_meshes.htm @@ -1,883 +1,758 @@ - - - - - -Transforming Meshes - - - - - - - - - - - -

Transforming Meshes

- -

Transforming Meshes

- -

 

- -

Translation

- -

 

- -

# - Attention! This script has been written using the old approach basing - on direct usage of SMESH idl interface.

- -

# For the moment smesh package doesn't provide - methods to translate meshes.

- -

# In the next SALOME version the scripts will - be updated to use only the commands from smesh package.

- -

 

- -

import SMESH

- -

import SMESH_mechanic

- -

 

- -

mesh = SMESH_mechanic.mesh

- -

anEditor = mesh.GetMeshEditor()

- -

 

- -

# define translation - vector

- -

point = SMESH.PointStruct(-150., - -150., 0.)

- -

vector = SMESH.DirStruct(point)

- -

 

- -

# translate a mesh

- -

doCopy = 1

- -

anEditor.TranslateObject(mesh, - vector, doCopy)

- -

 

- -

Rotation

- -

 

- -

# - Attention! This script has been written using the old approach basing - on direct usage of SMESH idl interface.

- -

# For the moment smesh package doesn't provide - methods to rotate meshes.

- -

# In the next SALOME version the scripts will - be updated to use only the commands from smesh package.

- -

 

- -

import math

- -

import SMESH

- -

import SMESH_mechanic

- -

 

- -

mesh = SMESH_mechanic.mesh

- -

anEditor = mesh.GetMeshEditor()

- -

 

- -

# define rotation axis - and angle

- -

axisXYZ = SMESH.AxisStruct(0., 0., 0., - 5., 5., 20.)

- -

angle270 = 1.5 * math.pi

- -

 

- -

# rotate a mesh

- -

anEditor.RotateObject(mesh, axisXYZ, angle270, - 1)

- -

 

- -

Symmetry

- -

 

- -

# - Attention! This script has been written using the old approach basing - on direct usage of SMESH idl interface.

- -

# For the moment smesh package doesn't provide - methods to create symmetrical copies of meshes.

- -

# In the next SALOME version the scripts will - be updated to use only the commands from smesh package.

- -

 

- -

import math

- -

import SMESH

- -

import SMESH_mechanic

- -

 

- -

mesh = SMESH_mechanic.mesh

- -

anEditor = mesh.GetMeshEditor()

- -

 

- -

# create a symmetrical - copy of the mesh mirrored through a point

- -

axis = SMESH.AxisStruct(0, 0, 0, 0, 0, - 0)

- -

anEditor.MirrorObject(mesh, axis, SMESH.SMESH_MeshEditor.POINT, - 1)

- -

 

- -

Merging - Nodes

- -

 

- -

# - Attention! This script has been written using the old approach basing - on direct usage of SMESH idl interface.

- -

# For the moment smesh package doesn't provide - methods to merge nodes.

- -

# In the next SALOME version the scripts will - be updated to use only the commands from smesh package.

- -

 

- -

import SMESH_mechanic

- -

mesh = SMESH_mechanic.mesh

- -

 

- -

aMeshEditor = mesh.GetMeshEditor()

- -

 

- -

# merge nodes

- -

Tolerance = 25.0

- -

 

- -

GroupsOfNodes = - aMeshEditor.FindCoincidentNodes(Tolerance)

- -

aMeshEditor.MergeNodes(GroupsOfNodes) -

- -

 

- -

Merging Elements

- -

# - Attention! This script has been written using the old approach basing - on direct usage of SMESH idl interface.

- -

# For the moment smesh package doesn't provide - methods to merge elements.

- -

# In the next SALOME version the scripts will - be updated to use only the commands from smesh package.

- -

 

- -

import salome

- -

import geompy

- -

import smesh

- -

import SMESH

- -

 

- -

# create a face to - be meshed

- -

px = geompy.MakeVertex(100., - 0.  , 0. -  )

- -

py = geompy.MakeVertex(0. -  , 100., - 0.  )

- -

pz = geompy.MakeVertex(0. -  , 0.  , - 100.)

- -

 

- -

vxy = geompy.MakeVector(px, - py)

- -

arc = geompy.MakeArc(py, - pz, px)

- -

 

- -

wire = geompy.MakeWire([vxy, - arc])

- -

isPlanarFace = 1

- -

 

- -

face1 = geompy.MakeFace(wire, - isPlanarFace)

- -

id_face1 = geompy.addToStudy(face1, - "Face1")

- -

 

- -

# create a circle to - be an extrusion path

- -

px1 = geompy.MakeVertex( - 100.,  100., -  0.)

- -

py1 = geompy.MakeVertex(-100., - -100.,  0.)

- -

pz1 = geompy.MakeVertex( -   0., -    0., - 50.)

- -

 

- -

circle = geompy.MakeCircleThreePnt(py1, - pz1, px1)

- -

id_circle = geompy.addToStudy(circle, - "Path")

- -

 

- -

# create a 2D mesh - on the face

- -

trias = smesh.Mesh(face1, - "Face : 2D mesh")

- -

 

- -

algo1D = trias.Segment()

- -

algo1D.NumberOfSegments(6)

- -

algo2D = trias.Triangle()

- -

algo2D.LengthFromEdges()

- -

 

- -

trias.Compute()

- -

tri_mesh = trias.GetMesh()

- -

 

- -

# create a path mesh

- -

circlemesh = smesh.Mesh(circle, - "Path mesh")

- -

algo = circlemesh.Segment()

- -

algo.NumberOfSegments(10)

- -

circlemesh.Compute()

- -

 

- -

# extrusion of the - mesh

- -

aMeshEditor = tri_mesh.GetMeshEditor()

- -

aMeshEditor.ExtrusionAlongPathObject(tri_mesh, - circlemesh.GetMesh(), circle,

- -

                                     1, - 0, [], 0, SMESH.PointStruct(0, 0, 0))

- -

# merge nodes

- -

print "Number - of nodes before MergeNodes:", tri_mesh.NbNodes()

- -

 

- -

tolerance = 0.001

- -

array_of_nodes_groups - = aMeshEditor.FindCoincidentNodes(tolerance)

- -

aMeshEditor.MergeNodes(array_of_nodes_groups)

- -

 

- -

print "Number - of nodes after MergeNodes:", tri_mesh.NbNodes()

- -

print ""

- -

print "Number - of elements before MergeEqualElements:"

- -

print "Edges -      : - ", tri_mesh.NbEdges()

- -

print "Triangles -  : ", - tri_mesh.NbTriangles()

- -

print "Quadrangles: - ", tri_mesh.NbQuadrangles()

- -

print "Volumes -    : - ", tri_mesh.NbVolumes()

- -

 

- -

# merge elements

- -

aMeshEditor.MergeEqualElements()

- -

 

- -

print "Number - of elements after MergeEqualElements:"

- -

print "Edges -      : - ", tri_mesh.NbEdges()

- -

print "Triangles -  : ", - tri_mesh.NbTriangles()

- -

print "Quadrangles: - ", tri_mesh.NbQuadrangles()

- -

print "Volumes -    : - ", tri_mesh.NbVolumes()

- -

 

- -

salome.sg.updateObjBrowser(1) -

- -

 

- -

Sewing Meshes

- -

Sew Meshes Border to Border

- -

# - Attention! This script has been written using the old approach basing - on direct usage of SMESH idl interface.

- -

# For the moment smesh package doesn't provide - methods to sew meshes border to border.

- -

# In the next SALOME version the scripts will - be updated to use only the commands from smesh package.

- -

 

- -

import geompy

- -

import smesh

- -

 

- -

# create two faces - of a box

- -

box1 = geompy.MakeBox(0., - 0., -10., 30., 20., 25.)

- -

facesList1 = geompy.SubShapeAll(box1, - geompy.ShapeType["FACE"])

- -

face1 = facesList1[2]

- -

 

- -

box2 = geompy.MakeBox(0., - 5., 0., 20., 20., 15.)

- -

facesList2 = geompy.SubShapeAll(box2, - geompy.ShapeType["FACE"])

- -

face2 = facesList2[1]

- -

 

- -

edgesList = geompy.SubShapeAll(face2, - geompy.ShapeType["EDGE"])

- -

edge1 = edgesList[2]

- -

 

- -

aComp = geompy.MakeCompound([face1, - face2])

- -

geompy.addToStudy(aComp, - "Two faces")

- -

 

- -

# create a mesh on - two faces

- -

mesh = smesh.Mesh(aComp, - "Two faces : quadrangle mesh")

- -

 

- -

algo1D = mesh.Segment()

- -

algo1D.NumberOfSegments(9)

- -

algo2D = mesh.Quadrangle()

- -

 

- -

algo_local = mesh.Segment(edge1)

- -

algo_local.Arithmetic1D(1, - 4)

- -

algo_local.Propagation()

- -

 

- -

mesh.Compute()

- -

 

- -

anEditor = mesh.GetMesh().GetMeshEditor()

- -

 

- -

# sew border to side

- -

# FirstNodeIDOnFreeBorder, - SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder,

- -

# FirstNodeIDOnSide, - LastNodeIDOnSide,

- -

# CreatePolygons, CreatePolyedrs

- -

anEditor.SewBorderToSide(5, - 45, 6, 113, 109, 0, 0)

- -

Sew Conform Free Borders

- -

# - Attention! This script has been written using the old approach basing - on direct usage of SMESH idl interface.

- -

# For the moment smesh package doesn't provide - methods to sew conform free borders.

- -

# In the next SALOME version the scripts will - be updated to use only the commands from smesh package.

- -

 

- -

import geompy

- -

import smesh

- -

 

- -

# create two faces - of the box

- -

box1 = geompy.MakeBox(0., - 0., -10., 20., 20., 15.)

- -

facesList1 = geompy.SubShapeAll(box1, - geompy.ShapeType["FACE"])

- -

face1 = facesList1[2]

- -

 

- -

box2 = geompy.MakeBox(0., - 5., 0., 20., 20., 15.)

- -

facesList2 = geompy.SubShapeAll(box2, - geompy.ShapeType["FACE"])

- -

face2 = facesList2[1]

- -

 

- -

edgesList = geompy.SubShapeAll(face2, - geompy.ShapeType["EDGE"])

- -

edge1 = edgesList[2]

- -

 

- -

aComp = geompy.MakeCompound([face1, - face2])

- -

geompy.addToStudy(aComp, - "Two faces")

- -

 

- -

# create a mesh on - two faces

- -

mesh = smesh.Mesh(aComp, - "Two faces : quadrangle mesh")

- -

 

- -

algo1D = mesh.Segment()

- -

algo1D.NumberOfSegments(9)

- -

algo2D = mesh.Quadrangle()

- -

 

- -

algo_local = mesh.Segment(edge1)

- -

algo_local.Arithmetic1D(1, - 4)

- -

algo_local.Propagation()

- -

 

- -

mesh.Compute()

- -

 

- -

anEditor = mesh.GetMesh().GetMeshEditor()

- -

 

- -

# sew conform free - borders

- -

# FirstNodeID1, SecondNodeID1, - LastNodeID1, FirstNodeID2, SecondNodeID2

- -

anEditor.SewConformFreeBorders(5, - 45, 6, 3, 24)

- -

Sew Free Borders

- -

# - Attention! This script has been written using the old approach basing - on direct usage of SMESH idl interface.

- -

# For the moment smesh package doesn't provide - methods to sew free borders.

- -

# In the next SALOME version the scripts will - be updated to use only the commands from smesh package.

- -

 

- -

import geompy

- -

import smesh

- -

 

- -

# create two faces - of the box

- -

box1 = geompy.MakeBox(0., - 0., 0., 20., 20., 15.)

- -

facesList1 = geompy.SubShapeAll(box1, - geompy.ShapeType["FACE"])

- -

face1 = facesList1[2]

- -

 

- -

box2 = geompy.MakeBox(0., - 5., 0., 20., 20., 15.)

- -

facesList2 = geompy.SubShapeAll(box2, - geompy.ShapeType["FACE"])

- -

face2 = facesList2[1]

- -

 

- -

edgesList = geompy.SubShapeAll(face2, - geompy.ShapeType["EDGE"])

- -

edge1 = edgesList[2]

- -

 

- -

aComp = geompy.MakeCompound([face1, - face2])

- -

geompy.addToStudy(aComp, - "Two faces")

- -

 

- -

# create a mesh on - two faces

- -

mesh = smesh.Mesh(aComp, - "Two faces : quadrangle mesh")

- -

 

- -

algo1D = mesh.Segment()

- -

algo1D.NumberOfSegments(4)

- -

algo2D = mesh.Quadrangle()

- -

 

- -

algo_local = mesh.Segment(edge1)

- -

algo_local.Arithmetic1D(1, - 4)

- -

algo_local.Propagation()

- -

 

- -

mesh.Compute()

- -

 

- -

# sew free borders

- -

# FirstNodeID1, SecondNodeID1, - LastNodeID1,

- -

# FirstNodeID2, SecondNodeID2, - LastNodeID2, CreatePolygons, CreatePolyedrs

- -

anEditor = mesh.GetMesh().GetMeshEditor()

- -

anEditor.SewFreeBorders(6, - 21, 5, 1, 12, 3, 0, 0)

- -

Sew Side Elements

- -

# - Attention! This script has been written using the old approach basing - on direct usage of SMESH idl interface.

- -

# For the moment smesh package doesn't provide - methods to sew side elements.

- -

# In the next SALOME version the scripts will - be updated to use only the commands from smesh package.

- -

import geompy

- -

import smesh

- -

 

- -

# create two boxes

- -

box1 = geompy.MakeBox(0., -  0., 0., - 10., 10., 10.)

- -

box2 = geompy.MakeBox(0., - 15., 0., 20., 25., 10.)

- -

 

- -

EdgesList = geompy.SubShapeAll(box2, - geompy.ShapeType["EDGE"])

- -

 

- -

aComp = geompy.MakeCompound([box1, - box2])

- -

geompy.addToStudy(aComp, - "Two boxes")

- -

 

- -

# create a mesh on - two boxes

- -

mesh = smesh.Mesh(aComp, - "Two faces : quadrangle mesh")

- -

 

- -

algo1D = mesh.Segment()

- -

algo1D.NumberOfSegments(2)

- -

algo2D = mesh.Quadrangle()

- -

 

- -

algo_local = mesh.Segment(EdgesList[8])

- -

algo_local.NumberOfSegments(4)

- -

algo_local.Propagation()

- -

 

- -

mesh.Compute()

- -

 

- -

anEditor = mesh.GetMesh().GetMeshEditor()

- -

 

- -

# sew side elements

- -

# IDsOfSide1Elements, - IDsOfSide2Elements,

- -

# NodeID1OfSide1ToMerge, - NodeID1OfSide2ToMerge, NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge

- -

anEditor.SewSideElements([69, - 70, 71, 72], [91, 92, 89, 90], 8, 38, 23, 58)

- - - - + + + + + +Transforming Meshes + + + + + + + + + + + +

Transforming Meshes

+ +

Transforming Meshes

+ +

 

+ +

Translation

+ +

 

+ +

import SMESH_mechanic

+ +

 

+ +

smesh + = SMESH_mechanic.smesh

+ +

mesh = SMESH_mechanic.mesh +

+ +

 

+ +

# define translation + vector

+ +

point + = smesh.PointStruct(-150., -150., 0.)

+ +

vector =smesh.DirStruct(point) +

+ +

 

+ +

# translate a mesh

+ +

doCopy = 1

+ +

 

+ +

mesh.Translate([], + vector, doCopy)  

+ +

 

+ +

Rotation

+ +

 

+ +

import math

+ +

import SMESH_mechanic

+ +

 

+ +

smesh + = SMESH_mechanic.smesh

+ +

mesh = SMESH_mechanic.mesh

+ +

 

+ +

# define rotation axis + and angle

+ +

axisXYZ = smesh.AxisStruct(0., 0., 0., + 5., 5., 20.)

+ +

angle270 = 1.5 * math.pi

+ +

 

+ +

# rotate a mesh

+ +

mesh.Rotate([], + axisXYZ, angle270, 1)  

+ +

 

+ +

Symmetry

+ +

 

+ +

import math

+ +

 

+ +

import SMESH_mechanic

+ +

 

+ +

smesh + = SMESH_mechanic.smesh

+ +

mesh = SMESH_mechanic.mesh

+ +

 

+ +

# create a symmetrical + copy of the mesh mirrored through a point

+ +

axis = SMESH.AxisStruct(0, 0, 0, 0, 0, + 0)

+ +

 

+ +

mesh.Mirror([], axis, smesh.POINT, 1) +

+ +

 

+ +

Merging + Nodes

+ +

 

+ +

import SMESH_mechanic

+ +

mesh = SMESH_mechanic.mesh

+ +

 

+ +

# merge nodes

+ +

Tolerance = 25.0

+ +

 

+ +

GroupsOfNodes = +  mesh.FindCoincidentNodes(Tolerance)

+ +

mesh.MergeNodes(GroupsOfNodes) +  

+ +

 

+ +

Merging Elements

+ +

import salome

+ +

import geompy

+ +

import smesh

+ +

 

+ +

# create a face to + be meshed

+ +

px = geompy.MakeVertex(100., + 0.  , 0. +  )

+ +

py = geompy.MakeVertex(0. +  , 100., + 0.  )

+ +

pz = geompy.MakeVertex(0. +  , 0.  , + 100.)

+ +

 

+ +

vxy = geompy.MakeVector(px, + py)

+ +

arc = geompy.MakeArc(py, + pz, px)

+ +

 

+ +

wire = geompy.MakeWire([vxy, + arc])

+ +

isPlanarFace = 1

+ +

 

+ +

face1 = geompy.MakeFace(wire, + isPlanarFace)

+ +

id_face1 = geompy.addToStudy(face1, + "Face1")

+ +

 

+ +

# create a circle to + be an extrusion path

+ +

px1 = geompy.MakeVertex( + 100.,  100., +  0.)

+ +

py1 = geompy.MakeVertex(-100., + -100.,  0.)

+ +

pz1 = geompy.MakeVertex( +   0., +    0., + 50.)

+ +

 

+ +

circle = geompy.MakeCircleThreePnt(py1, + pz1, px1)

+ +

id_circle = geompy.addToStudy(circle, + "Path")

+ +

 

+ +

# create a 2D mesh + on the face

+ +

trias = smesh.Mesh(face1, + "Face : 2D mesh")

+ +

 

+ +

algo1D = trias.Segment()

+ +

algo1D.NumberOfSegments(6)

+ +

algo2D = trias.Triangle()

+ +

algo2D.LengthFromEdges()

+ +

 

+ +

trias.Compute()

+ +

 

+ +

# create a path mesh

+ +

circlemesh = smesh.Mesh(circle, + "Path mesh")

+ +

algo = circlemesh.Segment()

+ +

algo.NumberOfSegments(10)

+ +

circlemesh.Compute()

+ +

 

+ +

# extrusion of the + mesh

+ +

trias.ExtrusionAlongPath([], + circlemesh, circle,

+ +

                         1, + 0, [], 0, smesh.PointStruct(0, 0, 0))

+ +

 

+ +

# merge nodes

+ +

print "Number + of nodes before MergeNodes:",

+ +

trias.NbNodes()

+ +

tolerance = 0.001

+ +

array_of_nodes_groups + = trias.FindCoincidentNodes(tolerance)

+ +

 

+ +

trias.MergeNodes(array_of_nodes_groups)

+ +

 

+ +

print "Number + of nodes after MergeNodes:", trias.NbNodes()

+ +

print ""

+ +

print "Number + of elements before MergeEqualElements:"

+ +

print "Edges +      : + ", trias.NbEdges()

+ +

print "Triangles +  : ", + trias.NbTriangles()

+ +

print "Quadrangles: + ", trias.NbQuadrangles()

+ +

print "Volumes +    : + ", trias.NbVolumes()

+ +

 

+ +

# merge elements

+ +

trias.MergeEqualElements()

+ +

print "Number + of elements after MergeEqualElements:"

+ +

print "Edges +      : + ", trias.NbEdges()

+ +

print "Triangles +  : ", + trias.NbTriangles()

+ +

print "Quadrangles: + ", trias.NbQuadrangles()

+ +

print "Volumes +    : + ", trias.NbVolumes()

+ +

 

+ +

salome.sg.updateObjBrowser(1) +

+ +

 

+ +

Sewing Meshes

+ +

Sew Meshes Border to Border

+ +

import geompy

+ +

import smesh

+ +

 

+ +

# create two faces + of a box

+ +

box1 = geompy.MakeBox(0., + 0., -10., 30., 20., 25.)

+ +

facesList1 = geompy.SubShapeAll(box1, + geompy.ShapeType["FACE"])

+ +

face1 = facesList1[2]

+ +

 

+ +

box2 = geompy.MakeBox(0., + 5., 0., 20., 20., 15.)

+ +

facesList2 = geompy.SubShapeAll(box2, + geompy.ShapeType["FACE"])

+ +

face2 = facesList2[1]

+ +

 

+ +

edgesList = geompy.SubShapeAll(face2, + geompy.ShapeType["EDGE"])

+ +

edge1 = edgesList[2]

+ +

 

+ +

aComp = geompy.MakeCompound([face1, + face2])

+ +

geompy.addToStudy(aComp, + "Two faces")

+ +

 

+ +

# create a mesh on + two faces

+ +

mesh = smesh.Mesh(aComp, + "Two faces : quadrangle mesh")

+ +

 

+ +

algo1D = mesh.Segment()

+ +

algo1D.NumberOfSegments(9)

+ +

algo2D = mesh.Quadrangle()

+ +

 

+ +

algo_local = mesh.Segment(edge1)

+ +

algo_local.Arithmetic1D(1, + 4)

+ +

algo_local.Propagation()

+ +

 

+ +

mesh.Compute()

+ +

 

+ +

# sew border to side

+ +

# FirstNodeIDOnFreeBorder, + SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder,

+ +

# FirstNodeIDOnSide, + LastNodeIDOnSide,

+ +

# CreatePolygons, CreatePolyedrs

+ +

mesh.SewBorderToSide(5, + 45, 6, 113, 109, 0, 0)

+ +

Sew Conform Free Borders

+ +

import geompy

+ +

import smesh

+ +

 

+ +

# create two faces + of the box

+ +

box1 = geompy.MakeBox(0., + 0., -10., 20., 20., 15.)

+ +

facesList1 = geompy.SubShapeAll(box1, + geompy.ShapeType["FACE"])

+ +

face1 = facesList1[2]

+ +

 

+ +

box2 = geompy.MakeBox(0., + 5., 0., 20., 20., 15.)

+ +

facesList2 = geompy.SubShapeAll(box2, + geompy.ShapeType["FACE"])

+ +

face2 = facesList2[1]

+ +

 

+ +

edgesList = geompy.SubShapeAll(face2, + geompy.ShapeType["EDGE"])

+ +

edge1 = edgesList[2]

+ +

 

+ +

aComp = geompy.MakeCompound([face1, + face2])

+ +

geompy.addToStudy(aComp, + "Two faces")

+ +

 

+ +

# create a mesh on + two faces

+ +

mesh = smesh.Mesh(aComp, + "Two faces : quadrangle mesh")

+ +

 

+ +

algo1D = mesh.Segment()

+ +

algo1D.NumberOfSegments(9)

+ +

algo2D = mesh.Quadrangle()

+ +

 

+ +

algo_local = mesh.Segment(edge1)

+ +

algo_local.Arithmetic1D(1, + 4)

+ +

algo_local.Propagation()

+ +

 

+ +

mesh.Compute()

+ +

 

+ +

# sew conform free + borders

+ +

# FirstNodeID1, SecondNodeID1, + LastNodeID1, FirstNodeID2, SecondNodeID2

+ +

mesh.SewConformFreeBorders(5, + 45, 6, 3, 24)  

+ +

Sew Free Borders

+ +

import geompy

+ +

import smesh

+ +

 

+ +

# create two faces + of the box

+ +

box1 = geompy.MakeBox(0., + 0., 0., 20., 20., 15.)

+ +

facesList1 = geompy.SubShapeAll(box1, + geompy.ShapeType["FACE"])

+ +

face1 = facesList1[2]

+ +

 

+ +

box2 = geompy.MakeBox(0., + 5., 0., 20., 20., 15.)

+ +

facesList2 = geompy.SubShapeAll(box2, + geompy.ShapeType["FACE"])

+ +

face2 = facesList2[1]

+ +

 

+ +

edgesList = geompy.SubShapeAll(face2, + geompy.ShapeType["EDGE"])

+ +

edge1 = edgesList[2]

+ +

 

+ +

aComp = geompy.MakeCompound([face1, + face2])

+ +

geompy.addToStudy(aComp, + "Two faces")

+ +

 

+ +

# create a mesh on + two faces

+ +

mesh = smesh.Mesh(aComp, + "Two faces : quadrangle mesh")

+ +

 

+ +

algo1D = mesh.Segment()

+ +

algo1D.NumberOfSegments(4)

+ +

algo2D = mesh.Quadrangle()

+ +

 

+ +

algo_local = mesh.Segment(edge1)

+ +

algo_local.Arithmetic1D(1, + 4)

+ +

algo_local.Propagation()

+ +

 

+ +

mesh.Compute()

+ +

 

+ +

# sew free borders

+ +

# FirstNodeID1, SecondNodeID1, + LastNodeID1,

+ +

# FirstNodeID2, SecondNodeID2, + LastNodeID2, CreatePolygons, CreatePolyedrs

+ +

mesh.SewFreeBorders(6, + 21, 5, 1, 12, 3, 0, 0)

+ +

Sew Side Elements

+ +

import geompy

+ +

import smesh

+ +

 

+ +

# create two boxes

+ +

box1 = geompy.MakeBox(0., +  0., 0., + 10., 10., 10.)

+ +

box2 = geompy.MakeBox(0., + 15., 0., 20., 25., 10.)

+ +

 

+ +

EdgesList = geompy.SubShapeAll(box2, + geompy.ShapeType["EDGE"])

+ +

 

+ +

aComp = geompy.MakeCompound([box1, + box2])

+ +

geompy.addToStudy(aComp, + "Two boxes")

+ +

 

+ +

# create a mesh on + two boxes

+ +

mesh = smesh.Mesh(aComp, + "Two faces : quadrangle mesh")

+ +

 

+ +

algo1D = mesh.Segment()

+ +

algo1D.NumberOfSegments(2)

+ +

algo2D = mesh.Quadrangle()

+ +

 

+ +

algo_local = mesh.Segment(EdgesList[8])

+ +

algo_local.NumberOfSegments(4)

+ +

algo_local.Propagation()

+ +

 

+ +

mesh.Compute()

+ +

 

+ +

# sew side elements

+ +

# IDsOfSide1Elements, + IDsOfSide2Elements,

+ +

# NodeID1OfSide1ToMerge, + NodeID1OfSide2ToMerge, NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge

+ +

mesh.SewSideElements([69, + 70, 71, 72], [91, 92, 89, 90], 8, 38, 23, 58)

+ + + +