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