]> SALOME platform Git repositories - modules/smesh.git/blob - src/SMESH_SWIG/ex08_hole2build.py
Salome HOME
PAL10872. Image for aspect ratio of a quadrangle
[modules/smesh.git] / src / SMESH_SWIG / ex08_hole2build.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 twice holed cube build by points, edges, faces and solids
12
13 # Values
14 # ------
15
16 ox = 0
17 oy = 0
18 oz = 0
19
20 longueur = 200
21 largeur  = 100
22 hauteur  =  80
23
24 cylindre = 50
25
26 rayon = 20
27
28 # Points
29 # ------
30
31 piecePoint1 = MakeVertex(ox         , oy, oz)
32 piecePoint2 = MakeVertex(ox+longueur, oy, oz)
33 piecePoint3 = MakeVertex(ox+longueur, oy, oz+largeur)
34 piecePoint4 = MakeVertex(ox         , oy, oz+largeur)
35
36 cz = oz+largeur/2
37
38 cylPoint1    = MakeVertex(ox+cylindre         , oy, cz-rayon)
39 cylPoint2    = MakeVertex(ox+longueur-cylindre, oy, cz-rayon)
40 cylPoint3    = MakeVertex(ox+longueur-cylindre, oy, cz+rayon)
41 cylPoint4    = MakeVertex(ox+cylindre         , oy, cz+rayon)
42
43 # Edges
44 # -----
45
46 pieceEdge1 = MakeEdge(piecePoint1, piecePoint4)
47 pieceEdge2 = MakeEdge(piecePoint1, cylPoint1)
48 pieceEdge3 = MakeEdge(piecePoint4, cylPoint4)
49
50 pieceEdge4 = MakeEdge(piecePoint2, piecePoint3)
51 pieceEdge5 = MakeEdge(piecePoint2, cylPoint2)
52 pieceEdge6 = MakeEdge(piecePoint3, cylPoint3)
53
54 pieceEdge7 = MakeEdge(cylPoint1, cylPoint2)
55 pieceEdge8 = MakeEdge(cylPoint3, cylPoint4)
56
57 cylEdge1 = MakeArc(cylPoint1, MakeVertex(ox+cylindre-rayon         , oy, cz), cylPoint4)
58 cylEdge2 = MakeArc(cylPoint1, MakeVertex(ox+cylindre+rayon         , oy, cz), cylPoint4)
59 cylEdge3 = MakeArc(cylPoint2, MakeVertex(ox+longueur-cylindre-rayon, oy, cz), cylPoint3)
60 cylEdge4 = MakeArc(cylPoint2, MakeVertex(ox+longueur-cylindre+rayon, oy, cz), cylPoint3)
61
62 # Faces
63 # -----
64
65 pieceFace1 = MakeQuad4Vertices(piecePoint1, piecePoint2, cylPoint2 , cylPoint1 )
66 pieceFace2 = MakeQuad         (pieceEdge1 , pieceEdge2 , cylEdge1  , pieceEdge3)
67 pieceFace3 = MakeQuad4Vertices(piecePoint3, piecePoint4, cylPoint4 , cylPoint3 )
68 pieceFace4 = MakeQuad         (pieceEdge4 , pieceEdge5 , cylEdge4  , pieceEdge6)
69 pieceFace5 = MakeQuad         (pieceEdge7 , cylEdge3   , pieceEdge8, cylEdge2  )
70
71 # Solids
72 # ------
73
74 pieceVector = MakeVectorDXDYDZ(0, 1, 0)
75
76 pieceSolid1 = MakePrismVecH(pieceFace1, pieceVector, hauteur)
77 pieceSolid2 = MakePrismVecH(pieceFace2, pieceVector, hauteur)
78 pieceSolid3 = MakePrismVecH(pieceFace3, pieceVector, hauteur)
79 pieceSolid4 = MakePrismVecH(pieceFace4, pieceVector, hauteur)
80 pieceSolid5 = MakePrismVecH(pieceFace5, pieceVector, hauteur)
81
82 # Compound and glue
83 # -----------------
84
85 c_cpd = MakeCompound([pieceSolid1, pieceSolid2, pieceSolid3, pieceSolid4, pieceSolid5])
86
87 piece = MakeGlueFaces(c_cpd, 1.e-5)
88
89 # Add in study
90 # ------------
91
92 piece_id = addToStudy(piece, "ex08_hole2build")
93
94 # Meshing
95 # =======
96
97 # Create a hexahedral mesh
98 # ------------------------
99
100 hexa = smesh.Mesh(piece, "ex08_hole2build:hexa")
101
102 algo = hexa.Segment()
103 algo.NumberOfSegments(7)
104
105 hexa.Quadrangle()
106
107 hexa.Hexahedron()
108
109 # Mesh calculus
110 # -------------
111
112 hexa.Compute()