Back to index

salome-geom  6.5.0
GEOM_Partition5.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 #  GEOM GEOM_SWIG : binding of C++ omplementaion with Python
00025 #  File   : GEOM_Partition5.py
00026 #  Module : GEOM
00027 # import gallery_01_GEOM
00028 # reload(gallery_01_GEOM)
00029 # -- Import geompy pour piloter GEOM par script
00030 #
00031 import geompy
00032 geom = geompy.geom
00033 
00034 # -- Dimensions de la boite entiˆre
00035 
00036 LX, LY, LZ = 300.0, 150.0, 150.0
00037 p0 = geompy.MakeVertex(0.,0.,0.)
00038 vy = geompy.MakeVectorDXDYDZ(0.,1.,0.)
00039 
00040 # -- D‰finition du plan de sym‰trie (O,Ox,Oz)
00041 
00042 symPlane = geompy.MakePlane(p0, vy, 10.0)
00043 
00044 # -- bo
00045 
00046 bo = geompy.MakeBoxDXDYDZ(LX, LY, LZ)
00047 bo = geompy.MakeTranslation(bo, 0.0, -LY/2, -LZ/2)
00048 
00049 # -- Galerie principale
00050 
00051 gal_diam = 80.0
00052 gal_lony = LY
00053 gal_x = LX-20.0-gal_diam/2
00054 
00055 gal = geompy.MakeCylinder(p0, vy, gal_diam/2, gal_lony)
00056 gal = geompy.MakeTranslation(gal, gal_x, -gal_lony/2, 0.0)
00057 
00058 # -- Galerie perpendiculaire
00059 # -- Dimensions de la galerie perpendiculaire
00060 # -- La longueur est compt‰e € partir du centre
00061 # -- de la galerie principale
00062 
00063 gpe_long, gpe_diam = 200.0, 60.0 
00064 gpe_x = gal_x
00065 gpe = geompy.MakeCylinder(
00066     p0,
00067     geompy.MakeVectorDXDYDZ(-1.,0.,0.),
00068     gpe_diam/2,gpe_long)
00069 gpe = geompy.MakeTranslation(gpe, gpe_x, 0, 0)
00070 
00071 # -- Dimensions d'une alveole
00072 # -- Construction d'une alv‰ole
00073 
00074 alv_long, alv_diam = 60.0, 18.0
00075 alv01 = geompy.MakeCylinder(p0, vy, alv_diam/2, alv_long)
00076 alv02 = geompy.MakeMirrorByPlane(alv01, symPlane)
00077 alv0 = geompy.MakeCompound([alv01, alv02])
00078 
00079 # -- Construction des alv‰oles
00080 
00081 alv_del, alv_sep = 40.0, 35.0
00082 alv1 = geompy.MakeTranslation(alv0, gal_x-gal_diam/2-alv_sep, 0.0, 0.0)
00083 alv2 = geompy.MakeTranslation(alv1, -alv_del, 0.0, 0.0 )
00084 alv3 = geompy.MakeTranslation(alv2, -alv_del, 0.0, 0.0 )
00085 alv = geompy.MakeCompound([alv1, alv2, alv3])
00086 
00087 # -- Remplissage de la BO
00088 
00089 gallery = geompy.MakePartition([alv, bo], [], [], [gal, gpe])
00090 
00091 subshapes = geompy.SubShapeAll(gallery, geompy.ShapeType["SHAPE"])
00092 
00093 alvGOs = []
00094 alvGOs.append(subshapes[0])
00095 alvGOs.append(subshapes[1])
00096 alvGOs.append(subshapes[2])
00097 alvGOs.append(subshapes[3])
00098 alvGOs.append(subshapes[4])
00099 alvGOs.append(subshapes[5])
00100 alvcomp = geompy.MakeCompound(alvGOs)
00101 
00102 boGO  = subshapes[6]
00103 galGO = subshapes[7]
00104 gpeGO = subshapes[8]
00105 
00106 gallery = geompy.MakeCompound([boGO, alvcomp, gpeGO, galGO])
00107 
00108 geompy.addToStudy(gallery,"Gallery 2")