Salome HOME
bos #29171 Refactor testing procedure
[modules/smesh.git] / doc / examples / split_biquad.py
1 # Split bi-quadratic to linear
2
3 import salome
4 salome.salome_init_without_session()
5
6 from salome.geom import geomBuilder
7 from salome.smesh import smeshBuilder
8
9 geom_builder = geomBuilder.New()
10 smesh_builder = smeshBuilder.New()
11
12 # make a shape consisting of two quadranges
13 OY  = geom_builder.MakeVectorDXDYDZ(0, 1, 0)
14 OY1 = geom_builder.MakeTranslation( OY, 1, 0, 0 )
15 OY2 = geom_builder.MakeTranslation( OY, 2, 0, 0 )
16 q1  = geom_builder.MakeQuad2Edges( OY, OY1 )
17 q2  = geom_builder.MakeQuad2Edges( OY1, OY2 )
18
19 shape = geom_builder.Partition( [q1,q2], theName='shape' )
20 ff    = geom_builder.SubShapeAll( shape, geom_builder.ShapeType["FACE"], theName="quad" )
21
22 # mesh one quadrange with quadrangless and the other with triangles
23 mesh = smesh_builder.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()