mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 15:08:51 +00:00
Fixes #7507: Fix: Prevent spatial element placement corruption during drawing activation
sync_references was syncing spatial element placements FROM Blender TO IFC, corrupting their correct positions. Spatial elements (storeys, spaces, buildings) often have Blender objects at Z=0 for modeling convenience, but their IFC placements store absolute positions. Solution: Skip syncing placements for IfcSpatialElement and IfcGrid types, as their IFC placement is the source of truth. Fixes storey elevation corruption during SECTION_LEVEL annotation generation.
This commit is contained in:
@@ -487,12 +487,29 @@ def sync_references(
|
|||||||
potential_reference_elements = drawing_tool.get_potential_reference_elements(drawing)
|
potential_reference_elements = drawing_tool.get_potential_reference_elements(drawing)
|
||||||
|
|
||||||
for element in potential_reference_elements:
|
for element in potential_reference_elements:
|
||||||
|
# Skip spatial elements - their IFC placement is the source of truth
|
||||||
|
if element.is_a("IfcSpatialElement"):
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Skip grids - their IFC placement is the source of truth
|
||||||
|
if element.is_a("IfcGrid") or element.is_a("IfcGridAxis"):
|
||||||
|
continue
|
||||||
|
|
||||||
if (obj := ifc.get_object(element)) and ifc.is_moved(obj):
|
if (obj := ifc.get_object(element)) and ifc.is_moved(obj):
|
||||||
drawing_tool.sync_object_placement(obj)
|
drawing_tool.sync_object_placement(obj)
|
||||||
|
|
||||||
for element in drawing_tool.get_group_elements(group):
|
for element in drawing_tool.get_group_elements(group):
|
||||||
if not drawing_tool.is_auto_annotation(element):
|
if not drawing_tool.is_auto_annotation(element):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Skip spatial elements - should never sync their placement
|
||||||
|
if element.is_a("IfcSpatialElement"):
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Skip grids
|
||||||
|
if element.is_a("IfcGrid") or element.is_a("IfcGridAxis"):
|
||||||
|
continue
|
||||||
|
|
||||||
if (obj := ifc.get_object(element)) and ifc.is_moved(obj):
|
if (obj := ifc.get_object(element)) and ifc.is_moved(obj):
|
||||||
drawing_tool.sync_object_placement(obj)
|
drawing_tool.sync_object_placement(obj)
|
||||||
if not (reference_element := drawing_tool.get_assigned_product(element)):
|
if not (reference_element := drawing_tool.get_assigned_product(element)):
|
||||||
|
|||||||
Reference in New Issue
Block a user