diff --git a/src/ifcblenderexport/blenderbim/bim/import_ifc.py b/src/ifcblenderexport/blenderbim/bim/import_ifc.py index 687c22ab18..0ee65ce488 100644 --- a/src/ifcblenderexport/blenderbim/bim/import_ifc.py +++ b/src/ifcblenderexport/blenderbim/bim/import_ifc.py @@ -303,6 +303,10 @@ class IfcImporter(): self.profile_code('Set vendor worksarounds') self.calculate_unit_scale() self.profile_code('Calculate unit scale') + self.filter_ifc() + self.profile_code('Filtering ifc') + self.patch_ifc() + self.profile_code('Patching ifc') self.set_units() self.profile_code('Set units') self.create_geometric_representation_contexts() @@ -333,10 +337,6 @@ class IfcImporter(): if self.ifc_import_settings.should_import_native: self.parse_native_elements() self.profile_code('Parsing native elements') - self.filter_ifc() - self.profile_code('Filtering ifc') - self.patch_ifc() - self.profile_code('Patching ifc') self.create_georeferencing() self.profile_code('Georeferencing ifc') self.create_groups() @@ -561,6 +561,28 @@ class IfcImporter(): point.Coordinates[1] - offset_point[1], point.Coordinates[2] - offset_point[2] ) + if not offset_point: + return + if self.file.wrapped_data.schema == 'IFC2X3': + properties = [ + self.file.createIfcPropertySingleValue('Eastings', None, + self.file.createIfcLengthMeasure(offset_point[0])), + self.file.createIfcPropertySingleValue('Northings', None, + self.file.createIfcLengthMeasure(offset_point[1])), + self.file.createIfcPropertySingleValue('OrthogonalHeight', None, + self.file.createIfcLengthMeasure(offset_point[2])) + ] + history = self.file.createIfcOwnerHistory() + pset = self.file.createIfcPropertySet( + ifcopenshell.guid.new(), history, 'EPset_MapConversion', None, properties) + self.file.createIfcRelDefinesByProperties( + ifcopenshell.guid.new(), history, None, None, self.file.by_type('IfcSite'), pset) + else: + # We don't have the full geolocation information, so we'll add what we can + scene = bpy.context.scene + scene.MapConversion.eastings = str(offset_point[0]) + scene.MapConversion.northings = str(offset_point[1]) + scene.MapConversion.orthogonal_height = str(offset_point[2]) def find_decomposed_ifc_class(self, element, ifc_class): results = []