Salome HOME
simplification
[modules/smesh.git] / src / Tools / smesh_plugins.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2011-2021  EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20 # Author : Guillaume Boulant (EDF)
21 #
22 import salome_pluginsmanager
23 import os
24 from qtsalome import QIcon
25
26 try:
27   from spadderPlugin import runSpadderPlugin
28   salome_pluginsmanager.AddFunction('PADDER mesher',
29                                     'Create a mesh with PADDER',
30                                     runSpadderPlugin)
31 except Exception as e:
32   salome_pluginsmanager.logger.info('ERROR: PADDER mesher plug-in is unavailable: {}'.format(e))
33   pass
34
35 try:
36   from meshcut_plugin import MeshCut
37   icon_file = os.path.join(os.getenv('SMESH_ROOT_DIR'),'share', 'salome', 'resources', 'smesh', 'mesh_plugins_meshcut.png')
38   salome_pluginsmanager.AddFunction('MeshCut',
39                                     'Cut a tetrahedron mesh by a plane',
40                                     MeshCut, icon=QIcon(icon_file))
41
42 except Exception as e:
43   salome_pluginsmanager.logger.info('ERROR: MeshCut plug-in is unavailable: {}'.format(e))
44   pass
45
46 try:
47   from yamsplug_plugin import YamsLct
48   salome_pluginsmanager.AddFunction('ReMesh with MGSurfOpt',
49                                     'Run Yams',
50                                     YamsLct)
51 except Exception as e:
52   salome_pluginsmanager.logger.info('ERROR: MGSurfOpt plug-in is unavailable: {}'.format(e))
53   pass
54
55 try:
56   from MGCleanerplug_plugin import MGCleanerLct
57   salome_pluginsmanager.AddFunction('ReMesh with MGCleaner',
58                                     'Run MGCleaner',
59                                     MGCleanerLct)
60 except Exception as e:
61   salome_pluginsmanager.logger.info('ERROR: MGCleaner plug-in is unavailable: {}'.format(e))
62   pass
63
64 try:
65   from blocFissure.ihm.fissureCoude_plugin import fissureCoudeDlg
66   salome_pluginsmanager.AddFunction('Meshed Pipe with a crack (blocFissure plugin)',
67                                     'Create a mesh with blocFissure tool',
68                                     fissureCoudeDlg)
69 except Exception as e:
70   salome_pluginsmanager.logger.info('ERROR: Meshed Pipe with a crack plug-in is unavailable: {}'.format(e))
71   pass
72 try:
73   from blocFissure.ihm.fissureGenerale_plugin import fissureGeneraleDlg
74   salome_pluginsmanager.AddFunction('Add a crack in a mesh (blocFissure plugin)',
75                                     'Insert a crack in an hexahedral mesh with blocFissure tool',
76                                     fissureGeneraleDlg)
77 except Exception as e:
78   salome_pluginsmanager.logger.info('ERROR: Meshed Pipe with a crack plug-in is unavailable: {}'.format(e))
79   pass
80
81 # ZCracks plugin requires the Zcracks tool
82 try:
83   zcracksHome=os.environ['ZCRACKSHOME']
84   if len(zcracksHome) > 1:
85     #print 'ZCRACKSHOME ', zcracksHome
86     from Zcracks.zcracks_plugin import ZcracksLct
87     salome_pluginsmanager.AddFunction('Run Zcracks',
88                                       'Add a crack in a mesh with Zcracks plug-in',
89                                       ZcracksLct)
90 except Exception as e:
91   #print 'probleme zcracks'
92   salome_pluginsmanager.logger.info('ERROR: Zcrack plug-in is unavailable: {}'.format(e))
93   pass