Salome HOME
typo
[modules/smesh.git] / doc / salome / gui / SMESH / input / tui_prism_3d_algo.doc
1 /*!
2
3 \page tui_prism_3d_algo Use 3D extrusion meshing algorithm
4
5 \code
6 import salome, smesh, SMESH, geompy
7
8 salome.salome_init()
9 smesh.SetCurrentStudy( salome.myStudy )
10
11 OX = geompy.MakeVectorDXDYDZ(1,0,0)
12 OY = geompy.MakeVectorDXDYDZ(0,1,0)
13 OZ = geompy.MakeVectorDXDYDZ(0,0,1)
14
15 #  Y ^       Make geometry of a "pipe" with the following base (cross section).
16 #    |       Big central quadrangles will be meshed with triangles, walls
17 #                         of the pipe will be meshed with quadrilaterals
18 #   +--+--+--+--+--+--+
19 #   |  |  |  |  |  |  |
20 #   +--+--+--+--+--+--+
21 #   |  |     |     |  |
22 #   +--+     |     +--+
23 #   |  |     |     |  |
24 #   +--+-----+-----+--+
25 #   |  |     |     |  |
26 #   +--+     |     +--+
27 #   |  |     |     |  |
28 #   +--+--+--+--+--+--+
29 #   |  |  |  |  |  |  |  -->
30 #   +--+--+--+--+--+--+   X
31
32 quadBig   = geompy.MakeFaceHW( 20,20, 1 )
33 quadBig   = geompy.MakeTranslation( quadBig, 15,15,0 )
34 quadSmall = geompy.MakeFaceHW( 10,10, 1 )
35 smallQuads1 = geompy.MakeMultiTranslation1D( quadSmall, OX, 10, 3 )
36 smallQuads2 = geompy.MakeMultiTranslation1D( quadSmall, OY, 10, 3 )
37 smallQuads2 = geompy.SubShapeAllSortedCentres( smallQuads2, geompy.ShapeType["FACE"])[1:]
38
39 base = geompy.MakeCompound( smallQuads2 + [smallQuads1, quadBig])
40 axis = geompy.MakeLine( geompy.MakeVertex( 25,25,0), OZ )
41 base = geompy.MultiRotate1DNbTimes( base, axis, 4)
42 base = geompy.MakePartition( [base], theName="base")
43 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])
44
45 # Make the pipe, each quadrangle of the base turns into a prism with composite wall faces
46 pipe   = geompy.MakePipe( base, path )
47 prisms = geompy.MakePartition( [pipe], theName="prisms")
48
49
50 # get base faces of the prism to define sub-mesh on them
51 smallQuad = geompy.GetFaceNearPoint( prisms, geompy.MakeVertex( 0,0,0 ), "smallQuad")
52 bigQuad   = geompy.GetFaceNearPoint( prisms, geompy.MakeVertex( 15,15,0 ), "bigQuad")
53
54
55 mesh = smesh.Mesh( prisms )
56
57 # vertical division
58 mesh.Segment().NumberOfSegments(15)
59
60 # Extrusion 3D algo
61 mesh.Prism()
62
63 # mesh smallQuad with quadrilaterals
64 mesh.Segment(smallQuad).LocalLength( 3 )
65 mesh.Quadrangle(smallQuad)
66
67 # mesh bigQuad with triangles
68 mesh.Segment(bigQuad).LocalLength( 3 )
69 mesh.Triangle(bigQuad)
70
71 mesh.Compute()
72
73 \endcode
74
75 The result mesh is shown below
76 \image html prism_tui_sample.png
77
78 */