]> SALOME platform Git repositories - modules/smesh.git/blob - src/SMESH_SWIG/ex02_cube2primitive.py
Salome HOME
PAL10872. Image for aspect ratio of a quadrangle
[modules/smesh.git] / src / SMESH_SWIG / ex02_cube2primitive.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 # A small cube centered and put on a great cube build by primitive geometric functionalities
12
13 # Values
14 # ------
15
16 ox = 0
17 oy = 0
18 oz = 0
19
20 arete = 10
21
22 # Points
23 # ------
24
25 blockPoint111 = MakeVertex(ox      , oy, oz)
26 blockPoint211 = MakeVertex(ox+arete, oy, oz)
27 blockPoint112 = MakeVertex(ox      , oy, oz+arete)
28 blockPoint212 = MakeVertex(ox+arete, oy, oz+arete)
29
30 # Face and solid
31 # --------------
32
33 blockFace1 = MakeQuad4Vertices(blockPoint111, blockPoint211, blockPoint212, blockPoint112)
34
35 blockSolid11  = MakePrismVecH(blockFace1, MakeVectorDXDYDZ(0, 1, 0), arete)
36
37 # Translations
38 # ------------
39
40 blockSolid21  = MakeTranslation(blockSolid11, arete, 0, 0)
41 blockSolid31  = MakeTranslation(blockSolid21, arete, 0, 0)
42
43 blockSolid12  = MakeTranslation(blockSolid11, 0, 0, arete)
44 blockSolid22  = MakeTranslation(blockSolid12, arete, 0, 0)
45 blockSolid32  = MakeTranslation(blockSolid22, arete, 0, 0)
46
47 blockSolid13  = MakeTranslation(blockSolid12, 0, 0, arete)
48 blockSolid23  = MakeTranslation(blockSolid13, arete, 0, 0)
49 blockSolid33  = MakeTranslation(blockSolid23, arete, 0, 0)
50
51 blockSolid111 = MakeTranslation(blockSolid22, 0, arete, 0)
52
53 # Compound and glue
54 # -----------------
55
56 c_l = []
57 c_l.append(blockSolid11)
58 c_l.append(blockSolid21)
59 c_l.append(blockSolid31)
60 c_l.append(blockSolid12)
61 c_l.append(blockSolid22)
62 c_l.append(blockSolid32)
63 c_l.append(blockSolid13)
64 c_l.append(blockSolid23)
65 c_l.append(blockSolid33)
66 c_l.append(blockSolid111)
67
68 c_cpd = MakeCompound(c_l)
69
70 piece = MakeGlueFaces(c_cpd, 1.e-5)
71
72 # Add in study
73 # ------------
74
75 piece_id = addToStudy(piece, "ex02_cube2primitive")
76
77 # Meshing
78 # =======
79
80 # Create hexahedrical mesh on piece
81 # ---------------------------------
82
83 hexa = smesh.Mesh(piece, "ex02_cube2primitive:hexa")
84
85 algo = hexa.Segment()
86 algo.LocalLength(1)
87
88 hexa.Quadrangle()
89
90 hexa.Hexahedron()
91
92 # Compute the mesh
93 # ----------------
94
95 hexa.Compute()