Salome HOME
Windows support: move test scripts to lib/python<version>/site-packages/salome folder...
[modules/smesh.git] / src / SMESH_SWIG / PAL_MESH_043_2D.py
index 76ab25924e38af9b17a5a0e9b8a65b280a727f1b..4f7866cb6f932ce82ff458d85ab847911d54dee2 100755 (executable)
@@ -1,32 +1,40 @@
-#  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-#  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-# 
-#  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. 
-# 
-#  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+#  -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 #
+# Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 #
+# 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.
 #
+# 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
+#
+
 #  File        : SMESH_testExtrusion2D.py
 #  Module      : SMESH
 #  Description : Create meshes to test extrusion of mesh elements along path
-
+#
 import salome
-import geompy
-import SMESH
-import StdMeshers
+salome.salome_init()
+import GEOM
+from salome.geom import geomBuilder
+geompy = geomBuilder.New()
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh =  smeshBuilder.New()
+
 
 #----------------------------------GEOM
 
@@ -51,52 +59,26 @@ id_ellipse2 = geompy.addToStudy(ellipse2, "Ellips 2")
 
 
 #---------------------------------SMESH
-# get smesh engine
-smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
-smesh.SetCurrentStudy(salome.myStudy)
-
-# get SMESH GUI
-smeshgui = salome.ImportComponentGUI("SMESH")
-smeshgui.Init(salome.myStudyId)
-
-# create hypoteses
-hypNbSeg1 = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
-hypNbSeg1.SetNumberOfSegments(18)
-id_hypNbSeg1 = salome.ObjectToID(hypNbSeg1) 
-smeshgui.SetName(id_hypNbSeg1, "NumberOfSegments 1");
-
-hypNbSeg2 = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
-hypNbSeg2.SetNumberOfSegments(34)
-id_hypNbSeg2 = salome.ObjectToID(hypNbSeg2) 
-smeshgui.SetName(id_hypNbSeg2, "NumberOfSegments 2");
-
-# create algorithmes
-algoReg = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
-id_algoReg = salome.ObjectToID(algoReg)
-smeshgui.SetName(id_algoReg, "Regular_1D");
 
 # create the path mesh
-mesh1 = smesh.CreateMesh(ellipse1)
-id_mesh1 = salome.ObjectToID(mesh1)
-smeshgui.SetName(id_mesh1, "Path Mesh");
+mesh1 = smesh.Mesh(ellipse1, "Path Mesh")
 
-# set hypotheses and algos
-mesh1.AddHypothesis(ellipse1,algoReg)
-mesh1.AddHypothesis(ellipse1,hypNbSeg1)
+algoReg1 = mesh1.Segment()
+algoReg1.SetName("Regular_1D")
+hypNbSeg1 = algoReg1.NumberOfSegments(18)
+smesh.SetName(hypNbSeg1, "NumberOfSegments 1")
 
 # create the tool mesh
-mesh2 = smesh.CreateMesh(ellipse2)
-id_mesh2 = salome.ObjectToID(mesh2)
-smeshgui.SetName(id_mesh2, "Tool Mesh");
-
-# set hypotheses and algos
-mesh2.AddHypothesis(ellipse2,algoReg)
-mesh2.AddHypothesis(ellipse2,hypNbSeg2)
+mesh2 = smesh.Mesh(ellipse2, "Tool Mesh")
+algoReg2 = mesh2.Segment()
+algoReg2.SetName("Regular_1D")
+hypNbSeg2 = algoReg2.NumberOfSegments(34)
+smesh.SetName(hypNbSeg2, "NumberOfSegments 2")
 
 # compute meshes
-smesh.Compute(mesh1,ellipse1)
-smesh.Compute(mesh2,ellipse2)
+mesh1.Compute()
+mesh2.Compute()
 
 
 # ---- udate object browser
-salome.sg.updateObjBrowser(1);
+salome.sg.updateObjBrowser()