Salome HOME
Merge branch 'V8_3_BR' into ngr/python3_dev
[modules/smesh.git] / src / Tools / smesh_plugins.py
index 3c81d72fa64e98559c8ec7cfc85c354440c5f0da..8393e6a8b8117e7da6c4711964e569af217a4b36 100644 (file)
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-# Author : Guillaume Boulant (EDF) 
+# Author : Guillaume Boulant (EDF)
 #
 import salome_pluginsmanager
+import os
 
 try:
   from spadderPlugin import runSpadderPlugin
   salome_pluginsmanager.AddFunction('PADDER mesher',
                                     'Create a mesh with PADDER',
                                     runSpadderPlugin)
-except:
-  salome_pluginsmanager.logger.info('ERROR: PADDER mesher plug-in is unavailable')
+except Exception as e:
+  salome_pluginsmanager.logger.info('ERROR: PADDER mesher plug-in is unavailable: {}'.format(e))
   pass
 
 try:
@@ -36,8 +37,8 @@ try:
                                     'Cut a tetrahedron mesh by a plane',
                                     MeshCut)
 
-except:
-  salome_pluginsmanager.logger.info('ERROR: MeshCut plug-in is unavailable')
+except Exception as e:
+  salome_pluginsmanager.logger.info('ERROR: MeshCut plug-in is unavailable: {}'.format(e))
   pass
 
 try:
@@ -45,8 +46,8 @@ try:
   salome_pluginsmanager.AddFunction('ReMesh with MGSurfOpt',
                                     'Run Yams',
                                     YamsLct)
-except:
-  salome_pluginsmanager.logger.info('ERROR: MGSurfOpt plug-in is unavailable')
+except Exception as e:
+  salome_pluginsmanager.logger.info('ERROR: MGSurfOpt plug-in is unavailable: {}'.format(e))
   pass
 
 try:
@@ -54,8 +55,8 @@ try:
   salome_pluginsmanager.AddFunction('ReMesh with MGCleaner',
                                     'Run MGCleaner',
                                     MGCleanerLct)
-except:
-  salome_pluginsmanager.logger.info('ERROR: MGCleaner plug-in is unavailable')
+except Exception as e:
+  salome_pluginsmanager.logger.info('ERROR: MGCleaner plug-in is unavailable: {}'.format(e))
   pass
 
 try:
@@ -63,27 +64,28 @@ try:
   salome_pluginsmanager.AddFunction('Meshed Pipe with a crack (blocFissure plugin)',
                                     'Create a mesh with blocFissure tool',
                                     fissureCoudeDlg)
-except:
-  salome_pluginsmanager.logger.info('ERROR: Meshed Pipe with a crack plug-in is unavailable')
+except Exception as e:
+  salome_pluginsmanager.logger.info('ERROR: Meshed Pipe with a crack plug-in is unavailable: {}'.format(e))
   pass
 try:
   from blocFissure.ihm.fissureGenerale_plugin import fissureGeneraleDlg
   salome_pluginsmanager.AddFunction('Add a crack in a mesh (blocFissure plugin)',
                                     'Insert a crack in an hexahedral mesh with blocFissure tool',
                                     fissureGeneraleDlg)
-except:
-  salome_pluginsmanager.logger.info('ERROR: Meshed Pipe with a crack plug-in is unavailable')
+except Exception as e:
+  salome_pluginsmanager.logger.info('ERROR: Meshed Pipe with a crack plug-in is unavailable: {}'.format(e))
   pass
 
-# ZCracks plugin requires the module EFICAS to be installed
-# thus it is first tested if this module is available before
-# adding the plugin to salome_pluginsmanager
+# ZCracks plugin requires the Zcracks tool
 try:
-  import eficasSalome
-  from zcracks_plugin import ZcracksLct
-  salome_pluginsmanager.AddFunction('Run Zcrack',
-                                    'Run Zcrack',
-                                    ZcracksLct)
-except:
-  salome_pluginsmanager.logger.info('ERROR: Zcrack plug-in is unavailable')
+  zcracksHome=os.environ['ZCRACKSHOME']
+  if len(zcracksHome) > 1:
+    #print 'ZCRACKSHOME ', zcracksHome
+    from Zcracks.zcracks_plugin import ZcracksLct
+    salome_pluginsmanager.AddFunction('Run Zcrack',
+                                      'Run Zcrack',
+                                      ZcracksLct)
+except Exception as e:
+  #print 'probleme zcracks'
+  salome_pluginsmanager.logger.info('ERROR: Zcrack plug-in is unavailable: {}'.format(e))
   pass