diff --git a/src/ifcblenderexport/Makefile b/src/ifcblenderexport/Makefile index b4bd3ff99f..5c58cbbe97 100644 --- a/src/ifcblenderexport/Makefile +++ b/src/ifcblenderexport/Makefile @@ -25,7 +25,7 @@ endif mkdir -p dist/blenderbim cp -r blenderbim/* dist/blenderbim/ - cd dist/working && wget https://s3.amazonaws.com/ifcopenshell-builds/ifcblender-python-37-v0.6.0-1662b11-$(PLATFORM)64.zip + cd dist/working && wget https://s3.amazonaws.com/ifcopenshell-builds/ifcblender-python-37-v0.6.0-cdbe343-$(PLATFORM)64.zip cd dist/working && unzip ifcblender* cp -r dist/working/io_import_scene_ifc/ifcopenshell dist/blenderbim/libs/site/packages/ # See bug #812 diff --git a/src/ifcblenderexport/blenderbim/bim/__init__.py b/src/ifcblenderexport/blenderbim/bim/__init__.py index ab62bace4d..f1fc0c50d5 100644 --- a/src/ifcblenderexport/blenderbim/bim/__init__.py +++ b/src/ifcblenderexport/blenderbim/bim/__init__.py @@ -199,7 +199,7 @@ if bpy is not None: def menu_func_import(self, context): self.layout.operator(operator.ImportIFC.bl_idname, - text="Industry Foundation Classes (.ifc/.ifczip)") + text="Industry Foundation Classes (.ifc/.ifczip/.ifcxml)") def on_register(scene): prop.setDefaultProperties(scene) diff --git a/src/ifcblenderexport/blenderbim/bim/import_ifc.py b/src/ifcblenderexport/blenderbim/bim/import_ifc.py index 097d31e102..ca3e80a8a8 100644 --- a/src/ifcblenderexport/blenderbim/bim/import_ifc.py +++ b/src/ifcblenderexport/blenderbim/bim/import_ifc.py @@ -12,7 +12,7 @@ import multiprocessing import zipfile import tempfile from pathlib import Path -from .helper import SIUnitHelper +from . import helper from . import schema from . import ifc @@ -758,6 +758,15 @@ class IfcImporter(): for filename in Path(unzipped_path).glob('**/*.ifc'): self.file = ifcopenshell.open(filename) break + elif extension == 'ifcxml': + # We write the IFCXML out to a regular IFC then re-read it, because + # right now IfcOpenShells interface for accessing an IFCXML is very + # different for some reason. When it gets standardised, we can read + # it directly. + ifcxml_file = ifcopenshell.ifcopenshell_wrapper.parse_ifcxml(self.ifc_import_settings.input_file) + with tempfile.NamedTemporaryFile() as temp_file: + ifcxml_file.write(temp_file.name) + self.file = ifcopenshell.open(temp_file.name) elif extension == 'ifc': self.file = ifcopenshell.open(self.ifc_import_settings.input_file) ifc.IfcStore.file = self.file @@ -776,7 +785,7 @@ class IfcImporter(): self.unit_scale *= unit.ConversionFactor.ValueComponent.wrappedValue unit = unit.ConversionFactor.UnitComponent if unit.is_a('IfcSIUnit'): - self.unit_scale *= SIUnitHelper.get_prefix_multiplier(unit.Prefix) + self.unit_scale *= helper.SIUnitHelper.get_prefix_multiplier(unit.Prefix) def set_units(self): units = self.file.by_type('IfcUnitAssignment')[0] diff --git a/src/ifcblenderexport/blenderbim/bim/operator.py b/src/ifcblenderexport/blenderbim/bim/operator.py index 084222c435..29808647ad 100644 --- a/src/ifcblenderexport/blenderbim/bim/operator.py +++ b/src/ifcblenderexport/blenderbim/bim/operator.py @@ -72,7 +72,7 @@ class ImportIFC(bpy.types.Operator, ImportHelper): bl_idname = "bim.import_ifc" bl_label = "Import IFC" filename_ext = ".ifc" - filter_glob: bpy.props.StringProperty(default="*.ifc;*.ifczip", options={'HIDDEN'}) + filter_glob: bpy.props.StringProperty(default="*.ifc;*.ifczip;*.ifcxml", options={'HIDDEN'}) def execute(self, context): start = time.time()