1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2008 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
23 # GEOM GEOM_SWIG : binding of C++ omplementaion with Python
24 # File : GEOM_Partition1.py
27 # import alveole_3D_01_GEOM
28 # reload(alveole_3D_01_GEOM)
29 # -- Rayon de la bariere
32 barier_radius = 5.6 / 2 # Rayon de la bariere
33 colis_radius = 1.0 / 2 # Rayon du colis
34 colis_step = 2.0 # Distance s
\89parant deux colis
35 cc_width = 0.11 # Epaisseur du complement de colisage
39 cc_radius = colis_radius + cc_width
41 colis_center = sqrt(2.0)*colis_step/2
55 pnt0 = geompy.MakeVertex(0.,0.,0.)
56 vecz = geompy.MakeVectorDXDYDZ(0.,0.,1.)
58 barier = geompy.MakeCylinder(
66 colis = geompy.MakeCylinder(pnt0, vecz, colis_radius, barier_height)
68 cc = geompy.MakeCylinder(pnt0, vecz, cc_radius, barier_height)
70 colis_cc = geompy.MakeCompound([colis, cc])
72 colis_cc = geompy.MakeTranslation(colis_cc, colis_center, 0.0, 0.0)
74 colis_cc_multi = geompy.MultiRotate1D(colis_cc, vecz, 4)
78 Compound1 = geompy.MakeCompound([colis_cc_multi, barier])
79 SubShape_theShape = geompy.SubShapeAll(Compound1,geompy.ShapeType["SOLID"])
80 alveole = geompy.MakePartition(SubShape_theShape)
81 #alveole = geompy.MakePartition([colis_cc_multi, barier])
83 geompy.addToStudy(alveole, "alveole before explode")
85 subshapes = geompy.SubShapeAll(alveole, geompy.ShapeType["SHAPE"])
87 ## there are 9 subshapes
89 comp1 = geompy.MakeCompound([subshapes[0], subshapes[1]]);
90 comp2 = geompy.MakeCompound([subshapes[2], subshapes[3]]);
91 comp3 = geompy.MakeCompound([subshapes[4], subshapes[5]]);
92 comp4 = geompy.MakeCompound([subshapes[6], subshapes[7]]);
95 compGOs.append(comp1);
96 compGOs.append(comp2);
97 compGOs.append(comp3);
98 compGOs.append(comp4);
99 comp = geompy.MakeCompound(compGOs);
101 alveole = geompy.MakeCompound([comp, subshapes[8]]);
103 geompy.addToStudy(alveole, "alveole")