Salome HOME
correct previous integration (Porting to Python 2.6)
[modules/smesh.git] / src / SMESH_SWIG / PAL_MESH_043_3D.py
index cfd0f45c46f1526e6139ef7afa2e7af4352b6723..bc4e115f035d5c9aa41d07c751870b60b226dd00 100755 (executable)
@@ -1,36 +1,33 @@
-#  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-2008  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.
+#
+#  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_testExtrusion3D.py
 #  Module      : SMESH
 #  Description : Create meshes to test extrusion of mesh elements along path
-
+#
 import salome
 import geompy
-import SMESH
-import StdMeshers
+import smesh
 
-# get smesh engine
-smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
-smesh.SetCurrentStudy(salome.myStudy)
 
 # create points to build two circles
 p1 = geompy.MakeVertex(0,  100,  0)
@@ -52,53 +49,39 @@ face = geompy.MakeFace(wire, 1)
 idcircle = geompy.addToStudy(circle, "Circle")
 idface   = geompy.addToStudy(face,   "Circular face")
 
-# get SMESH GUI
-smeshgui = salome.ImportComponentGUI("SMESH")
-smeshgui.Init(salome.myStudyId)
 
-# create hypoteses
-hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
-hypNbSeg.SetNumberOfSegments(12)
-idseg = salome.ObjectToID(hypNbSeg) 
-smeshgui.SetName(idseg, "NumberOfSegments_10");
 
-hypArea = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
-hypArea.SetMaxElementArea(30)
-idarea = salome.ObjectToID(hypArea)
-smeshgui.SetName(idarea, "MaxElementArea_20");
+# init a Mesh with the circular face
+mesh1 = smesh.Mesh(face, "Mesh on circular face")
 
-# create algorithmes
-algoReg = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
-idreg = salome.ObjectToID(algoReg)
-smeshgui.SetName(idreg, "Regular_1D");
+# set hypotheses and algos to the first mesh
+numberOfSegments1 = 12
+algoReg1 = mesh1.Segment()
+algoReg1.SetName("Regular_1D")
+hypNbSeg1 = algoReg1.NumberOfSegments(numberOfSegments1)
+smesh.SetName(hypNbSeg1, "NumberOfSegments_" + str(numberOfSegments1))
 
-algoMef = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
-idmef = salome.ObjectToID(algoMef)
-smeshgui.SetName(idmef, "MEFISTO_2D");
+maxElementArea = 30
 
-# init a Mesh with the circular face
-mesh1 = smesh.CreateMesh(face)
-idmesh1 = salome.ObjectToID(mesh1)
-smeshgui.SetName(idmesh1, "Mesh on circular face");
+algoMef = mesh1.Triangle()
+algoMef.SetName("MEFISTO_2D")
+hypArea = algoMef.MaxElementArea(maxElementArea)
+smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea))
 
-# set hypotheses and algos
-mesh1.AddHypothesis(face,algoReg)
-mesh1.AddHypothesis(face,hypNbSeg)
-mesh1.AddHypothesis(face,algoMef)
-mesh1.AddHypothesis(face,hypArea)
 
 # init a Mesh with the second circle
-mesh2 = smesh.CreateMesh(circle)
-idmesh2 = salome.ObjectToID(mesh2)
-smeshgui.SetName(idmesh2, "Mesh on circular edge");
+mesh2 = smesh.Mesh(circle, "Mesh on circular edge")
+
+numberOfSegments2 = 12
+algoReg2 = mesh2.Segment()
+algoReg2.SetName("Regular_1D")
+hypNbSeg2 = algoReg2.NumberOfSegments(numberOfSegments2)
+smesh.SetName(hypNbSeg2, "NumberOfSegments_" + str(numberOfSegments2))
 
-# set hypotheses and algos
-mesh2.AddHypothesis(circle,algoReg)
-mesh2.AddHypothesis(circle,hypNbSeg)
 
 # compute meshes
-smesh.Compute(mesh1,face)
-smesh.Compute(mesh2,circle)
+mesh1.Compute()
+mesh2.Compute()
 
 # ---- udate object browser
 salome.sg.updateObjBrowser(1);