Back to index

salome-geom  6.5.0
PAL_MESH_030_geometry.py
Go to the documentation of this file.
00001 #  -*- coding: iso-8859-1 -*-
00002 # Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00003 #
00004 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00005 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00006 #
00007 # This library is free software; you can redistribute it and/or
00008 # modify it under the terms of the GNU Lesser General Public
00009 # License as published by the Free Software Foundation; either
00010 # version 2.1 of the License.
00011 #
00012 # This library is distributed in the hope that it will be useful,
00013 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 # Lesser General Public License for more details.
00016 #
00017 # You should have received a copy of the GNU Lesser General Public
00018 # License along with this library; if not, write to the Free Software
00019 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00020 #
00021 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00022 #
00023 
00024 #==============================================================================
00025 #  Created              : 17/02/2005
00026 #  Author               : Alexander KOVALEV
00027 #  GUI test scenario    : PAL-MESH-030_geometry
00028 #============================================================================== 
00029 #
00030 import salome
00031 import geompy
00032 
00033 # Stage 2: "Creation of geometry"
00034 
00035 # (2.1) Creating a box
00036 Box_1 = geompy.MakeBoxDXDYDZ(200, 400, 300)
00037 # (2.8) Exploding Box_1 to vertices and faces
00038 Box_1_vertices = geompy.SubShapeAll(Box_1, geompy.ShapeType["VERTEX"])
00039 Box_1_faces = geompy.SubShapeAll(Box_1, geompy.ShapeType["FACE"])
00040 # (2.17) Creating a new points
00041 Vertex_9 = geompy.MakeVertex(200, 200, 50)
00042 Vertex_10 = geompy.MakeVertex(150, 300, 80)
00043 # (2.26) Translation of the faces 
00044 Face_translated = []
00045 Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[2], Box_1_vertices[5], Vertex_9))
00046 Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[5], Vertex_9, Vertex_10))
00047 Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[2], Vertex_10, Vertex_9))
00048 Face_translated.append(geompy.MakeTranslationTwoPoints(Box_1_faces[3], Box_1_vertices[5], Vertex_9))
00049 Face_translated.append(geompy.MakeTranslationTwoPoints(Face_translated[1], Vertex_9, Vertex_10))
00050 # (2.49) Building a Compound_1
00051 ShapeListCompound_1 = []
00052 i = 0
00053 while i < 5 :
00054     ShapeListCompound_1.append(Face_translated[i])
00055     i = i + 1
00056 Compound_1 = geompy.MakeCompound(ShapeListCompound_1)
00057 # (2.54) Exploding of Compound_1 to faces
00058 Compound_1_faces = geompy.SubShapeAll(Compound_1, geompy.ShapeType["FACE"])
00059 # (2.54) Exploding of Face_translated_2 to vertices
00060 Face_translated_2_vertices = geompy.SubShapeAll(Face_translated[1], geompy.ShapeType["VERTEX"])
00061 # (2.62) Creating two boxes
00062 Box_1 = geompy.MakeBoxTwoPnt(Vertex_9, Face_translated_2_vertices[1])
00063 Box_2 = geompy.MakeBoxTwoPnt(Vertex_10, Face_translated_2_vertices[0])
00064 # (2.70) Building Compound_2
00065 ShapeListCompound_2 = []
00066 ShapeListCompound_2.append(Box_1)
00067 ShapeListCompound_2.append(Box_2)
00068 Compound_2 = geompy.MakeCompound(ShapeListCompound_2)
00069 # (2.75) Exploding of Compound_2 to solids
00070 Compound_2_solids = geompy.SubShapeAll(Compound_2, geompy.ShapeType["SOLID"])
00071 
00072 # Adding to study of geometrical objects
00073 id_Compound_1 = geompy.addToStudy(Compound_1, "Compound_1")
00074 id_Face_1 = geompy.addToStudyInFather(Compound_1,Compound_1_faces[0], "Face_1")
00075 id_Face_5 = geompy.addToStudyInFather(Compound_1,Compound_1_faces[4], "Face_5")
00076 id_Face_4 = geompy.addToStudyInFather(Compound_1,Compound_1_faces[3], "Face_4")
00077 id_Compound_2 = geompy.addToStudy(Compound_2, "Compound_2")
00078 id_Solid_2 = geompy.addToStudyInFather(Compound_2,Compound_2_solids[1], "Solid_2")
00079 
00080 salome.sg.updateObjBrowser(1)