X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_SWIG%2Fex11_grid3partition.py;h=ae75f84c1874b61c15d5ecdecc60a67c9c40a3c2;hp=928fb7cdfd25fa193d4aacfe7be9346924362bdf;hb=2aed859fcd4a79ddeaf25370c39b2ee713fc873c;hpb=57b43b4d010e2d0a1529d3c131bbb9d416e63258 diff --git a/src/SMESH_SWIG/ex11_grid3partition.py b/src/SMESH_SWIG/ex11_grid3partition.py index 928fb7cdf..ae75f84c1 100644 --- a/src/SMESH_SWIG/ex11_grid3partition.py +++ b/src/SMESH_SWIG/ex11_grid3partition.py @@ -1,28 +1,37 @@ -# Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE # -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS # -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. # -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. # -# See http://www.salome-platform.org/ +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -# CEA/LGLS 2004-2005, Francis KLOSS (OCC) -# ======================================= -from geompy import * +# ======================================= +# +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New() -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New() # Geometry # ======== @@ -55,46 +64,46 @@ g_trim = 1000 # Element # ------- -e_boite = MakeBox(g_x-g_arete, g_y-g_hauteur, g_z-g_arete, g_x+g_arete, g_y+g_hauteur, g_z+g_arete) +e_boite = geompy.MakeBox(g_x-g_arete, g_y-g_hauteur, g_z-g_arete, g_x+g_arete, g_y+g_hauteur, g_z+g_arete) e_hauteur = 2*g_hauteur -e_centre = MakeVertex(g_x, g_y-g_hauteur, g_z) -e_dir = MakeVectorDXDYDZ(0, 1, 0) +e_centre = geompy.MakeVertex(g_x, g_y-g_hauteur, g_z) +e_dir = geompy.MakeVectorDXDYDZ(0, 1, 0) -e_cyl1 = MakeCylinder(e_centre, e_dir, g_rayon3, e_hauteur) +e_cyl1 = geompy.MakeCylinder(e_centre, e_dir, g_rayon3, e_hauteur) -e_blo1 = MakeCut(e_boite, e_cyl1) +e_blo1 = geompy.MakeCut(e_boite, e_cyl1) -e_cyl2 = MakeCylinder(e_centre, e_dir, g_rayon2, e_hauteur) +e_cyl2 = geompy.MakeCylinder(e_centre, e_dir, g_rayon2, e_hauteur) -e_blo2 = MakeCut(e_cyl1, e_cyl2) +e_blo2 = geompy.MakeCut(e_cyl1, e_cyl2) -e_cyl3 = MakeCylinder(e_centre, e_dir, g_rayon1, e_hauteur) +e_cyl3 = geompy.MakeCylinder(e_centre, e_dir, g_rayon1, e_hauteur) -e_blo3 = MakeCut(e_cyl2, e_cyl3) +e_blo3 = geompy.MakeCut(e_cyl2, e_cyl3) # Partition and repair # -------------------- p_tools = [] -p_tools.append(MakePlane(e_centre, MakeVectorDXDYDZ( 1, 0, 1), g_trim)) -p_tools.append(MakePlane(e_centre, MakeVectorDXDYDZ(-1, 0, 1), g_trim)) +p_tools.append(geompy.MakePlane(e_centre, geompy.MakeVectorDXDYDZ( 1, 0, 1), g_trim)) +p_tools.append(geompy.MakePlane(e_centre, geompy.MakeVectorDXDYDZ(-1, 0, 1), g_trim)) -p_part = MakePartition([e_blo1, e_blo2, e_blo3], p_tools, [], [], ShapeType["SOLID"]) +p_part = geompy.MakePartition([e_blo1, e_blo2, e_blo3], p_tools, [], [], geompy.ShapeType["SOLID"]) -p_element = RemoveExtraEdges(p_part) +p_element = geompy.RemoveExtraEdges(p_part, doUnionFaces=True) # Grid and glue # ------------- -grid = MakeMultiTranslation2D(p_element, MakeVectorDXDYDZ(1, 0, 0), 2*g_arete, g_grid, MakeVectorDXDYDZ(0, 0, 1), 2*g_arete, g_grid) +grid = geompy.MakeMultiTranslation2D(p_element, geompy.MakeVectorDXDYDZ(1, 0, 0), 2*g_arete, g_grid, geompy.MakeVectorDXDYDZ(0, 0, 1), 2*g_arete, g_grid) -piece = MakeGlueFaces(grid, 1e-5) +piece = geompy.MakeGlueFaces(grid, 1e-5) # Add in study # ------------ -piece_id = addToStudy(piece, "ex11_grid3partition") +piece_id = geompy.addToStudy(piece, "ex11_grid3partition") # Meshing # ======= @@ -115,3 +124,8 @@ hexa.Hexahedron() # ------------- hexa.Compute() + +# Update object browser +# --------------------- + +salome.sg.updateObjBrowser()