Salome HOME
c7df14d14e9b37d19aa646341e648948dfae6eaa
[modules/geom.git] / src / GEOM_SWIG / PAL_MESH_030_geometry.py
1 #  -*- coding: iso-8859-1 -*-
2 #  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
3 #
4 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 #
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.
11 #
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.
16 #
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
20 #
21 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #
23 #==============================================================================
24 #  Created              : 17/02/2005
25 #  Author               : Alexander KOVALEV
26 #  GUI test scenario    : PAL-MESH-030_geometry
27 #============================================================================== 
28 #
29 import salome
30 import geompy
31
32 # Stage 2: "Creation of geometry"
33
34 # (2.1) Creating a box
35 Box_1 = geompy.MakeBoxDXDYDZ(200, 400, 300)
36 # (2.8) Exploding Box_1 to vertices and faces
37 Box_1_vertices = geompy.SubShapeAll(Box_1, geompy.ShapeType["VERTEX"])
38 Box_1_faces = geompy.SubShapeAll(Box_1, geompy.ShapeType["FACE"])
39 # (2.17) Creating a new points
40 Vertex_9 = geompy.MakeVertex(200, 200, 50)
41 Vertex_10 = geompy.MakeVertex(150, 300, 80)
42 # (2.26) Translation of the faces 
43 Face_translated = []
44 Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[2], Box_1_vertices[5], Vertex_9))
45 Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[5], Vertex_9, Vertex_10))
46 Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[2], Vertex_10, Vertex_9))
47 Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[3], Box_1_vertices[5], Vertex_9))
48 Face_translated.append(geompy.MakeTranslationTwoPoints(Face_translated[1], Vertex_9, Vertex_10))
49 # (2.49) Building a Compound_1
50 ShapeListCompound_1 = []
51 i = 0
52 while i < 5 :
53     ShapeListCompound_1.append(Face_translated[i])
54     i = i + 1
55 Compound_1 = geompy.MakeCompound(ShapeListCompound_1)
56 # (2.54) Exploding of Compound_1 to faces
57 Compound_1_faces = geompy.SubShapeAll(Compound_1, geompy.ShapeType["FACE"])
58 # (2.54) Exploding of Face_translated_2 to vertices
59 Face_translated_2_vertices = geompy.SubShapeAll(Face_translated[1], geompy.ShapeType["VERTEX"])
60 # (2.62) Creating two boxes
61 Box_1 = geompy.MakeBoxTwoPnt(Vertex_9, Face_translated_2_vertices[1])
62 Box_2 = geompy.MakeBoxTwoPnt(Vertex_10, Face_translated_2_vertices[0])
63 # (2.70) Building Compound_2
64 ShapeListCompound_2 = []
65 ShapeListCompound_2.append(Box_1)
66 ShapeListCompound_2.append(Box_2)
67 Compound_2 = geompy.MakeCompound(ShapeListCompound_2)
68 # (2.75) Exploding of Compound_2 to solids
69 Compound_2_solids = geompy.SubShapeAll(Compound_2, geompy.ShapeType["SOLID"])
70
71 # Adding to study of geometrical objects
72 id_Compound_1 = geompy.addToStudy(Compound_1, "Compound_1")
73 id_Face_1 = geompy.addToStudyInFather(Compound_1,Compound_1_faces[0], "Face_1")
74 id_Face_5 = geompy.addToStudyInFather(Compound_1,Compound_1_faces[4], "Face_5")
75 id_Face_4 = geompy.addToStudyInFather(Compound_1,Compound_1_faces[3], "Face_4")
76 id_Compound_2 = geompy.addToStudy(Compound_2, "Compound_2")
77 id_Solid_2 = geompy.addToStudyInFather(Compound_2,Compound_2_solids[1], "Solid_2")
78
79 salome.sg.updateObjBrowser(1)