Back to index

salome-geom  6.5.0
PAL_MESH_035_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                :15/02/2005
00026 #Auhtor                 :KOVALTCHUK Alexey 
00027 #GUI test scenario      :PAL-MESH-035 (geometry part)
00028 #####################################################################
00029 #
00030 import geompy
00031 import salome
00032 
00033 #Box creation (2.2)
00034 Box_1 = geompy.MakeBoxDXDYDZ(200, 400, 300)
00035 geompy.addToStudy(Box_1, "Box_1")
00036 
00037 #Cylinder creation (2.8)
00038 Cylinder_1 = geompy.MakeCylinderRH(100, 300)
00039 geompy.addToStudy(Cylinder_1, "Cylinder_1")
00040 
00041 #Cone creation (2.13)
00042 Cone_1 = geompy.MakeConeR1R2H(100, 50, 200)
00043 geompy.addToStudy(Cone_1, "Cone_1")
00044 
00045 #Explode box, cone and cylinder on faces and vertices(2.18)
00046 ListOfFaces_Box_1 = geompy.SubShapeAll(Box_1, geompy.ShapeType["FACE"])
00047 NbExplodedFaces_Box_1 = len(ListOfFaces_Box_1)
00048 for i in range (0, NbExplodedFaces_Box_1):
00049    name = "Face_" + str(i+1)
00050    geompy.addToStudyInFather(Box_1, ListOfFaces_Box_1[i], name)
00051 
00052 ListOfVertices_Box_1 = geompy.SubShapeAll(Box_1, geompy.ShapeType["VERTEX"])
00053 NbExplodedVertices_Box_1 = len(ListOfVertices_Box_1)
00054 for i in range (0, NbExplodedVertices_Box_1):
00055    name = "Vertex_" + str(i+1)
00056    geompy.addToStudyInFather(Box_1, ListOfVertices_Box_1[i], name)
00057    
00058 ListOfFaces_Cylinder_1 = geompy.SubShapeAll(Cylinder_1, geompy.ShapeType["FACE"])
00059 NbExplodedFaces_Cylinder_1 = len(ListOfFaces_Cylinder_1)
00060 for i in range (0, NbExplodedFaces_Cylinder_1):
00061    name = "Face_" + str(NbExplodedFaces_Box_1+i+1)
00062    geompy.addToStudyInFather(Cylinder_1, ListOfFaces_Cylinder_1[i], name)
00063    
00064 ListOfFaces_Cone_1 = geompy.SubShapeAll(Cone_1, geompy.ShapeType["FACE"])
00065 NbExplodedFaces_Cone_1 = len(ListOfFaces_Cone_1)
00066 for i in range (0, NbExplodedFaces_Cone_1):
00067    name = "Face_" + str(NbExplodedFaces_Box_1+NbExplodedFaces_Cylinder_1+i+1)
00068    geompy.addToStudyInFather(Cone_1, ListOfFaces_Cone_1[i], name)
00069    
00070 #Plane creation (2.32)
00071 Plane_1 = geompy.MakePlaneThreePnt(ListOfVertices_Box_1[0], ListOfVertices_Box_1[1], ListOfVertices_Box_1[3], 600)
00072 geompy.addToStudy(Plane_1, "Plane_1")
00073 
00074 #Partition (2.32)
00075 compound = geompy.MakeCompound([ListOfFaces_Cylinder_1[0], ListOfFaces_Cone_1[0]])
00076 Partition_1 = geompy.MakeHalfPartition(compound, Plane_1)
00077 geompy.addToStudy(Partition_1, "Partition_1")
00078 
00079 #Explode partition on faces and vertices(2.38)
00080 ListOfFaces_Partition_1 = geompy.SubShapeAll(Partition_1, geompy.ShapeType["FACE"])
00081 NbExplodedFaces_Partition_1 = len(ListOfFaces_Partition_1)
00082 for i in range (0, NbExplodedFaces_Partition_1):
00083    name = "Face_" + str(NbExplodedFaces_Box_1+NbExplodedFaces_Cylinder_1+NbExplodedFaces_Cone_1+i+1)
00084    geompy.addToStudyInFather(Partition_1, ListOfFaces_Partition_1[i], name)
00085 
00086 #Explode faces on vertices(2.43)
00087 ListOfVertices_Face_7 = geompy.SubShapeAll(ListOfFaces_Cylinder_1[0], geompy.ShapeType["VERTEX"])
00088 NbExplodedVertices_Face_7 = len(ListOfVertices_Face_7)
00089 for i in range (0, NbExplodedVertices_Face_7):
00090    name = "Vertex_" + str(NbExplodedVertices_Box_1+i+1)
00091    geompy.addToStudyInFather(ListOfFaces_Cylinder_1[0], ListOfVertices_Face_7[i], name)
00092 
00093 ListOfVertices_Face_10 = geompy.SubShapeAll(ListOfFaces_Cone_1[0], geompy.ShapeType["VERTEX"])
00094 NbExplodedVertices_Face_10 = len(ListOfVertices_Face_10)
00095 for i in range (0, NbExplodedVertices_Face_10):
00096    name = "Vertex_" + str(NbExplodedVertices_Box_1+NbExplodedVertices_Face_7+i+1)
00097    geompy.addToStudyInFather(ListOfFaces_Cone_1[0], ListOfVertices_Face_10[i], name)
00098 
00099 ListOfVertices_Face_15 = geompy.SubShapeAll(ListOfFaces_Partition_1[2], geompy.ShapeType["VERTEX"])
00100 NbExplodedVertices_Face_15 = len(ListOfVertices_Face_15)
00101 for i in range (0, NbExplodedVertices_Face_15):
00102    name = "Vertex_" + str(NbExplodedVertices_Box_1+NbExplodedVertices_Face_7+NbExplodedVertices_Face_10+i+1)
00103    geompy.addToStudyInFather(ListOfFaces_Partition_1[2], ListOfVertices_Face_15[i], name)
00104 
00105 ListOfVertices_Face_18 = geompy.SubShapeAll(ListOfFaces_Partition_1[NbExplodedFaces_Partition_1-1], geompy.ShapeType["VERTEX"])
00106 NbExplodedVertices_Face_18 = len(ListOfVertices_Face_18)
00107 for i in range (0, NbExplodedVertices_Face_18):
00108    name = "Vertex_" + str(NbExplodedVertices_Box_1+NbExplodedVertices_Face_7+NbExplodedVertices_Face_10+NbExplodedVertices_Face_15+i+1)
00109    geompy.addToStudyInFather(ListOfFaces_Partition_1[NbExplodedFaces_Partition_1-1], ListOfVertices_Face_18[i], name)
00110 
00111 salome.sg.updateObjBrowser(1)