From 6b3cc54afc1134345c828add0158a321702012bb Mon Sep 17 00:00:00 2001 From: Petru Conduraru Date: Fri, 10 Jul 2026 13:06:00 +0300 Subject: [PATCH] ifcfm: convert COBie Coordinate space points to project units (#5926) In the cobie24 Coordinate sheet, Floor rows use get_local_placement, whose values are in the project length unit, but Space rows come from ifcopenshell.geom create_shape, whose vertices are in SI metres, and the space branch never scaled them back. So on a non metre model (for example millimetres) the Coordinate sheet mixed units a thousandfold apart and disagreed with the Facility sheet's declared LinearUnits. Scale the space bounding box by the project unit scale so the whole Coordinate sheet is consistent. A metre model is unchanged since the scale is 1. Co-Authored-By: Claude Opus 4.8 --- src/ifcfm/ifcfm/cobie24.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ifcfm/ifcfm/cobie24.py b/src/ifcfm/ifcfm/cobie24.py index b83a4abe08..40533bb3bb 100644 --- a/src/ifcfm/ifcfm/cobie24.py +++ b/src/ifcfm/ifcfm/cobie24.py @@ -28,6 +28,7 @@ import ifcopenshell.util.fm import ifcopenshell.util.placement import ifcopenshell.util.shape import ifcopenshell.util.system +import ifcopenshell.util.unit from ifcopenshell.util.shape_builder import np_matrix_to_euler # The original BIMServer plugin has a function called ifcToCOBie: @@ -920,6 +921,11 @@ def get_coordinate_data_(element: ifcopenshell.entity_instance) -> Generator[dic verts = ifcopenshell.util.shape.get_shape_vertices(shape, shape.geometry) categories = ("box-lowerleft", "box-upperright") bbox = ifcopenshell.util.shape.get_bbox(verts) + # Geometry vertices are in SI metres, but Floor rows use the raw placement in + # project length units. Convert space points to project units so the whole + # Coordinate sheet is consistent with the Facility LinearUnits. + unit_scale = ifcopenshell.util.unit.calculate_unit_scale(element.file) + bbox = [point / unit_scale for point in bbox] base_data = base_data | { "Category": "point", "SheetName": "Space",