Salome HOME
Merge branch 'V8_4_BR'
[modules/smesh.git] / src / SMESH_SWIG / ex03_cube2partition.py
index 4772e6375728ba364ecfa422f9ed83e4591989ca..4d4205988c6b11b477098fdf088ddaae9422d4f2 100644 (file)
@@ -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.
+#
+# 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(salome.myStudy)
 
-import smesh
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh =  smeshBuilder.New(salome.myStudy)
 
 # Geometry
 # ========
@@ -46,39 +55,39 @@ g_trim = 1000
 v_arete2 = g_arete*2
 v_arete3 = g_arete*3
 
-v_1 = MakeVertex(g_ox         , g_oy         , g_oz         )
-v_2 = MakeVertex(g_ox+v_arete3, g_oy+g_arete , g_oz+v_arete3)
+v_1 = geompy.MakeVertex(g_ox         , g_oy         , g_oz         )
+v_2 = geompy.MakeVertex(g_ox+v_arete3, g_oy+g_arete , g_oz+v_arete3)
 
-v_3 = MakeVertex(g_ox+g_arete , g_oy+g_arete , g_oz+g_arete )
-v_4 = MakeVertex(g_ox+v_arete2, g_oy+v_arete2, g_oz+v_arete2)
+v_3 = geompy.MakeVertex(g_ox+g_arete , g_oy+g_arete , g_oz+g_arete )
+v_4 = geompy.MakeVertex(g_ox+v_arete2, g_oy+v_arete2, g_oz+v_arete2)
 
 # Solids
 # ------
 
-s_base = MakeBoxTwoPnt(v_1, v_2)
-s_haut = MakeBoxTwoPnt(v_3, v_4)
+s_base = geompy.MakeBoxTwoPnt(v_1, v_2)
+s_haut = geompy.MakeBoxTwoPnt(v_3, v_4)
 
 # Partition
 # ---------
 
-p_dir1 = MakeVectorDXDYDZ(1, 0, 0)
-p_dir2 = MakeVectorDXDYDZ(0, 0, 1)
-p_dir3 = MakeVectorDXDYDZ(0, 1, 0)
+p_dir1 = geompy.MakeVectorDXDYDZ(1, 0, 0)
+p_dir2 = geompy.MakeVectorDXDYDZ(0, 0, 1)
+p_dir3 = geompy.MakeVectorDXDYDZ(0, 1, 0)
 
 p_tools = []
 
-p_tools.append(MakePlane(v_3, p_dir1, g_trim))
-p_tools.append(MakePlane(v_4, p_dir1, g_trim))
-p_tools.append(MakePlane(v_3, p_dir2, g_trim))
-p_tools.append(MakePlane(v_4, p_dir2, g_trim))
-p_tools.append(MakePlane(v_3, p_dir3, g_trim))
+p_tools.append(geompy.MakePlane(v_3, p_dir1, g_trim))
+p_tools.append(geompy.MakePlane(v_4, p_dir1, g_trim))
+p_tools.append(geompy.MakePlane(v_3, p_dir2, g_trim))
+p_tools.append(geompy.MakePlane(v_4, p_dir2, g_trim))
+p_tools.append(geompy.MakePlane(v_3, p_dir3, g_trim))
 
-piece = MakePartition([s_base, s_haut], p_tools, [], [], ShapeType["SOLID"])
+piece = geompy.MakePartition([s_base, s_haut], p_tools, [], [], geompy.ShapeType["SOLID"])
 
 # Study
 # -----
 
-piece_id = addToStudy(piece, "ex03_cube2partition")
+piece_id = geompy.addToStudy(piece, "ex03_cube2partition")
 
 # Meshing
 # =======
@@ -99,3 +108,8 @@ hexa.Hexahedron()
 # ----------------
 
 hexa.Compute()
+
+# Update object browser
+# ---------------------
+
+salome.sg.updateObjBrowser(True)