convert_file_length_units - fix issue converting to imperial units

ifcpatch ConvertLengthUnit - change used units from plural to singular names, to make it consistent across the api

more test coverage - test converting to more units and back from them
This commit is contained in:
Andrej730
2024-04-24 15:15:30 +05:00
parent c5f084a4af
commit 716a33f347
5 changed files with 80 additions and 41 deletions
+2 -2
View File
@@ -29,10 +29,10 @@ class TestConvertLengthUnit(test.bootstrap.IFC4):
unit = ifcopenshell.api.run("unit.add_si_unit", self.file, unit_type="LENGTHUNIT", prefix="MILLI")
ifcopenshell.api.run("unit.assign_unit", self.file, units=[unit])
output = ifcpatch.execute(
{"input": "input.ifc", "file": self.file, "recipe": "ConvertLengthUnit", "arguments": ["METERS"]}
{"input": "input.ifc", "file": self.file, "recipe": "ConvertLengthUnit", "arguments": ["METER"]}
)
unit = ifcopenshell.util.unit.get_project_unit(output, "LENGTHUNIT")
assert unit.Prefix == None
assert ifcopenshell.util.unit.get_full_unit_name(unit) == "METRE"
class TestConvertLengthUnitIFC2X3(test.bootstrap.IFC2X3, TestConvertLengthUnit):