From 3776dd7ec51ac9a817b8076df2a3fd5c7f12c9e9 Mon Sep 17 00:00:00 2001 From: prascle Date: Fri, 23 Mar 2012 13:13:21 +0000 Subject: [PATCH] PR: reorganise smesh plugins and correct MeshCut when there are groups --- src/Tools/Makefile.am | 3 ++ src/Tools/MeshCut/Makefile.am | 4 +-- src/Tools/MeshCut/MeshCut_DC.cxx | 6 ++-- src/Tools/MeshCut/meshcut_plugin.py | 7 +--- src/Tools/padder/spadderpy/plugin/Makefile.am | 2 +- .../{smesh_plugins.py => spadderPlugin.py} | 6 ---- src/Tools/smesh_plugins.py | 35 +++++++++++++++++++ 7 files changed, 46 insertions(+), 17 deletions(-) rename src/Tools/padder/spadderpy/plugin/{smesh_plugins.py => spadderPlugin.py} (87%) mode change 100755 => 100644 create mode 100644 src/Tools/smesh_plugins.py diff --git a/src/Tools/Makefile.am b/src/Tools/Makefile.am index 96b92e3cf..6ac95c5be 100644 --- a/src/Tools/Makefile.am +++ b/src/Tools/Makefile.am @@ -26,3 +26,6 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am SUBDIRS = MeshCut padder + +salomeplugins_PYTHON = \ + smesh_plugins.py diff --git a/src/Tools/MeshCut/Makefile.am b/src/Tools/MeshCut/Makefile.am index e191e4e01..496b3e11a 100644 --- a/src/Tools/MeshCut/Makefile.am +++ b/src/Tools/MeshCut/Makefile.am @@ -42,12 +42,12 @@ MeshCut_CPPFLAGS = $(MED3_INCLUDES) MeshCut_LDFLAGS = $(MED3_LIBS) $(HDF5_LIBS) - +salomeplugins_PYTHON = \ + meshcut_plugin.py UIPY_FILES = MeshCutDialog.py if SMESH_ENABLE_GUI - dist_salomescript_SCRIPTS = meshcut_plugin.py nodist_salomescript_SCRIPTS = $(UIPY_FILES) endif diff --git a/src/Tools/MeshCut/MeshCut_DC.cxx b/src/Tools/MeshCut/MeshCut_DC.cxx index 8bb937133..d957103db 100644 --- a/src/Tools/MeshCut/MeshCut_DC.cxx +++ b/src/Tools/MeshCut/MeshCut_DC.cxx @@ -1104,11 +1104,13 @@ int main(int argc, char *argv[]) // cout << endl; // Groupes de mailles - MAILLAGE2->GM = MAILLAGE1->GM; + // MAILLAGE2->GM = MAILLAGE1->GM; + MAILLAGE2->GN.clear(); + MAILLAGE2->GM.clear(); MAILLAGE2->GM[str_id_GMplus] = GMplus; MAILLAGE2->GM[str_id_GMmoins] = GMmoins; - MAILLAGE2->GN = MAILLAGE1->GN; + // MAILLAGE2->GN = MAILLAGE1->GN; MAILLAGE2->eliminationMailles(TETRA4, cutTetras); diff --git a/src/Tools/MeshCut/meshcut_plugin.py b/src/Tools/MeshCut/meshcut_plugin.py index e47e7e897..600e09f10 100644 --- a/src/Tools/MeshCut/meshcut_plugin.py +++ b/src/Tools/MeshCut/meshcut_plugin.py @@ -20,8 +20,6 @@ # if you already have plugins defined in a salome_plugins.py file, add this file at the end. # if not, copy this file as ${HOME}/Plugins/smesh_plugins.py or ${APPLI}/Plugins/smesh_plugins.py -import salome_pluginsmanager - def MeshCut(context): # get context study, studyId, salomeGui study = context.study @@ -31,6 +29,7 @@ def MeshCut(context): import os import subprocess import tempfile + from PyQt4 import QtCore from PyQt4 import QtGui from PyQt4.QtGui import QFileDialog from PyQt4.QtGui import QMessageBox @@ -139,7 +138,3 @@ and T the tolerance. pass pass pass - -# register the function in the plugin manager -salome_pluginsmanager.AddFunction('MeshCut', 'Cut a tetrahedron mesh by a plane', MeshCut) - diff --git a/src/Tools/padder/spadderpy/plugin/Makefile.am b/src/Tools/padder/spadderpy/plugin/Makefile.am index 543204a0f..b09d6b9a6 100644 --- a/src/Tools/padder/spadderpy/plugin/Makefile.am +++ b/src/Tools/padder/spadderpy/plugin/Makefile.am @@ -6,7 +6,7 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am # plugins and created in the root installation directory. # salomeplugins_PYTHON = \ - smesh_plugins.py + spadderPlugin.py #salomeplugins_DATA = \ # envPlugins.sh diff --git a/src/Tools/padder/spadderpy/plugin/smesh_plugins.py b/src/Tools/padder/spadderpy/plugin/spadderPlugin.py old mode 100755 new mode 100644 similarity index 87% rename from src/Tools/padder/spadderpy/plugin/smesh_plugins.py rename to src/Tools/padder/spadderpy/plugin/spadderPlugin.py index 9f79eaba8..9e24c1b9a --- a/src/Tools/padder/spadderpy/plugin/smesh_plugins.py +++ b/src/Tools/padder/spadderpy/plugin/spadderPlugin.py @@ -21,8 +21,6 @@ # # Author : Guillaume Boulant (EDF) # -import salome_pluginsmanager - def runSpadderPlugin(context): from salome.smesh.spadder.gui import plugindialog @@ -38,7 +36,3 @@ def runSpadderPlugin(context): dialog.update() dialog.show() -salome_pluginsmanager.AddFunction('PADDER mesher', - 'Create a mesh with PADDER', - runSpadderPlugin) - diff --git a/src/Tools/smesh_plugins.py b/src/Tools/smesh_plugins.py new file mode 100644 index 000000000..972ebd82f --- /dev/null +++ b/src/Tools/smesh_plugins.py @@ -0,0 +1,35 @@ +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2011 EDF R&D +# +# 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 +# +# -* Makefile *- +# +# Author : Guillaume Boulant (EDF) +# +import salome_pluginsmanager + +from spadderPlugin import runSpadderPlugin +from meshcut_plugin import MeshCut + +salome_pluginsmanager.AddFunction('PADDER mesher', + 'Create a mesh with PADDER', + runSpadderPlugin) + +salome_pluginsmanager.AddFunction('MeshCut', + 'Cut a tetrahedron mesh by a plane', + MeshCut) -- 2.30.2