mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-06 07:51:47 +00:00
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 <noreply@anthropic.com>
This commit is contained in:
committed by
Dion Moult
parent
5c11946470
commit
6b3cc54afc
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user