22491: EDF 2249 SMESH: Integration of a small python library for quadrangle meshing

Fix 1) license 2) bugs 3) obsolete import
This commit is contained in:
eap 2014-03-13 17:43:57 +04:00
parent 8fff0ccade
commit 143f1ac50c
15 changed files with 342 additions and 30 deletions

View File

@ -118,6 +118,7 @@
<parameter name="User's Guide" value="%SMESH_ROOT_DIR%/share/doc/salome/gui/SMESH/index.html"/>
<parameter name="Plug-ins/MGSurfOpt plugin User's Guide" value="%SMESH_ROOT_DIR%/share/doc/salome/gui/SMESH/yams/index.html"/>
<parameter name="Plug-ins/MGCleaner plugin User's Guide" value="%SMESH_ROOT_DIR%/share/doc/salome/gui/SMESH/MGCleaner/index.html"/>
<parameter name="Plug-ins/MacMesh plugin" value="%SMESH_ROOT_DIR%/share/doc/salome/gui/SMESH/MacMesh/index.html"/>
<parameter name="Developer's Guide" value="%SMESH_ROOT_DIR%/share/doc/salome/tui/SMESH/index.html"/>
</section>
<section name="resources">

View File

@ -21,6 +21,7 @@ ADD_SUBDIRECTORY(MeshCut)
ADD_SUBDIRECTORY(padder)
ADD_SUBDIRECTORY(Verima)
ADD_SUBDIRECTORY(blocFissure)
ADD_SUBDIRECTORY(MacMesh)
IF(SALOME_BUILD_GUI)
ADD_SUBDIRECTORY(MGCleanerPlug)

View File

@ -17,7 +17,7 @@
# 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
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
SET(MACMESH_INSTALL_PY ${SALOME_SMESH_INSTALL_PLUGINS}/MacMesh)
SET(MACMESH_INSTALL_DOC ${SALOME_INSTALL_DOC}/gui/SMESH/MacMesh)

View File

@ -1,9 +1,34 @@
# 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
##################################################################
# Header for salome initialization ###############################
import sys, salome, geompy, smesh, SMESH, math, os
import sys, salome, math, os
sys.path.append( os.path.join( os.getenv('SMESH_ROOT_DIR'), '@MACMESH_INSTALL_PY@'))
import Config, GenFunctions
Config.theStudy = salome.myStudy;
from MacObject import *
from SharpAngle import *
from CentralUnrefine import *
@ -12,10 +37,6 @@ from CompositeBox import *
from CompositeBoxF import *
import Config, GenFunctions
Config.theStudy = salome.myStudy;
geompy.init_geom(Config.theStudy)
##################################################################
# Mesh name ######################################################

View File

@ -1,3 +1,24 @@
# 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
def Message (code) :
import sys
MessageString = { 1 : lambda x: "Successfully created \n",

View File

@ -1,9 +1,33 @@
# 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
# This object allows unrefining from a central point (actually, a line) to the exterior
# X0 and Y0 are the center points of the origin point and not those of the center of the generated block
import sys, salome, geompy, smesh, SMESH, math, commands
import sys, math, commands
CWD = commands.getoutput('pwd')
sys.path.append(CWD)

View File

@ -1,6 +1,29 @@
# 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
# INTRODUCTION HERE
import sys, salome, geompy, smesh, SMESH, math, copy, commands
import sys, math, copy, commands
CWD = commands.getoutput('pwd')
sys.path.append(CWD)

View File

@ -1,6 +1,30 @@
# 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
# INTRODUCTION HERE
import sys, salome, geompy, smesh, SMESH, math, copy, commands
import sys, math, copy, commands
CWD = commands.getoutput('pwd')
sys.path.append(CWD)

View File

@ -1,3 +1,26 @@
# 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
dz = 1
debug = 1
@ -27,3 +50,11 @@ except NameError : RefPts = []
try : DirIndex
except NameError : DirIndex = 0
try : theStudy
except NameError :
import salome
salome.salome_init()
theStudy = salome.myStudy

View File

@ -1,5 +1,33 @@
# 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
# This module allows cutting and grouping geometries by defining plane sections, with level of cutting as well as customizable Prefixes.
import geompy, math
import math, Config
from salome.geom import geomBuilder
geompy = geomBuilder.New( Config.theStudy )
def Go(GeoObj, CutPlnLst, OutLvlLst, PrefixLst, Publish):

View File

@ -1,10 +1,35 @@
# 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
# This is an automation of the cylinder-box object, defined with the coordinates of its center, its radius, and the box's
# boundary size.
# The pitch ratio is calculated automatically from the minimum of the box dimensions on x and y.
# This functions can take a groups input containing the group names of 4 sides in addition to the internal circular boundary
# in the following order : [South,North,West,East,Internal].
import sys, salome, geompy, smesh, SMESH, math, commands
import sys, math, commands
CWD = commands.getoutput('pwd')
sys.path.append(CWD)

View File

@ -1,10 +1,39 @@
# In this file are all the generation functions for manipulating the different created macro-objects
import geompy, smesh
# 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
# In this file are all the generation functions for manipulating the different created macro-objects
import math, copy
import Config
import CutnGroup
import CompositeBox
from salome.geom import geomBuilder
geompy = geomBuilder.New( Config.theStudy )
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New( Config.theStudy )
##########################################################################################################
def Box11 (MacObject):

View File

@ -1,3 +1,26 @@
# 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
class MacObject:
"""
This represents a python class definition which contains
@ -217,7 +240,10 @@ class MacObject:
return [PtCoor[PtIndex+1][0]-PtCoor[PtIndex][0],PtCoor[PtIndex+1][1]-PtCoor[PtIndex][1],0.]
def GetBorder (self, Criterion):
import geompy, GenFunctions
import GenFunctions, Config
from salome.geom import geomBuilder
geompy = geomBuilder.New( Config.theStudy )
if type(Criterion) is str :
Crit = {'South' : lambda : 0,

View File

@ -1,7 +1,36 @@
# 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
#
import geompy, smesh, SMESH
import SMESH
import math
import Config
from salome.geom import geomBuilder
geompy = geomBuilder.New( Config.theStudy )
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New( Config.theStudy )
##########################################################################################################
def PublishGroups ():
@ -37,7 +66,8 @@ def PublishGroups ():
geompy.addToStudyInFather(FinalCompound,GroupGEO[-1],'GR_'+group)
# Mesh groups definition
Criterion = smesh.Filter.Criterion(18,39,0,'GR_'+group,'GR_'+group,39,39,1e-06,smesh.EDGE,7)
Criterion = smesh.GetCriterion(SMESH.EDGE, SMESH.FT_BelongToGeom,'=',GroupGEO[-1],Tolerance=1e-06)
#Criterion = smesh.Filter.Criterion(18,39,0,'GR_'+group,'GR_'+group,39,39,1e-06,smesh.EDGE,7)
MeshCompound.MakeGroupByCriterion(group,Criterion)
StudyBuilder = Config.theStudy.NewBuilder()
@ -119,18 +149,22 @@ def RevolveMesh(MainMesh,**args):
# Removing the _rotated prefix from the rotated FACE groups
for GR in Rev3DMeshGroups:
CurrentName = GR.GetName()
if CurrentName=='LOFAC_rotated' :
GR.SetName('VOL')
else :
if CurrentName.endswith( "_rotated"):
if CurrentName.startswith( 'LOFAC_' ):
GR.SetName('VOL')
else:
GR.SetName(CurrentName[:-8])
elif CurrentName == 'LOFAC_top':
GR.SetName('HIFAC')
#Index = [ GR_Names[i] in CurrentName for i in range(0,len(GR_Names)) ].index(True)
#GR.SetName(GR_Names[Index])
GR.SetName(CurrentName[:-8])
# Creating the upper face group HIFAC
ALLFAC = MainMesh.CreateEmptyGroup( SMESH.FACE, 'ALLFAC' )
ALLFAC.AddFrom(MainMesh.GetMesh())
HIFAC = MainMesh.GetMesh().CutListOfGroups( [ ALLFAC ], [LOFAC] + [ MeshGroup for MeshGroup in Rev3DMeshGroups if not(MeshGroup.GetName()=='VOL') ], 'HIFAC' )
#HIFAC = MainMesh.GetMesh().CutListOfGroups( [ ALLFAC ], [LOFAC] + [ MeshGroup for MeshGroup in Rev3DMeshGroups if not(MeshGroup.GetName()=='VOL') ], 'HIFAC' )
#HIFAC = MainMesh.GetMesh().CutListOfGroups( [ ALLFAC ], [LOFAC] + [ MeshGroup for MeshGroup in Rev3DMeshGroups if ( not(MeshGroup.GetName()=='VOL') and MeshGroup.GetType() == SMESH.FACE )], 'HIFAC' )
# Scaling down the mesh to meter units
if not(Scale==1.):
@ -182,21 +216,22 @@ def ExtrudeMesh(MainMesh,**args):
if CurrentName in GR_Names and not(CurrentName=='LOFAC'): # Meaning that this is an old edge group
GR.SetName(CurrentName+'_EDGE')
# Removing the _rotated prefix from the rotated FACE groups
# Removing the _extruded suffix from the extruded FACE groups
for GR in Ext3DMeshGroups:
CurrentName = GR.GetName()
if CurrentName=='LOFAC_extruded' :
GR.SetName('VOL')
else :
#Index = [ GR_Names[i] in CurrentName for i in range(0,len(GR_Names)) ].index(True)
#GR.SetName(GR_Names[Index])
GR.SetName(CurrentName[:-9])
if CurrentName.endswith( "_extruded"):
if CurrentName.startswith( 'LOFAC_' ):
GR.SetName('VOL')
else:
GR.SetName(CurrentName[:-9])
elif CurrentName == 'LOFAC_top':
GR.SetName('HIFAC')
# Creating the upper face group HIFAC
ALLFAC = MainMesh.CreateEmptyGroup( SMESH.FACE, 'ALLFAC' )
ALLFAC.AddFrom(MainMesh.GetMesh())
HIFAC = MainMesh.GetMesh().CutListOfGroups( [ ALLFAC ], [LOFAC] + [ MeshGroup for MeshGroup in Ext3DMeshGroups if not(MeshGroup.GetName()=='VOL') ], 'HIFAC' )
#HIFAC = MainMesh.GetMesh().CutListOfGroups( [ ALLFAC ], [LOFAC] + [ MeshGroup for MeshGroup in Ext3DMeshGroups if not(MeshGroup.GetName()=='VOL') ], 'HIFAC' )
# Scaling down the mesh to meter units
if not(Scale==1.):

View File

@ -1,3 +1,26 @@
# 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
# This is an automation of the sharp angle object, with a corner at (X0,Y0), side length : Extension and a fine local meshing : LocalMeshing
# The corner orientation is defined as NE (North-East) , NW (North-West), SE, or SW. The object's "arm" is 8/14 of Extension
# | | 8 6
@ -6,7 +29,7 @@
# | NW NE | oo
# _____| |_____
import sys, salome, geompy, smesh, SMESH, math, commands
import sys, math, commands
CWD = commands.getoutput('pwd')
sys.path.append(CWD)