Handling cas were shaperstudy is not avaialable for salome on demand

This commit is contained in:
yoann.audouin 2024-02-14 14:37:13 +01:00
parent 29136aef51
commit 2f85c8d0c4
3 changed files with 31 additions and 22 deletions

View File

@ -7821,13 +7821,24 @@ class ParallelMesh(Mesh):
if not isinstance(geom, geomBuilder.GEOM._objref_GEOM_Object): if not isinstance(geom, geomBuilder.GEOM._objref_GEOM_Object):
raise ValueError("geom argument must be a geometry") raise ValueError("geom argument must be a geometry")
try:
import SHAPERSTUDY import SHAPERSTUDY
import shaperBuilder shaper_object = SHAPERSTUDY.SHAPERSTUDY_ORB._objref_SHAPER_Object
has_shaper = True
except ImportError:
shaper_object = int
has_shaper = False
# If we have a shaper object converting it into geom (temporary solution) # If we have a shaper object converting it into geom (temporary solution)
if isinstance(geom, SHAPERSTUDY.SHAPERSTUDY_ORB._objref_SHAPER_Object): if isinstance(geom, shaper_object):
self._geom_obj = _shaperstudy2geom(geompyD, geom) geom_obj = _shaperstudy2geom(geompyD, geom)
elif isinstance(geom, geomBuilder.GEOM._objref_GEOM_Object):
geom_obj = geom
else: else:
self._geom_obj = geom msg= ""
if not has_shaper:
msg = "\nShaper was not compiled"
raise Exception("Could not handle geom format {}.{} ".format(type(geom), msg))
# Splitting geometry into one geom containing 1D and 2D elements and a # Splitting geometry into one geom containing 1D and 2D elements and a
# list of 3D elements # list of 3D elements

View File

@ -23,7 +23,6 @@ import salome
salome.salome_init_without_session() salome.salome_init_without_session()
import GEOM import GEOM
import SHAPERSTUDY
from salome.geom import geomBuilder from salome.geom import geomBuilder
from salome.smesh import smeshBuilder from salome.smesh import smeshBuilder
from salome.shaper import model from salome.shaper import model

View File

@ -23,7 +23,6 @@ import salome
salome.salome_init_without_session() salome.salome_init_without_session()
import GEOM import GEOM
import SHAPERSTUDY
from salome.geom import geomBuilder from salome.geom import geomBuilder
from salome.smesh import smeshBuilder from salome.smesh import smeshBuilder
from salome.shaper import model from salome.shaper import model