X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_SWIG%2Fbatchmode_mefisto.py;h=baf57efa9359d01fa841607b9ec973e11159561d;hp=58ca97b8cadd3ddd2e6c3ef3b07577e873635af4;hb=e5b4cc5b6e8acda597188ff4b6c8247283fb194c;hpb=c63ee099ad2b149bd70136839c973e8910137bc5 diff --git a/src/SMESH_SWIG/batchmode_mefisto.py b/src/SMESH_SWIG/batchmode_mefisto.py index 58ca97b8c..baf57efa9 100644 --- a/src/SMESH_SWIG/batchmode_mefisto.py +++ b/src/SMESH_SWIG/batchmode_mefisto.py @@ -1,29 +1,33 @@ -# 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 # + import os import re import batchmode_salome import batchmode_geompy import batchmode_smesh -import StdMeshers +from salome.StdMeshers import StdMeshersBuilder smesh = batchmode_smesh.smesh smesh.SetCurrentStudy(batchmode_salome.myStudy) @@ -49,44 +53,44 @@ def CreateMesh (theFileName, area, len = None, nbseg = None): # ---- SMESH + print "-------------------------- create mesh" + mesh = smesh.Mesh(shape_mesh) print "-------------------------- create Hypothesis" if (len is not None): print "-------------------------- LocalLength" - hypLength1 = smesh.CreateHypothesis("LocalLength", "libStdMeshersEngine.so") - hypLength1.SetLength(len) + algoReg = mesh.Segment() + hypLength1 = algoReg.LocalLength(len) print "Hypothesis type : ", hypLength1.GetName() print "Hypothesis ID : ", hypLength1.GetId() print "Hypothesis Value: ", hypLength1.GetLength() if (nbseg is not None): print "-------------------------- NumberOfSegments" - hypNbSeg1 = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so") - hypNbSeg1.SetNumberOfSegments(nbseg) + algoReg = mesh.Segment() + hypNbSeg1 = algoReg.NumberOfSegments(nbseg) print "Hypothesis type : ", hypNbSeg1.GetName() print "Hypothesis ID : ", hypNbSeg1.GetId() print "Hypothesis Value: ", hypNbSeg1.GetNumberOfSegments() if (area == "LengthFromEdges"): print "-------------------------- LengthFromEdges" - hypLengthFromEdges = smesh.CreateHypothesis("LengthFromEdges", "libStdMeshersEngine.so") - hypLengthFromEdges.SetMode(1) + algoMef = mesh.Triangle() + hypLengthFromEdges = algoMef.LengthFromEdges(1) print "Hypothesis type : ", hypLengthFromEdges.GetName() print "Hypothesis ID : ", hypLengthFromEdges.GetId() print "LengthFromEdges Mode: ", hypLengthFromEdges.GetMode() else: print "-------------------------- MaxElementArea" - hypArea1 = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so") - hypArea1.SetMaxElementArea(area) + algoMef = mesh.Triangle() + hypArea1 = algoMef.MaxElementArea(area) print "Hypothesis type : ", hypArea1.GetName() print "Hypothesis ID : ", hypArea1.GetId() print "Hypothesis Value: ", hypArea1.GetMaxElementArea() print "-------------------------- Regular_1D" - algoReg = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so") - listHyp = algoReg.GetCompatibleHypothesis() for hyp in listHyp: print hyp @@ -95,8 +99,6 @@ def CreateMesh (theFileName, area, len = None, nbseg = None): print "Algo ID : ", algoReg.GetId() print "-------------------------- MEFISTO_2D" - algoMef = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so") - listHyp = algoMef.GetCompatibleHypothesis() for hyp in listHyp: print hyp @@ -107,38 +109,8 @@ def CreateMesh (theFileName, area, len = None, nbseg = None): # ---- add hypothesis to shape - print "-------------------------- add hypothesis to shape" - mesh = smesh.CreateMesh(shape_mesh) - - ret = mesh.AddHypothesis(shape_mesh, algoReg) - print "Add Regular_1D algo .... ", - print ret - - if (nbseg is not None): - ret = mesh.AddHypothesis(shape_mesh, hypNbSeg1) - print "Add Number Of Segements algo .... ", - print ret - - if (len is not None): - ret = mesh.AddHypothesis(shape_mesh,hypLength1) - print "Add Local Length algo .... ", - print ret - - ret = mesh.AddHypothesis(shape_mesh, algoMef) - print "Add MEFISTO_2D algo....", - print ret - - if (area == "LengthFromEdges"): - ret = mesh.AddHypothesis( shape_mesh, hypLengthFromEdges) # length from edge - print "Add Length From Edges algo .... ", - print ret - else: - ret = mesh.AddHypothesis(shape_mesh, hypArea1) - print "Add Max Triangle Area algo .... ", - print ret - print "-------------------------- compute mesh" - ret = smesh.Compute(mesh,shape_mesh) + ret = mesh.Compute() print "Compute Mesh .... ", print ret log = mesh.GetLog(0); # no erase trace