1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
4 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License.
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 # =======================================
35 # A centered holed cube build by build by points, edges, faces and solids
53 basePoint111 = MakeVertex(ox , oy, oz)
54 basePoint211 = MakeVertex(ox+longueur, oy, oz)
55 basePoint112 = MakeVertex(ox , oy, oz+largeur)
56 basePoint212 = MakeVertex(ox+longueur, oy, oz+largeur)
64 dx = rayon/math.sqrt(1+ll)
65 dz = rayon/math.sqrt(1+1/ll)
67 circlePoint1 = MakeVertex(cx-dx, cy, cz-dz)
68 circlePoint2 = MakeVertex(cx+dx, cy, cz-dz)
69 circlePoint3 = MakeVertex(cx+dx, cy, cz+dz)
70 circlePoint4 = MakeVertex(cx-dx, cy, cz+dz)
75 squareEdge1 = MakeEdge(basePoint111, basePoint211)
76 squareEdge2 = MakeEdge(basePoint211, basePoint212)
77 squareEdge3 = MakeEdge(basePoint212, basePoint112)
78 squareEdge4 = MakeEdge(basePoint112, basePoint111)
80 diagEdge1 = MakeEdge(basePoint111, circlePoint1)
81 diagEdge2 = MakeEdge(basePoint211, circlePoint2)
82 diagEdge3 = MakeEdge(basePoint212, circlePoint3)
83 diagEdge4 = MakeEdge(basePoint112, circlePoint4)
85 arcEdge1 = MakeArc(circlePoint1, MakeVertex(cx , cy, cz-rayon), circlePoint2)
86 arcEdge2 = MakeArc(circlePoint2, MakeVertex(cx+rayon, cy, cz ), circlePoint3)
87 arcEdge3 = MakeArc(circlePoint3, MakeVertex(cx , cy, cz+rayon), circlePoint4)
88 arcEdge4 = MakeArc(circlePoint4, MakeVertex(cx-rayon, cy, cz ), circlePoint1)
93 baseFace1 = MakeQuad(squareEdge1, diagEdge2, arcEdge1, diagEdge1)
94 baseFace2 = MakeQuad(squareEdge2, diagEdge3, arcEdge2, diagEdge2)
95 baseFace3 = MakeQuad(squareEdge3, diagEdge4, arcEdge3, diagEdge3)
96 baseFace4 = MakeQuad(squareEdge4, diagEdge1, arcEdge4, diagEdge4)
101 baseVector = MakeVectorDXDYDZ(0, 1, 0)
103 baseSolid1 = MakePrismVecH(baseFace1, baseVector, hauteur)
104 baseSolid2 = MakePrismVecH(baseFace2, baseVector, hauteur)
105 baseSolid3 = MakePrismVecH(baseFace3, baseVector, hauteur)
106 baseSolid4 = MakePrismVecH(baseFace4, baseVector, hauteur)
112 c_l.append(baseSolid1)
113 c_l.append(baseSolid2)
114 c_l.append(baseSolid3)
115 c_l.append(baseSolid4)
117 c_cpd = MakeCompound(c_l)
118 piece = MakeGlueFaces(c_cpd, 1.e-5)
123 piece_id = addToStudy(piece, "ex05_hole1build")
128 smesh.SetCurrentStudy(salome.myStudy)
130 # Create a hexahedral mesh
131 # ------------------------
133 hexa = smesh.Mesh(piece, "ex05_hole1build:hexa")
135 algo = hexa.Segment()
137 algo.NumberOfSegments(6, 3)