diff --git a/src/ifcopenshell-python/ifcopenshell/geom/main.py b/src/ifcopenshell-python/ifcopenshell/geom/main.py index 30c2233a89..cf1189ad3c 100644 --- a/src/ifcopenshell-python/ifcopenshell/geom/main.py +++ b/src/ifcopenshell-python/ifcopenshell/geom/main.py @@ -24,7 +24,7 @@ from typing import TYPE_CHECKING, Any, Literal, Optional, TypeVar, Union, cast, from .. import ifcopenshell_wrapper, open from ..entity_instance import entity_instance -from ..file import file +from ..ifcopenshell_wrapper import file from . import has_occ if TYPE_CHECKING: @@ -625,8 +625,9 @@ def make_shape_function(fn): return _ -serialise = make_shape_function(ifcopenshell_wrapper.serialise) -tesselate = make_shape_function(ifcopenshell_wrapper.tesselate) +if hasattr(ifcopenshell_wrapper, "serialise"): + serialise = make_shape_function(ifcopenshell_wrapper.serialise) + tesselate = make_shape_function(ifcopenshell_wrapper.tesselate) def transform_string(v: Union[str, serializers.buffer]) -> serializers.buffer: @@ -659,7 +660,8 @@ class serializers: # Hdf- Xml- and glTF- serializers don't support writing to a buffer, only to filename # so no wrap_buffer_creation() for these serializers - xml = ifcopenshell_wrapper.XmlSerializer + if hasattr(ifcopenshell_wrapper, "XmlSerializer"): + xml = ifcopenshell_wrapper.XmlSerializer buffer = ifcopenshell_wrapper.buffer # gltf, hdf5, collada and json availability depend on IfcOpenShell configuration settings try: diff --git a/src/ifcopenshell-python/ifcopenshell/stream.py b/src/ifcopenshell-python/ifcopenshell/stream.py index c9556fa708..6afbc8a1f6 100644 --- a/src/ifcopenshell-python/ifcopenshell/stream.py +++ b/src/ifcopenshell-python/ifcopenshell/stream.py @@ -30,7 +30,7 @@ try: from . import ifcopenshell_wrapper from .entity_instance import entity_instance - from .file import file + from .ifcopenshell_wrapper import file class StreamTransformer(Transformer): file: file