mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-27 02:31:09 +00:00
Bump IOS build and add support for IFCXML import. See #854.
This commit is contained in:
@@ -25,7 +25,7 @@ endif
|
|||||||
mkdir -p dist/blenderbim
|
mkdir -p dist/blenderbim
|
||||||
cp -r blenderbim/* 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*
|
cd dist/working && unzip ifcblender*
|
||||||
cp -r dist/working/io_import_scene_ifc/ifcopenshell dist/blenderbim/libs/site/packages/
|
cp -r dist/working/io_import_scene_ifc/ifcopenshell dist/blenderbim/libs/site/packages/
|
||||||
# See bug #812
|
# See bug #812
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ if bpy is not None:
|
|||||||
|
|
||||||
def menu_func_import(self, context):
|
def menu_func_import(self, context):
|
||||||
self.layout.operator(operator.ImportIFC.bl_idname,
|
self.layout.operator(operator.ImportIFC.bl_idname,
|
||||||
text="Industry Foundation Classes (.ifc/.ifczip)")
|
text="Industry Foundation Classes (.ifc/.ifczip/.ifcxml)")
|
||||||
|
|
||||||
def on_register(scene):
|
def on_register(scene):
|
||||||
prop.setDefaultProperties(scene)
|
prop.setDefaultProperties(scene)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import multiprocessing
|
|||||||
import zipfile
|
import zipfile
|
||||||
import tempfile
|
import tempfile
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from .helper import SIUnitHelper
|
from . import helper
|
||||||
from . import schema
|
from . import schema
|
||||||
from . import ifc
|
from . import ifc
|
||||||
|
|
||||||
@@ -758,6 +758,15 @@ class IfcImporter():
|
|||||||
for filename in Path(unzipped_path).glob('**/*.ifc'):
|
for filename in Path(unzipped_path).glob('**/*.ifc'):
|
||||||
self.file = ifcopenshell.open(filename)
|
self.file = ifcopenshell.open(filename)
|
||||||
break
|
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':
|
elif extension == 'ifc':
|
||||||
self.file = ifcopenshell.open(self.ifc_import_settings.input_file)
|
self.file = ifcopenshell.open(self.ifc_import_settings.input_file)
|
||||||
ifc.IfcStore.file = self.file
|
ifc.IfcStore.file = self.file
|
||||||
@@ -776,7 +785,7 @@ class IfcImporter():
|
|||||||
self.unit_scale *= unit.ConversionFactor.ValueComponent.wrappedValue
|
self.unit_scale *= unit.ConversionFactor.ValueComponent.wrappedValue
|
||||||
unit = unit.ConversionFactor.UnitComponent
|
unit = unit.ConversionFactor.UnitComponent
|
||||||
if unit.is_a('IfcSIUnit'):
|
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):
|
def set_units(self):
|
||||||
units = self.file.by_type('IfcUnitAssignment')[0]
|
units = self.file.by_type('IfcUnitAssignment')[0]
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class ImportIFC(bpy.types.Operator, ImportHelper):
|
|||||||
bl_idname = "bim.import_ifc"
|
bl_idname = "bim.import_ifc"
|
||||||
bl_label = "Import IFC"
|
bl_label = "Import IFC"
|
||||||
filename_ext = ".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):
|
def execute(self, context):
|
||||||
start = time.time()
|
start = time.time()
|
||||||
|
|||||||
Reference in New Issue
Block a user