Salome HOME
Movement of examples to CVS EXAMPLES SAMPLES_SRC.
[modules/smesh.git] / src / SMESH_SWIG / ex10_grid4geometry.py
1 # CEA/LGLS 2004-2005, Francis KLOSS (OCC)
2 # =======================================
3
4 from geompy import *
5
6 import smesh
7
8 # Geometry
9 # ========
10
11 # Element of a grid compound by a square with a cylinder on each vertex build by using partition
12
13 # Values
14 # ------
15
16 ox = 0
17 oy = 0
18 oz = 0
19
20 arete   =  50
21 hauteur = 100
22 rayon   =  10
23
24 g_trim = 1000
25
26 # Box
27 # ---
28
29 piecePoint = MakeVertex(ox, oy, oz)
30
31 pieceBox = MakeBoxTwoPnt(piecePoint, MakeVertex(ox+arete, oy+hauteur, oz+arete))
32
33 # Cut by cylinders
34 # ----------------
35
36 dirUp = MakeVectorDXDYDZ(0, 1, 0)
37
38 pieceCut1 = MakeCut(pieceBox , MakeCylinder(piecePoint                        , dirUp, rayon, hauteur))
39 pieceCut2 = MakeCut(pieceCut1, MakeCylinder(MakeVertex(ox+arete, oy, oz      ), dirUp, rayon, hauteur))
40 pieceCut3 = MakeCut(pieceCut2, MakeCylinder(MakeVertex(ox      , oy, oz+arete), dirUp, rayon, hauteur))
41 pieceCut4 = MakeCut(pieceCut3, MakeCylinder(MakeVertex(ox+arete, oy, oz+arete), dirUp, rayon, hauteur))
42
43 # Compound by make a partition of a solid
44 # ---------------------------------------
45
46 dir = MakeVectorDXDYDZ(-1, 0, 1)
47
48 tools = []
49 tools.append(MakePlane(MakeVertex(ox+rayon, oy, oz      ), dir, g_trim))
50 tools.append(MakePlane(MakeVertex(ox      , oy, oz+rayon), dir, g_trim))
51
52 piece = MakePartition([pieceCut4], tools, [], [], ShapeType["SOLID"])
53
54 # Add in study
55 # ------------
56
57 piece_id = addToStudy(piece, "ex10_grid4geometry")
58
59 # Meshing
60 # =======
61
62 # Create a hexahedral mesh
63 # ------------------------
64
65 hexa = smesh.Mesh(piece, "ex10_grid4geometry:hexa")
66
67 algo = hexa.Segment()
68 algo.NumberOfSegments(10)
69
70 hexa.Quadrangle()
71
72 hexa.Hexahedron()
73
74 # Mesh calculus
75 # -------------
76
77 hexa.Compute()