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 # =======================================
30 # A not centered holed cube build by boolean geometric operations
52 def triangle(p1, p2, p3):
54 l.append(MakeEdge(p1, p2))
55 l.append(MakeEdge(p2, p3))
56 l.append(MakeEdge(p3, p1))
63 basePoint111 = MakeVertex(ox-longueur1, oy, oz-largeur1)
64 basePoint211 = MakeVertex(ox+longueur2, oy, oz-largeur1)
65 basePoint112 = MakeVertex(ox-longueur1, oy, oz+largeur2)
66 basePoint212 = MakeVertex(ox+longueur2, oy, oz+largeur2)
68 holePoint = MakeVertex(ox, oy, oz)
73 baseFace1 = triangle(basePoint111, basePoint211, holePoint)
74 baseFace2 = triangle(basePoint211, basePoint212, holePoint)
75 baseFace3 = triangle(basePoint212, basePoint112, holePoint)
76 baseFace4 = triangle(basePoint112, basePoint111, holePoint)
81 baseVector = MakeVectorDXDYDZ(0, 1, 0)
83 baseSolid1 = MakePrismVecH(baseFace1, baseVector, hauteur)
84 baseSolid2 = MakePrismVecH(baseFace2, baseVector, hauteur)
85 baseSolid3 = MakePrismVecH(baseFace3, baseVector, hauteur)
86 baseSolid4 = MakePrismVecH(baseFace4, baseVector, hauteur)
88 holeSolid = MakeCylinder(holePoint, baseVector, rayon, hauteur)
93 baseHexa1 = MakeCut(baseSolid1, holeSolid)
94 baseHexa2 = MakeCut(baseSolid2, holeSolid)
95 baseHexa3 = MakeCut(baseSolid3, holeSolid)
96 baseHexa4 = MakeCut(baseSolid4, holeSolid)
98 # Compound, glue and repair
99 # -------------------------
102 c_l.append(baseHexa1)
103 c_l.append(baseHexa2)
104 c_l.append(baseHexa3)
105 c_l.append(baseHexa4)
107 c_cpd = MakeCompound(c_l)
108 c_glu = MakeGlueFaces(c_cpd, 1.e-5)
109 piece = RemoveExtraEdges(c_glu)
114 piece_id = addToStudy(piece, "ex06_hole1boolean")
119 # Create a hexahedral mesh
120 # ------------------------
122 hexa = smesh.Mesh(piece, "ex06_hole1boolean:hexa")
124 algo = hexa.Segment()
126 algo.NumberOfSegments(11)
132 # Create local hypothesis
133 # -----------------------
135 edge1 = GetEdgeNearPoint(piece, MakeVertex(ox, oy, oz-largeur1))
136 algo1 = hexa.Segment(edge1)
137 algo1.NumberOfSegments(3)
140 edge2 = GetEdgeNearPoint(piece, MakeVertex(ox-longueur1, oy, oz))
141 algo2 = hexa.Segment(edge2)
142 algo2.NumberOfSegments(5)
145 edge3 = GetEdgeNearPoint(piece, MakeVertex(ox, oy, oz+largeur2))
146 algo3 = hexa.Segment(edge3)
147 algo3.NumberOfSegments(7)
150 edge4 = GetEdgeNearPoint(piece, MakeVertex(ox+longueur2, oy, oz))
151 algo4 = hexa.Segment(edge4)
152 algo4.NumberOfSegments(9)