Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/geom.git] / src / GEOM_SWIG / PAL_MESH_035_geometry.py
1 #  Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 #
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.
8 #
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.
13 #
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
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20 #####################################################################
21 #Created                :15/02/2005
22 #Auhtor                 :KOVALTCHUK Alexey 
23 #GUI test scenario      :PAL-MESH-035 (geometry part)
24 #####################################################################
25
26 import geompy
27 import salome
28
29 #Box creation (2.2)
30 Box_1 = geompy.MakeBoxDXDYDZ(200, 400, 300)
31 geompy.addToStudy(Box_1, "Box_1")
32
33 #Cylinder creation (2.8)
34 Cylinder_1 = geompy.MakeCylinderRH(100, 300)
35 geompy.addToStudy(Cylinder_1, "Cylinder_1")
36
37 #Cone creation (2.13)
38 Cone_1 = geompy.MakeConeR1R2H(100, 50, 200)
39 geompy.addToStudy(Cone_1, "Cone_1")
40
41 #Explode box, cone and cylinder on faces and vertices(2.18)
42 ListOfFaces_Box_1 = geompy.SubShapeAll(Box_1, geompy.ShapeType["FACE"])
43 NbExplodedFaces_Box_1 = len(ListOfFaces_Box_1)
44 for i in range (0, NbExplodedFaces_Box_1):
45    name = "Face_" + str(i+1)
46    geompy.addToStudyInFather(Box_1, ListOfFaces_Box_1[i], name)
47
48 ListOfVertices_Box_1 = geompy.SubShapeAll(Box_1, geompy.ShapeType["VERTEX"])
49 NbExplodedVertices_Box_1 = len(ListOfVertices_Box_1)
50 for i in range (0, NbExplodedVertices_Box_1):
51    name = "Vertex_" + str(i+1)
52    geompy.addToStudyInFather(Box_1, ListOfVertices_Box_1[i], name)
53    
54 ListOfFaces_Cylinder_1 = geompy.SubShapeAll(Cylinder_1, geompy.ShapeType["FACE"])
55 NbExplodedFaces_Cylinder_1 = len(ListOfFaces_Cylinder_1)
56 for i in range (0, NbExplodedFaces_Cylinder_1):
57    name = "Face_" + str(NbExplodedFaces_Box_1+i+1)
58    geompy.addToStudyInFather(Cylinder_1, ListOfFaces_Cylinder_1[i], name)
59    
60 ListOfFaces_Cone_1 = geompy.SubShapeAll(Cone_1, geompy.ShapeType["FACE"])
61 NbExplodedFaces_Cone_1 = len(ListOfFaces_Cone_1)
62 for i in range (0, NbExplodedFaces_Cone_1):
63    name = "Face_" + str(NbExplodedFaces_Box_1+NbExplodedFaces_Cylinder_1+i+1)
64    geompy.addToStudyInFather(Cone_1, ListOfFaces_Cone_1[i], name)
65    
66 #Plane creation (2.32)
67 Plane_1 = geompy.MakePlaneThreePnt(ListOfVertices_Box_1[0], ListOfVertices_Box_1[1], ListOfVertices_Box_1[3], 600)
68 geompy.addToStudy(Plane_1, "Plane_1")
69
70 #Partition (2.32)
71 compound = geompy.MakeCompound([ListOfFaces_Cylinder_1[0], ListOfFaces_Cone_1[0]])
72 Partition_1 = geompy.MakeHalfPartition(compound, Plane_1)
73 geompy.addToStudy(Partition_1, "Partition_1")
74
75 #Explode partition on faces and vertices(2.38)
76 ListOfFaces_Partition_1 = geompy.SubShapeAll(Partition_1, geompy.ShapeType["FACE"])
77 NbExplodedFaces_Partition_1 = len(ListOfFaces_Partition_1)
78 for i in range (0, NbExplodedFaces_Partition_1):
79    name = "Face_" + str(NbExplodedFaces_Box_1+NbExplodedFaces_Cylinder_1+NbExplodedFaces_Cone_1+i+1)
80    geompy.addToStudyInFather(Partition_1, ListOfFaces_Partition_1[i], name)
81
82 #Explode faces on vertices(2.43)
83 ListOfVertices_Face_7 = geompy.SubShapeAll(ListOfFaces_Cylinder_1[0], geompy.ShapeType["VERTEX"])
84 NbExplodedVertices_Face_7 = len(ListOfVertices_Face_7)
85 for i in range (0, NbExplodedVertices_Face_7):
86    name = "Vertex_" + str(NbExplodedVertices_Box_1+i+1)
87    geompy.addToStudyInFather(ListOfFaces_Cylinder_1[0], ListOfVertices_Face_7[i], name)
88
89 ListOfVertices_Face_10 = geompy.SubShapeAll(ListOfFaces_Cone_1[0], geompy.ShapeType["VERTEX"])
90 NbExplodedVertices_Face_10 = len(ListOfVertices_Face_10)
91 for i in range (0, NbExplodedVertices_Face_10):
92    name = "Vertex_" + str(NbExplodedVertices_Box_1+NbExplodedVertices_Face_7+i+1)
93    geompy.addToStudyInFather(ListOfFaces_Cone_1[0], ListOfVertices_Face_10[i], name)
94
95 ListOfVertices_Face_15 = geompy.SubShapeAll(ListOfFaces_Partition_1[2], geompy.ShapeType["VERTEX"])
96 NbExplodedVertices_Face_15 = len(ListOfVertices_Face_15)
97 for i in range (0, NbExplodedVertices_Face_15):
98    name = "Vertex_" + str(NbExplodedVertices_Box_1+NbExplodedVertices_Face_7+NbExplodedVertices_Face_10+i+1)
99    geompy.addToStudyInFather(ListOfFaces_Partition_1[2], ListOfVertices_Face_15[i], name)
100
101 ListOfVertices_Face_18 = geompy.SubShapeAll(ListOfFaces_Partition_1[NbExplodedFaces_Partition_1-1], geompy.ShapeType["VERTEX"])
102 NbExplodedVertices_Face_18 = len(ListOfVertices_Face_18)
103 for i in range (0, NbExplodedVertices_Face_18):
104    name = "Vertex_" + str(NbExplodedVertices_Box_1+NbExplodedVertices_Face_7+NbExplodedVertices_Face_10+NbExplodedVertices_Face_15+i+1)
105    geompy.addToStudyInFather(ListOfFaces_Partition_1[NbExplodedFaces_Partition_1-1], ListOfVertices_Face_18[i], name)
106
107 salome.sg.updateObjBrowser(1)