From c31446905814a9a2f97f24aed67df3e69f68031b Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 22 Aug 2012 05:52:38 +0000 Subject: [PATCH] 0021308: EDF 1923 SMESH: Remove hard-coded dependency of the external mesh plugins from the SMESH module * Improve documentation for meshing plug-ins (in particular, dynamically added methods) --- src/GEOM_SWIG/geompy.py | 27 ++++++++++++++++++--------- src/GEOM_SWIG/geompyDC.py | 11 ++++++++--- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/GEOM_SWIG/geompy.py b/src/GEOM_SWIG/geompy.py index 13df41063..f715dc8a4 100644 --- a/src/GEOM_SWIG/geompy.py +++ b/src/GEOM_SWIG/geompy.py @@ -31,13 +31,22 @@ import salome import geompyDC from salome import * -geom = lcc.FindOrLoadComponent("FactoryServer", "GEOM") -geom.init_geom(salome.myStudy) - -# Export the methods of geompyDC -for k in dir(geom): - if k[0] == '_':continue - globals()[k]=getattr(geom,k) -del k -from geompyDC import ShapeType, GEOM, kind, info, PackData, ReadTexture, EnumToLong +# retrieve GEOM engine in try/except block +# to avoid problems in some cases, e.g. when generating documentation +try: + # get GEOM engine + geom = lcc.FindOrLoadComponent( "FactoryServer", "GEOM" ) + # initialize GEOM with current study + geom.init_geom( salome.myStudy ) + # export the methods of geompyDC + for k in dir( geom ): + if k[0] == '_': continue + globals()[k] = getattr( geom, k ) + pass + del k + from geompyDC import ShapeType, GEOM, kind, info, PackData, ReadTexture, EnumToLong + pass +except: + geom = None + pass diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index b7e5a4a92..465f57eb6 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -73,9 +73,14 @@ ## @} -import salome -salome.salome_init() -from salome import * +# initialize SALOME session in try/except block +# to avoid problems in some cases, e.g. when generating documentation +try: + import salome + salome.salome_init() + from salome import * +except: + pass from salome_notebook import * -- 2.39.2