]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOM_SWIG/PAL_MESH_030_geometry.py
Salome HOME
Update copyright information
[modules/geom.git] / src / GEOM_SWIG / PAL_MESH_030_geometry.py
1 #  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
6 #  This library is free software; you can redistribute it and/or
7 #  modify it under the terms of the GNU Lesser General Public
8 #  License as published by the Free Software Foundation; either
9 #  version 2.1 of the License.
10 #
11 #  This library is distributed in the hope that it will be useful,
12 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 #  Lesser General Public License for more details.
15 #
16 #  You should have received a copy of the GNU Lesser General Public
17 #  License along with this library; if not, write to the Free Software
18 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 #
20 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22 #==============================================================================
23 #  Created              : 17/02/2005
24 #  Author               : Alexander KOVALEV
25 #  GUI test scenario    : PAL-MESH-030_geometry
26 #============================================================================== 
27 #
28 import salome
29 import geompy
30
31 # Stage 2: "Creation of geometry"
32
33 # (2.1) Creating a box
34 Box_1 = geompy.MakeBoxDXDYDZ(200, 400, 300)
35 # (2.8) Exploding Box_1 to vertices and faces
36 Box_1_vertices = geompy.SubShapeAll(Box_1, geompy.ShapeType["VERTEX"])
37 Box_1_faces = geompy.SubShapeAll(Box_1, geompy.ShapeType["FACE"])
38 # (2.17) Creating a new points
39 Vertex_9 = geompy.MakeVertex(200, 200, 50)
40 Vertex_10 = geompy.MakeVertex(150, 300, 80)
41 # (2.26) Translation of the faces 
42 Face_translated = []
43 Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[2], Box_1_vertices[5], Vertex_9))
44 Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[5], Vertex_9, Vertex_10))
45 Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[2], Vertex_10, Vertex_9))
46 Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[3], Box_1_vertices[5], Vertex_9))
47 Face_translated.append(geompy.MakeTranslationTwoPoints(Face_translated[1], Vertex_9, Vertex_10))
48 # (2.49) Building a Compound_1
49 ShapeListCompound_1 = []
50 i = 0
51 while i < 5 :
52     ShapeListCompound_1.append(Face_translated[i])
53     i = i + 1
54 Compound_1 = geompy.MakeCompound(ShapeListCompound_1)
55 # (2.54) Exploding of Compound_1 to faces
56 Compound_1_faces = geompy.SubShapeAll(Compound_1, geompy.ShapeType["FACE"])
57 # (2.54) Exploding of Face_translated_2 to vertices
58 Face_translated_2_vertices = geompy.SubShapeAll(Face_translated[1], geompy.ShapeType["VERTEX"])
59 # (2.62) Creating two boxes
60 Box_1 = geompy.MakeBoxTwoPnt(Vertex_9, Face_translated_2_vertices[1])
61 Box_2 = geompy.MakeBoxTwoPnt(Vertex_10, Face_translated_2_vertices[0])
62 # (2.70) Building Compound_2
63 ShapeListCompound_2 = []
64 ShapeListCompound_2.append(Box_1)
65 ShapeListCompound_2.append(Box_2)
66 Compound_2 = geompy.MakeCompound(ShapeListCompound_2)
67 # (2.75) Exploding of Compound_2 to solids
68 Compound_2_solids = geompy.SubShapeAll(Compound_2, geompy.ShapeType["SOLID"])
69
70 # Adding to study of geometrical objects
71 id_Compound_1 = geompy.addToStudy(Compound_1, "Compound_1")
72 id_Face_1 = geompy.addToStudyInFather(Compound_1,Compound_1_faces[0], "Face_1")
73 id_Face_5 = geompy.addToStudyInFather(Compound_1,Compound_1_faces[4], "Face_5")
74 id_Face_4 = geompy.addToStudyInFather(Compound_1,Compound_1_faces[3], "Face_4")
75 id_Compound_2 = geompy.addToStudy(Compound_2, "Compound_2")
76 id_Solid_2 = geompy.addToStudyInFather(Compound_2,Compound_2_solids[1], "Solid_2")
77
78 salome.sg.updateObjBrowser(1)