mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Fix deep purge of unit when converting units and fix bug where unit was removed if map unit was the same as the project unit
This commit is contained in:
@@ -853,8 +853,9 @@ def convert_file_length_units(ifc_file: ifcopenshell.file, target_units: str = "
|
||||
},
|
||||
)
|
||||
|
||||
file_patched.remove(old_length)
|
||||
unit_assignment = get_unit_assignment(file_patched)
|
||||
unit_assignment.Units = tuple([new_length, *unit_assignment.Units])
|
||||
unit_assignment.Units = [new_length, *(u for u in unit_assignment.Units if u.UnitType != new_length.UnitType)]
|
||||
if not file_patched.get_total_inverses(old_length):
|
||||
ifcopenshell.util.element.remove_deep2(file_patched, old_length)
|
||||
|
||||
return file_patched
|
||||
|
||||
Reference in New Issue
Block a user