mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-06 07:51:47 +00:00
Add support for case insensitive file units on import
This commit is contained in:
@@ -1451,17 +1451,20 @@ class IfcImporter:
|
||||
bpy.context.scene.unit_settings.length_unit = f"{unit.Prefix}METERS"
|
||||
else:
|
||||
bpy.context.scene.unit_settings.system = "IMPERIAL"
|
||||
if unit.Name == "inch":
|
||||
name = unit.Name.lower()
|
||||
if name == "inch":
|
||||
bpy.context.scene.unit_settings.length_unit = "INCHES"
|
||||
elif unit.Name == "foot":
|
||||
elif name == "foot":
|
||||
bpy.context.scene.unit_settings.length_unit = "FEET"
|
||||
elif unit.is_a("IfcNamedUnit") and unit.UnitType == "AREAUNIT":
|
||||
name = unit.Name if unit.is_a("IfcSIUnit") else unit.Name.lower()
|
||||
bpy.context.scene.BIMProperties.area_unit = "{}{}".format(
|
||||
unit.Prefix + "/" if hasattr(unit, "Prefix") and unit.Prefix else "", unit.Name
|
||||
unit.Prefix + "/" if hasattr(unit, "Prefix") and unit.Prefix else "", name
|
||||
)
|
||||
elif unit.is_a("IfcNamedUnit") and unit.UnitType == "VOLUMEUNIT":
|
||||
name = unit.Name if unit.is_a("IfcSIUnit") else unit.Name.lower()
|
||||
bpy.context.scene.BIMProperties.volume_unit = "{}{}".format(
|
||||
unit.Prefix + "/" if hasattr(unit, "Prefix") and unit.Prefix else "", unit.Name
|
||||
unit.Prefix + "/" if hasattr(unit, "Prefix") and unit.Prefix else "", name
|
||||
)
|
||||
|
||||
def create_geometric_representation_contexts(self):
|
||||
|
||||
@@ -1468,7 +1468,7 @@ class BIMProperties(PropertyGroup):
|
||||
area_unit: EnumProperty(
|
||||
items=[
|
||||
("square centimeters", "square centimeters", ""),
|
||||
("square feet", "square feet", ""),
|
||||
("square foot", "square foot", ""),
|
||||
("square inches", "square inches", ""),
|
||||
("square kilometers", "square kilometers", ""),
|
||||
("square meters", "square meters", ""),
|
||||
@@ -1481,7 +1481,7 @@ class BIMProperties(PropertyGroup):
|
||||
volume_unit: EnumProperty(
|
||||
items=[
|
||||
("cubic centimeters", "cubic centimeters", ""),
|
||||
("cubic feet", "cubic feet", ""),
|
||||
("cubic foot", "cubic foot", ""),
|
||||
("cubic inches", "cubic inches", ""),
|
||||
("cubic meters", "cubic meters", ""),
|
||||
("cubic millimeters", "cubic millimeters", ""),
|
||||
|
||||
Reference in New Issue
Block a user