1 # Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/
20 # CEA/LGLS 2004-2005, Francis KLOSS (OCC)
21 # =======================================
32 # A centered holed cube build by build by points, edges, faces and solids
50 basePoint111 = MakeVertex(ox , oy, oz)
51 basePoint211 = MakeVertex(ox+longueur, oy, oz)
52 basePoint112 = MakeVertex(ox , oy, oz+largeur)
53 basePoint212 = MakeVertex(ox+longueur, oy, oz+largeur)
61 dx = rayon/math.sqrt(1+ll)
62 dz = rayon/math.sqrt(1+1/ll)
64 circlePoint1 = MakeVertex(cx-dx, cy, cz-dz)
65 circlePoint2 = MakeVertex(cx+dx, cy, cz-dz)
66 circlePoint3 = MakeVertex(cx+dx, cy, cz+dz)
67 circlePoint4 = MakeVertex(cx-dx, cy, cz+dz)
72 squareEdge1 = MakeEdge(basePoint111, basePoint211)
73 squareEdge2 = MakeEdge(basePoint211, basePoint212)
74 squareEdge3 = MakeEdge(basePoint212, basePoint112)
75 squareEdge4 = MakeEdge(basePoint112, basePoint111)
77 diagEdge1 = MakeEdge(basePoint111, circlePoint1)
78 diagEdge2 = MakeEdge(basePoint211, circlePoint2)
79 diagEdge3 = MakeEdge(basePoint212, circlePoint3)
80 diagEdge4 = MakeEdge(basePoint112, circlePoint4)
82 arcEdge1 = MakeArc(circlePoint1, MakeVertex(cx , cy, cz-rayon), circlePoint2)
83 arcEdge2 = MakeArc(circlePoint2, MakeVertex(cx+rayon, cy, cz ), circlePoint3)
84 arcEdge3 = MakeArc(circlePoint3, MakeVertex(cx , cy, cz+rayon), circlePoint4)
85 arcEdge4 = MakeArc(circlePoint4, MakeVertex(cx-rayon, cy, cz ), circlePoint1)
90 baseFace1 = MakeQuad(squareEdge1, diagEdge2, arcEdge1, diagEdge1)
91 baseFace2 = MakeQuad(squareEdge2, diagEdge3, arcEdge2, diagEdge2)
92 baseFace3 = MakeQuad(squareEdge3, diagEdge4, arcEdge3, diagEdge3)
93 baseFace4 = MakeQuad(squareEdge4, diagEdge1, arcEdge4, diagEdge4)
98 baseVector = MakeVectorDXDYDZ(0, 1, 0)
100 baseSolid1 = MakePrismVecH(baseFace1, baseVector, hauteur)
101 baseSolid2 = MakePrismVecH(baseFace2, baseVector, hauteur)
102 baseSolid3 = MakePrismVecH(baseFace3, baseVector, hauteur)
103 baseSolid4 = MakePrismVecH(baseFace4, baseVector, hauteur)
109 c_l.append(baseSolid1)
110 c_l.append(baseSolid2)
111 c_l.append(baseSolid3)
112 c_l.append(baseSolid4)
114 c_cpd = MakeCompound(c_l)
115 piece = MakeGlueFaces(c_cpd, 1.e-5)
120 piece_id = addToStudy(piece, "ex05_hole1build")
125 # Create a hexahedral mesh
126 # ------------------------
128 hexa = smesh.Mesh(piece, "ex05_hole1build:hexa")
130 algo = hexa.Segment()
132 algo.NumberOfSegments(6, 3)