Migrate remove_deep to remove_deep2 across API modules

remove_deep is deprecated and can silently delete elements still in use.
remove_deep2 requires zero inverses before removal, making it safer.
Also fixes a double-removal bug in remove_grid_axis and prevents
removing the last prop template from a pset template.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dion Moult
2026-03-21 15:56:12 +11:00
parent c026dd3b6e
commit bcfad8d96d
13 changed files with 264 additions and 17 deletions
@@ -47,4 +47,5 @@ def remove_unit(file: ifcopenshell.file, unit: ifcopenshell.entity_instance) ->
unit_assignment.Units = units
else:
file.remove(unit_assignment)
ifcopenshell.util.element.remove_deep(file, unit)
# TODO handle other possible unit inverses
ifcopenshell.util.element.remove_deep2(file, unit)