Salome HOME
Implementation of PipeWithShellSections.
[modules/geom.git] / src / GEOM_SWIG / GEOM_Partition1.py
index 287aed8955c2e2b7dbc3e2da5a02262892223d7f..bc8e4c138fd3dd5bc31d64f98fd6d0636ee5aa56 100755 (executable)
@@ -1,5 +1,29 @@
+#  Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+#  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+#  GEOM GEOM_SWIG : binding of C++ omplementaion with Python
+#
+#  File   : GEOM_Partition1.py
+#  Module : GEOM
+
 #%Make geometry (like CEA script (A1)) using Partition algorithm%
-# appel: 
+# appel:
 # import alveole_3D_01_GEOM
 # reload(alveole_3D_01_GEOM)
 
@@ -29,61 +53,52 @@ boolean_section = 4
 
 # --
 
+pnt0 = geompy.MakeVertex(0.,0.,0.)
+vecz = geompy.MakeVectorDXDYDZ(0.,0.,1.)
+
 barier = geompy.MakeCylinder(
-    geom.MakePointStruct(0.,0.,0.),
-    geom.MakeDirection(geom.MakePointStruct(0.,0.,1.)),
+    pnt0,
+    vecz,
     barier_radius,
     barier_height)
 
 # --
 
-colis = geompy.MakeCylinder(
-    geom.MakePointStruct(0.,0.,0.),
-    geom.MakeDirection(geom.MakePointStruct(0.,0.,1.)),
-    colis_radius,
-    barier_height)
+colis = geompy.MakeCylinder(pnt0, vecz, colis_radius, barier_height)
 
-cc = geompy.MakeCylinder(
-    geom.MakePointStruct(0.,0.,0.),
-    geom.MakeDirection(geom.MakePointStruct(0.,0.,1.)),
-    cc_radius,
-    barier_height)
+cc = geompy.MakeCylinder(pnt0, vecz, cc_radius, barier_height)
 
-colis_cc = geompy.MakeCompound(
-    [colis._get_Name(), cc._get_Name()])
+colis_cc = geompy.MakeCompound([colis, cc])
 
-colis_cc = geompy.MakeTranslation(
-    colis_cc, colis_center, 0.0, 0.0)
+colis_cc = geompy.MakeTranslation(colis_cc, colis_center, 0.0, 0.0)
 
-colis_cc_multi = geompy.MakeMultiRotation1D(
-    colis_cc,
-    geom.MakeDirection(geom.MakePointStruct(0.,0.,1.)),
-    geom.MakePointStruct(0.,0.,0.),
-    4)
+colis_cc_multi = geompy.MultiRotate1D(colis_cc, vecz, 4)
 
 # --
 
-alveole = geompy.Partition(
-    [colis_cc_multi._get_Name(), barier._get_Name()])
+Compound1 = geompy.MakeCompound([colis_cc_multi, barier])
+SubShape_theShape = geompy.SubShapeAll(Compound1,geompy.ShapeType["SOLID"])
+alveole = geompy.MakePartition(SubShape_theShape)
+#alveole = geompy.MakePartition([colis_cc_multi, barier])
 
-subshapes = geompy.SubShapeAll( alveole, geompy.ShapeType["SHAPE"] )
+geompy.addToStudy(alveole, "alveole before explode")
 
-## there are 9 subshapes
+subshapes = geompy.SubShapeAll(alveole, geompy.ShapeType["SHAPE"])
 
-comp1 = geompy.MakeCompound( [ subshapes[0]._get_Name(), subshapes[1]._get_Name() ] );
-comp2 = geompy.MakeCompound( [ subshapes[2]._get_Name(), subshapes[3]._get_Name() ] );
-comp3 = geompy.MakeCompound( [ subshapes[4]._get_Name(), subshapes[5]._get_Name() ] );
-comp4 = geompy.MakeCompound( [ subshapes[6]._get_Name(), subshapes[7]._get_Name() ] );
+## there are 9 subshapes
 
-compIORs = []
-compIORs.append( comp1._get_Name() );
-compIORs.append( comp2._get_Name() );
-compIORs.append( comp3._get_Name() );
-compIORs.append( comp4._get_Name() );
-comp = geompy.MakeCompound( compIORs );
+comp1 = geompy.MakeCompound([subshapes[0], subshapes[1]]);
+comp2 = geompy.MakeCompound([subshapes[2], subshapes[3]]);
+comp3 = geompy.MakeCompound([subshapes[4], subshapes[5]]);
+comp4 = geompy.MakeCompound([subshapes[6], subshapes[7]]);
 
-alveole = geompy.MakeCompound( [ comp._get_Name(), subshapes[8]._get_Name() ]);
-       
-geompy.addToStudy(alveole, "alveole")
+compGOs = []
+compGOs.append(comp1);
+compGOs.append(comp2);
+compGOs.append(comp3);
+compGOs.append(comp4);
+comp = geompy.MakeCompound(compGOs);
 
+alveole = geompy.MakeCompound([comp, subshapes[8]]);
 
+geompy.addToStudy(alveole, "alveole")