1 # Usage of Extrusion 3D meshing algorithm
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New()
10 from salome.smesh import smeshBuilder
11 smesh = smeshBuilder.New()
13 OX = geompy.MakeVectorDXDYDZ(1,0,0)
14 OY = geompy.MakeVectorDXDYDZ(0,1,0)
15 OZ = geompy.MakeVectorDXDYDZ(0,0,1)
17 # Y ^ Make geometry of a "pipe" with the following base (cross section).
18 # | Big central quadrangles will be meshed with triangles, walls
19 # of the pipe will be meshed with quadrilaterals
32 # +--+--+--+--+--+--+ X
34 quadBig = geompy.MakeFaceHW( 20,20, 1 )
35 quadBig = geompy.MakeTranslation( quadBig, 15,15,0 )
36 quadSmall = geompy.MakeFaceHW( 10,10, 1 )
37 smallQuads1 = geompy.MakeMultiTranslation1D( quadSmall, OX, 10, 3 )
38 smallQuads2 = geompy.MakeMultiTranslation1D( quadSmall, OY, 10, 3 )
39 smallQuads2 = geompy.SubShapeAllSortedCentres( smallQuads2, geompy.ShapeType["FACE"])[1:]
41 base = geompy.MakeCompound( smallQuads2 + [smallQuads1, quadBig])
42 axis = geompy.MakeLine( geompy.MakeVertex( 25,25,0), OZ )
43 base = geompy.MultiRotate1DNbTimes( base, axis, 4)
44 base = geompy.MakePartition( [base], theName="base")
45 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])
47 # Make the pipe, each quadrangle of the base turns into a prism with composite wall faces
48 pipe = geompy.MakePipe( base, path )
49 prisms = geompy.MakePartition( [pipe], theName="prisms")
52 # get base faces of the prism to define sub-mesh on them
53 smallQuad = geompy.GetFaceNearPoint( prisms, geompy.MakeVertex( 0,0,0 ), "smallQuad")
54 bigQuad = geompy.GetFaceNearPoint( prisms, geompy.MakeVertex( 15,15,0 ), "bigQuad")
57 mesh = smesh.Mesh( prisms )
59 # assign Global hypotheses
61 # 1D algorithm and hypothesis for division along the pipe
62 mesh.Segment().NumberOfSegments(15)
67 # assign Local hypotheses
69 # 1D and 2D algos and hyps to mesh smallQuad with quadrilaterals
70 mesh.Segment(smallQuad).LocalLength( 3 )
71 mesh.Quadrangle(smallQuad)
73 # 1D and 2D algos and hyps to mesh bigQuad with triangles
74 mesh.Segment(bigQuad).LocalLength( 3 )
75 mesh.Triangle(bigQuad)