1 # Use 3D extrusion meshing algorithm
3 import salome, smesh, SMESH, geompy
6 smesh.SetCurrentStudy( salome.myStudy )
8 OX = geompy.MakeVectorDXDYDZ(1,0,0)
9 OY = geompy.MakeVectorDXDYDZ(0,1,0)
10 OZ = geompy.MakeVectorDXDYDZ(0,0,1)
12 # Y ^ Make geometry of a "pipe" with the following base (cross section).
13 # | Big central quadrangles will be meshed with triangles, walls
14 # of the pipe will be meshed with quadrilaterals
27 # +--+--+--+--+--+--+ X
29 quadBig = geompy.MakeFaceHW( 20,20, 1 )
30 quadBig = geompy.MakeTranslation( quadBig, 15,15,0 )
31 quadSmall = geompy.MakeFaceHW( 10,10, 1 )
32 smallQuads1 = geompy.MakeMultiTranslation1D( quadSmall, OX, 10, 3 )
33 smallQuads2 = geompy.MakeMultiTranslation1D( quadSmall, OY, 10, 3 )
34 smallQuads2 = geompy.SubShapeAllSortedCentres( smallQuads2, geompy.ShapeType["FACE"])[1:]
36 base = geompy.MakeCompound( smallQuads2 + [smallQuads1, quadBig])
37 axis = geompy.MakeLine( geompy.MakeVertex( 25,25,0), OZ )
38 base = geompy.MultiRotate1DNbTimes( base, axis, 4)
39 base = geompy.MakePartition( [base], theName="base")
40 path = geompy.MakeSketcher("Sketcher:F 0 0:TT 0 100:R 0:C -90 180:T 0 -150",[0,0,0, 0,-1,0, 1,0,0])
42 # Make the pipe, each quadrangle of the base turns into a prism with composite wall faces
43 pipe = geompy.MakePipe( base, path )
44 prisms = geompy.MakePartition( [pipe], theName="prisms")
47 # get base faces of the prism to define sub-mesh on them
48 smallQuad = geompy.GetFaceNearPoint( prisms, geompy.MakeVertex( 0,0,0 ), "smallQuad")
49 bigQuad = geompy.GetFaceNearPoint( prisms, geompy.MakeVertex( 15,15,0 ), "bigQuad")
52 mesh = smesh.Mesh( prisms )
54 # assign Global hypotheses
56 # 1D algorithm and hypothesis for vertical division
57 mesh.Segment().NumberOfSegments(15)
62 # assign Local hypotheses
64 # 1D and 2D algos and hyps to mesh smallQuad with quadrilaterals
65 mesh.Segment(smallQuad).LocalLength( 3 )
66 mesh.Quadrangle(smallQuad)
68 # 1D and 2D algos and hyps to mesh bigQuad with triangles
69 mesh.Segment(bigQuad).LocalLength( 3 )
70 mesh.Triangle(bigQuad)