Skip to content

Fix #7948: Fix duplicate not applying openings to geometry#7963

Open
theoryshaw wants to merge 1 commit intov0.8.0from
fix/duplicate-opening-not-applied
Open

Fix #7948: Fix duplicate not applying openings to geometry#7963
theoryshaw wants to merge 1 commit intov0.8.0from
fix/duplicate-opening-not-applied

Conversation

@theoryshaw
Copy link
Copy Markdown
Member

@theoryshaw theoryshaw commented Apr 18, 2026

Fix #7948: Duplicated elements with HasOpenings don't show opening in geometry

Problem

When duplicating an object (via bim.override_object_duplicate_move_macro) that has an applied IfcOpeningElement (i.e. the element has HasOpenings), the duplicate's Blender mesh does not visually show the opening cut. The opening exists correctly in the IFC data, but the geometry appears as if no opening was ever applied.

As a workaround, the user had to manually trigger three operators in sequence to force the geometry to update:

bpy.ops.bim.show_openings()
bpy.ops.bim.update_openings_focus()
bpy.ops.bim.edit_openings(apply_all=True)

Root Cause

The duplication path in tool.Geometry.duplicate_ifc_objects correctly calls ifcopenshell.api.root.copy_class, which — per its documented behaviour — copies IfcRelVoidsElement relationships into IFC. The new element therefore has valid HasOpenings data.

However, the Blender-side mesh is never regenerated for this case. The new object's mesh data is just a copied data-block from the original, with its ifc_definition_id repointed to the new representation. The has_openings_applied flag reads True (inherited from the copy), but the actual boolean subtraction geometry was never computed for the new element.

The existing recreate_decompositions logic in tool.Root handles the inverse case — elements that fill a void (doors/windows) — by calling switch_representation on the voided host after re-creating the opening. But it does not handle the case where the host element itself is the one being duplicated and already carries HasOpenings.

Fix

After recreate_decompositions completes, iterate over all newly created elements. For any new element that has unfilled HasOpenings (openings without a filling — filled openings are already handled by recreate_decompositions), call tool.Model.reload_body_representation() on its Blender object. This is the same call that bim.edit_openings uses internally, and it triggers switch_representation so the IFC geometry engine recomputes the mesh with the opening boolean subtraction applied.

Files Changed

  • src/bonsai/bonsai/tool/geometry.py — duplicate_ifc_objects: reload body representation for new elements with unfilled openings

When duplicating an element with HasOpenings, copy_class (API)
correctly copies the IfcRelVoidsElement into IFC, but the new
object's Blender mesh was never regenerated — it was just a
data-block copy of the original. Call reload_body_representation
on any new element with unfilled HasOpenings so the opening
boolean subtraction is computed for the duplicated geometry.

Generated with the assistance of an AI coding tool.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When copying a object with a void applied, it doesn't apply the void again right away. you have to 'toggle opening' for it to apply.

1 participant