mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Minor fix for #1699
This commit is contained in:
@@ -20,39 +20,8 @@ class Usecase:
|
||||
setattr(map_conversion, name, value)
|
||||
for name, value in self.settings["projected_crs"].items():
|
||||
setattr(projected_crs, name, value)
|
||||
self.remove_existing_map_unit(projected_crs)
|
||||
self.set_map_unit(projected_crs)
|
||||
self.set_true_north()
|
||||
|
||||
def remove_existing_map_unit(self, projected_crs):
|
||||
if projected_crs.MapUnit and len(self.file.get_inverse(projected_crs.MapUnit)) == 1:
|
||||
# TODO: go deeper for conversion units
|
||||
self.file.remove(projected_crs.MapUnit)
|
||||
|
||||
def set_map_unit(self, projected_crs):
|
||||
if not self.settings["map_unit"]:
|
||||
return
|
||||
|
||||
if "METRE" in self.settings["map_unit"]:
|
||||
projected_crs.MapUnit = self.file.createIfcSIUnit(
|
||||
None,
|
||||
"LENGTHUNIT",
|
||||
ifcopenshell.util.unit.get_prefix(self.settings["map_unit"]),
|
||||
ifcopenshell.util.unit.get_unit_name(self.settings["map_unit"]),
|
||||
)
|
||||
return
|
||||
|
||||
value_component = self.file.create_entity(
|
||||
"IfcReal", **{"wrappedValue": ifcopenshell.util.unit.si_conversions[self.settings["map_unit"]]}
|
||||
)
|
||||
si_unit = self.file.createIfcSIUnit(None, "LENGTHUNIT", None, "METRE")
|
||||
projected_crs.MapUnit = self.file.createIfcConversionBasedUnit(
|
||||
self.file.createIfcDimensionalExponents(1, 0, 0, 0, 0, 0, 0),
|
||||
"LENGTHUNIT",
|
||||
self.settings["map_unit"],
|
||||
self.file.createIfcMeasureWithUnit(value_component, si_unit),
|
||||
)
|
||||
|
||||
def set_true_north(self):
|
||||
if self.settings["true_north"] == []:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user