mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Add ifcopenshell.util.unit.mm_to_m helper
Centralises the millimetre-to-metre conversion shortcut that add_door_representation and add_window_representation each defined locally. Subsequent commits in this PR switch both call sites to import this from util.unit, removing the duplicate definitions. Generated with the assistance of an AI coding tool.
This commit is contained in:
@@ -644,6 +644,11 @@ def convert_unit(value: float, from_unit: ifcopenshell.entity_instance, to_unit:
|
||||
)
|
||||
|
||||
|
||||
def mm_to_m(value: float) -> float:
|
||||
"""Convert a millimetre value to metres."""
|
||||
return value / 1000
|
||||
|
||||
|
||||
def convert(value: float, from_prefix: Optional[str], from_unit: str, to_prefix: Optional[str], to_unit: str) -> float:
|
||||
"""Converts between length, area, and volume units
|
||||
|
||||
|
||||
Reference in New Issue
Block a user