]> SALOME platform Git repositories - modules/smesh.git/blob - doc/salome/examples/transforming_meshes_ex09.py
Salome HOME
23207: EDF 11232 SMESH: viscou layers builder fails at the very fist inflation
[modules/smesh.git] / doc / salome / examples / transforming_meshes_ex09.py
1 # Sew Free Borders
2
3
4 import salome
5 salome.salome_init()
6 import GEOM
7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
9
10 import SMESH, SALOMEDS
11 from salome.smesh import smeshBuilder
12 smesh =  smeshBuilder.New(salome.myStudy)
13
14 # make two not sewed quadranges
15 OY0 = geompy.MakeVectorDXDYDZ(0, 1, 0)
16 OY1 = geompy.MakeTranslation( OY0, 1, 0, 0, theName="OY1" )
17 OY2 = geompy.MakeTranslation( OY0, 1.01, 0, 0, theName="OY2" )
18 OY3 = geompy.MakeTranslation( OY0, 2, 0, 0 )
19 q1  = geompy.MakeQuad2Edges( OY0, OY1 )
20 q2  = geompy.MakeQuad2Edges( OY2, OY3 )
21
22 shape = geompy.MakeCompound( [q1,q2], theName='shape' )
23
24 # make a non-uniform quadrangle mesh on two faces
25 mesh = smesh.Mesh(shape, "Two faces : quadrangle mesh")
26 mesh.Segment().Arithmetic1D( 0.1, 0.4 )
27 mesh.Segment(q1).NumberOfSegments( 5 )
28 mesh.Quadrangle()
29 mesh.Compute()
30
31 # sew free borders
32
33 segs1 = mesh.GetSubMeshElementsId( OY1 ) # mesh segments generated on borders
34 segs2 = mesh.GetSubMeshElementsId( OY2 )
35
36 FirstNodeID1  = mesh.GetElemNode( segs1[0], 0 )
37 SecondNodeID1 = mesh.GetElemNode( segs1[0], 1 )
38 LastNodeID1   = mesh.GetElemNode( segs1[-1], 1 )
39 FirstNodeID2  = mesh.GetElemNode( segs2[0], 0 )
40 SecondNodeID2 = mesh.GetElemNode( segs2[0], 1 )
41 LastNodeID2   = mesh.GetElemNode( segs2[-1], 1 )
42 CreatePolygons = True
43 CreatePolyedrs = False
44
45 res = mesh.SewFreeBorders(FirstNodeID1, SecondNodeID1, LastNodeID1,
46                           FirstNodeID2, SecondNodeID2, LastNodeID2,
47                           CreatePolygons, CreatePolyedrs )
48 print res
49 print "nb polygons:", mesh.NbPolygons()
50