Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/geom.git] / src / GEOM_SWIG / PAL_MESH_030_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              : 17/02/2005
22 #  Author               : Alexander KOVALEV
23 #  GUI test scenario    : PAL-MESH-030_geometry
24 #============================================================================== 
25
26 import salome
27 import geompy
28
29 # Stage 2: "Creation of geometry"
30
31 # (2.1) Creating a box
32 Box_1 = geompy.MakeBoxDXDYDZ(200, 400, 300)
33 # (2.8) Exploding Box_1 to vertices and faces
34 Box_1_vertices = geompy.SubShapeAll(Box_1, geompy.ShapeType["VERTEX"])
35 Box_1_faces = geompy.SubShapeAll(Box_1, geompy.ShapeType["FACE"])
36 # (2.17) Creating a new points
37 Vertex_9 = geompy.MakeVertex(200, 200, 50)
38 Vertex_10 = geompy.MakeVertex(150, 300, 80)
39 # (2.26) Translation of the faces 
40 Face_translated = []
41 Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[2], Box_1_vertices[5], Vertex_9))
42 Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[5], Vertex_9, Vertex_10))
43 Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[2], Vertex_10, Vertex_9))
44 Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[3], Box_1_vertices[5], Vertex_9))
45 Face_translated.append(geompy.MakeTranslationTwoPoints(Face_translated[1], Vertex_9, Vertex_10))
46 # (2.49) Building a Compound_1
47 ShapeListCompound_1 = []
48 i = 0
49 while i < 5 :
50     ShapeListCompound_1.append(Face_translated[i])
51     i = i + 1
52 Compound_1 = geompy.MakeCompound(ShapeListCompound_1)
53 # (2.54) Exploding of Compound_1 to faces
54 Compound_1_faces = geompy.SubShapeAll(Compound_1, geompy.ShapeType["FACE"])
55 # (2.54) Exploding of Face_translated_2 to vertices
56 Face_translated_2_vertices = geompy.SubShapeAll(Face_translated[1], geompy.ShapeType["VERTEX"])
57 # (2.62) Creating two boxes
58 Box_1 = geompy.MakeBoxTwoPnt(Vertex_9, Face_translated_2_vertices[1])
59 Box_2 = geompy.MakeBoxTwoPnt(Vertex_10, Face_translated_2_vertices[0])
60 # (2.70) Building Compound_2
61 ShapeListCompound_2 = []
62 ShapeListCompound_2.append(Box_1)
63 ShapeListCompound_2.append(Box_2)
64 Compound_2 = geompy.MakeCompound(ShapeListCompound_2)
65 # (2.75) Exploding of Compound_2 to solids
66 Compound_2_solids = geompy.SubShapeAll(Compound_2, geompy.ShapeType["SOLID"])
67
68 # Adding to study of geometrical objects
69 id_Compound_1 = geompy.addToStudy(Compound_1, "Compound_1")
70 id_Face_1 = geompy.addToStudyInFather(Compound_1,Compound_1_faces[0], "Face_1")
71 id_Face_5 = geompy.addToStudyInFather(Compound_1,Compound_1_faces[4], "Face_5")
72 id_Face_4 = geompy.addToStudyInFather(Compound_1,Compound_1_faces[3], "Face_4")
73 id_Compound_2 = geompy.addToStudy(Compound_2, "Compound_2")
74 id_Solid_2 = geompy.addToStudyInFather(Compound_2,Compound_2_solids[1], "Solid_2")
75
76 salome.sg.updateObjBrowser(1)