7 from salome.geom import geomBuilder
8 geompy = geomBuilder.New(salome.myStudy)
10 import SMESH, SALOMEDS
11 from salome.smesh import smeshBuilder
12 smesh = smeshBuilder.New(salome.myStudy)
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 )
22 shape = geompy.MakeCompound( [q1,q2], theName='shape' )
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 )
33 segs1 = mesh.GetSubMeshElementsId( OY1 ) # mesh segments generated on borders
34 segs2 = mesh.GetSubMeshElementsId( OY2 )
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 )
43 CreatePolyedrs = False
45 res = mesh.SewFreeBorders(FirstNodeID1, SecondNodeID1, LastNodeID1,
46 FirstNodeID2, SecondNodeID2, LastNodeID2,
47 CreatePolygons, CreatePolyedrs )
49 print "nb polygons:", mesh.NbPolygons()