Salome HOME
merge V7_7_BR
[modules/smesh.git] / doc / salome / examples / split_biquad.py
1 # Split bi-quadratic to linear
2
3 import salome
4 salome.salome_init()
5
6 from salome.geom import geomBuilder
7 geompy = geomBuilder.New(salome.myStudy)
8
9 from salome.smesh import smeshBuilder
10 smesh = smeshBuilder.New(salome.myStudy)
11
12 # make a shape consisting of two quadranges
13 OY  = geompy.MakeVectorDXDYDZ(0, 1, 0)
14 OY1 = geompy.MakeTranslation( OY, 1, 0, 0 )
15 OY2 = geompy.MakeTranslation( OY, 2, 0, 0 )
16 q1  = geompy.MakeQuad2Edges( OY, OY1 )
17 q2  = geompy.MakeQuad2Edges( OY1, OY2 )
18
19 shape = geompy.Partition( [q1,q2], theName='shape' )
20 ff    = geompy.SubShapeAll( shape, geompy.ShapeType["FACE"], theName="quad" )
21
22 # mesh one quadrange with quadrangless and the other with triangles
23 mesh = smesh.Mesh( shape )
24 mesh.Segment().NumberOfSegments(1)
25 mesh.Quadrangle()
26 mesh.Triangle( ff[1] )
27 mesh.Compute()
28
29 # make group of quadrangles and extrude them into a hexahedron
30 quadGroup = mesh.Group( ff[0], "quads")
31 mesh.ExtrusionSweepObject2D( quadGroup, [0,0,1], 1 )
32
33 # make the mesh bi-quadratic
34 mesh.ConvertToQuadratic( theToBiQuad=True )
35
36 # split all elements into linear ones
37 mesh.SplitBiQuadraticIntoLinear()