mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 18:21:59 +00:00
Fix #5483. Units is optional when loading.
This commit is contained in:
@@ -1189,8 +1189,9 @@ class IfcImporter:
|
|||||||
tool.Loader.set_unit_scale(self.unit_scale)
|
tool.Loader.set_unit_scale(self.unit_scale)
|
||||||
|
|
||||||
def set_units(self):
|
def set_units(self):
|
||||||
units = self.file.by_type("IfcUnitAssignment")[0]
|
if not (units := self.file.by_type("IfcUnitAssignment")):
|
||||||
for unit in units.Units:
|
return # Geometry is optional in IFC
|
||||||
|
for unit in units[0].Units:
|
||||||
if unit.is_a("IfcNamedUnit") and unit.UnitType == "LENGTHUNIT":
|
if unit.is_a("IfcNamedUnit") and unit.UnitType == "LENGTHUNIT":
|
||||||
if unit.is_a("IfcSIUnit"):
|
if unit.is_a("IfcSIUnit"):
|
||||||
bpy.context.scene.unit_settings.system = "METRIC"
|
bpy.context.scene.unit_settings.system = "METRIC"
|
||||||
|
|||||||
Reference in New Issue
Block a user