Fix #7948: Fix duplicate not applying openings to geometry#7963
Open
theoryshaw wants to merge 1 commit intov0.8.0from
Open
Fix #7948: Fix duplicate not applying openings to geometry#7963theoryshaw wants to merge 1 commit intov0.8.0from
theoryshaw wants to merge 1 commit intov0.8.0from
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #7948: Duplicated elements with
HasOpeningsdon't show opening in geometryProblem
When duplicating an object (via
bim.override_object_duplicate_move_macro) that has an appliedIfcOpeningElement(i.e. the element hasHasOpenings), 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:
Root Cause
The duplication path in
tool.Geometry.duplicate_ifc_objectscorrectly callsifcopenshell.api.root.copy_class, which — per its documented behaviour — copiesIfcRelVoidsElementrelationships into IFC. The new element therefore has validHasOpeningsdata.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_idrepointed to the new representation. Thehas_openings_appliedflag readsTrue(inherited from the copy), but the actual boolean subtraction geometry was never computed for the new element.The existing
recreate_decompositionslogic intool.Roothandles the inverse case — elements that fill a void (doors/windows) — by callingswitch_representationon 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 carriesHasOpenings.Fix
After
recreate_decompositionscompletes, iterate over all newly created elements. For any new element that has unfilledHasOpenings(openings without a filling — filled openings are already handled byrecreate_decompositions), calltool.Model.reload_body_representation()on its Blender object. This is the same call thatbim.edit_openingsuses internally, and it triggersswitch_representationso the IFC geometry engine recomputes the mesh with the opening boolean subtraction applied.Files Changed
duplicate_ifc_objects: reload body representation for new elements with unfilled openings