mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Fix #7211. Explain to user why they can't remove the last grid axis.
This commit is contained in:
@@ -882,7 +882,16 @@ class OverrideDelete(bpy.types.Operator):
|
||||
continue
|
||||
if ifcopenshell.util.element.get_pset(element, "BBIM_Array"):
|
||||
self.report({"INFO"}, "Elements that are part of an array cannot be deleted.")
|
||||
return {"FINISHED"}
|
||||
continue
|
||||
if element.is_a("IfcGridAxis"):
|
||||
# Deleting the last W axis is OK
|
||||
if ((grid := element.PartOfU) and len(grid[0].UAxes) == 1) or (
|
||||
(grid := element.PartOfV) and len(grid[0].VAxes) == 1
|
||||
):
|
||||
self.report(
|
||||
{"INFO"}, "The last grid axis of a grid cannot be deleted. Delete the grid instead."
|
||||
)
|
||||
continue
|
||||
tool.Geometry.delete_ifc_object(obj)
|
||||
elif tool.Geometry.is_representation_item(obj):
|
||||
tool.Geometry.delete_ifc_item(obj)
|
||||
|
||||
@@ -243,13 +243,10 @@ class Geometry(bonsai.core.tool.Geometry):
|
||||
tool.Boundary.undecorate_boundary(obj)
|
||||
return bpy.data.objects.remove(obj)
|
||||
elif element.is_a("IfcGridAxis"):
|
||||
is_last_axis = False
|
||||
# Deleting the last W axis is OK
|
||||
if ((grid := element.PartOfU) and len(grid[0].UAxes) == 1) or (
|
||||
(grid := element.PartOfV) and len(grid[0].VAxes) == 1
|
||||
):
|
||||
is_last_axis = True
|
||||
if is_last_axis:
|
||||
return
|
||||
ifcopenshell.api.grid.remove_grid_axis(ifc_file, axis=element)
|
||||
return bpy.data.objects.remove(obj)
|
||||
|
||||
Reference in New Issue
Block a user