Salome HOME
IPAL8796: delete the files in tmp dir after import
[modules/geom.git] / src / GEOM_SWIG / PAL_MESH_030_geometry.py
1 #==============================================================================
2 #  Created              : 17/02/2005
3 #  Author               : Alexander KOVALEV
4 #  GUI test scenario    : PAL-MESH-030_geometry
5 #============================================================================== 
6
7 import salome
8 import geompy
9
10 # Stage 2: "Creation of geometry"
11
12 # (2.1) Creating a box
13 Box_1 = geompy.MakeBoxDXDYDZ(200, 400, 300)
14 # (2.8) Exploding Box_1 to vertices and faces
15 Box_1_vertices = geompy.SubShapeAll(Box_1, geompy.ShapeType["VERTEX"])
16 Box_1_faces = geompy.SubShapeAll(Box_1, geompy.ShapeType["FACE"])
17 # (2.17) Creating a new points
18 Vertex_9 = geompy.MakeVertex(200, 200, 50)
19 Vertex_10 = geompy.MakeVertex(150, 300, 80)
20 # (2.26) Translation of the faces 
21 Face_translated = []
22 Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[2], Box_1_vertices[5], Vertex_9))
23 Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[5], Vertex_9, Vertex_10))
24 Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[2], Vertex_10, Vertex_9))
25 Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[3], Box_1_vertices[5], Vertex_9))
26 Face_translated.append(geompy.MakeTranslationTwoPoints(Face_translated[1], Vertex_9, Vertex_10))
27 # (2.49) Building a Compound_1
28 ShapeListCompound_1 = []
29 i = 0
30 while i < 5 :
31     ShapeListCompound_1.append(Face_translated[i])
32     i = i + 1
33 Compound_1 = geompy.MakeCompound(ShapeListCompound_1)
34 # (2.54) Exploding of Compound_1 to faces
35 Compound_1_faces = geompy.SubShapeAll(Compound_1, geompy.ShapeType["FACE"])
36 # (2.54) Exploding of Face_translated_2 to vertices
37 Face_translated_2_vertices = geompy.SubShapeAll(Face_translated[1], geompy.ShapeType["VERTEX"])
38 # (2.62) Creating two boxes
39 Box_1 = geompy.MakeBoxTwoPnt(Vertex_9, Face_translated_2_vertices[1])
40 Box_2 = geompy.MakeBoxTwoPnt(Vertex_10, Face_translated_2_vertices[0])
41 # (2.70) Building Compound_2
42 ShapeListCompound_2 = []
43 ShapeListCompound_2.append(Box_1)
44 ShapeListCompound_2.append(Box_2)
45 Compound_2 = geompy.MakeCompound(ShapeListCompound_2)
46 # (2.75) Exploding of Compound_2 to solids
47 Compound_2_solids = geompy.SubShapeAll(Compound_2, geompy.ShapeType["SOLID"])
48
49 # Adding to study of geometrical objects
50 id_Compound_1 = geompy.addToStudy(Compound_1, "Compound_1")
51 id_Face_1 = geompy.addToStudyInFather(Compound_1,Compound_1_faces[0], "Face_1")
52 id_Face_5 = geompy.addToStudyInFather(Compound_1,Compound_1_faces[4], "Face_5")
53 id_Face_4 = geompy.addToStudyInFather(Compound_1,Compound_1_faces[3], "Face_4")
54 id_Compound_2 = geompy.addToStudy(Compound_2, "Compound_2")
55 id_Solid_2 = geompy.addToStudyInFather(Compound_2,Compound_2_solids[1], "Solid_2")
56
57 salome.sg.updateObjBrowser(1)