-# 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-2014 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_testExtrusion3D.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(salome.myStudy)
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+smesh = smeshBuilder.New(salome.myStudy)
-# 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)
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");
+# init a Mesh with the circular face
+mesh1 = smesh.Mesh(face, "Mesh on circular face")
-hypArea = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
-hypArea.SetMaxElementArea(30)
-idarea = salome.ObjectToID(hypArea)
-smeshgui.SetName(idarea, "MaxElementArea_20");
+# 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))
-# create algorithmes
-algoReg = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
-idreg = salome.ObjectToID(algoReg)
-smeshgui.SetName(idreg, "Regular_1D");
+maxElementArea = 30
-algoMef = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
-idmef = salome.ObjectToID(algoMef)
-smeshgui.SetName(idmef, "MEFISTO_2D");
+algoMef = mesh1.Triangle()
+algoMef.SetName("MEFISTO_2D")
+hypArea = algoMef.MaxElementArea(maxElementArea)
+smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea))
-# init a Mesh with the circular face
-mesh1 = smesh.CreateMesh(face)
-idmesh1 = salome.ObjectToID(mesh1)
-smeshgui.SetName(idmesh1, "Mesh on circular face");
-
-# 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);