mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 08:45:22 +00:00
Fix #5337. You can now delete grids, which recursively delete all axes. Edit mode now also respects locking.
This commit is contained in:
@@ -1594,6 +1594,9 @@ class OverrideModeSetEdit(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
element = tool.Ifc.get_entity(obj)
|
element = tool.Ifc.get_entity(obj)
|
||||||
if not element:
|
if not element:
|
||||||
continue
|
continue
|
||||||
|
if tool.Geometry.is_locked(element):
|
||||||
|
obj.select_set(False)
|
||||||
|
continue
|
||||||
representation = tool.Geometry.get_active_representation(obj)
|
representation = tool.Geometry.get_active_representation(obj)
|
||||||
if not representation:
|
if not representation:
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import logging
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
import ifcopenshell.api
|
import ifcopenshell.api
|
||||||
|
import ifcopenshell.api.grid
|
||||||
import ifcopenshell.geom
|
import ifcopenshell.geom
|
||||||
import ifcopenshell.guid
|
import ifcopenshell.guid
|
||||||
import ifcopenshell.util.element
|
import ifcopenshell.util.element
|
||||||
@@ -118,12 +119,12 @@ class Geometry(bonsai.core.tool.Geometry):
|
|||||||
element = tool.Ifc.get_entity(obj)
|
element = tool.Ifc.get_entity(obj)
|
||||||
if not element:
|
if not element:
|
||||||
return
|
return
|
||||||
if element.is_a("IfcAnnotation") and element.ObjectType == "DRAWING":
|
elif element.is_a("IfcAnnotation") and element.ObjectType == "DRAWING":
|
||||||
return bonsai.core.drawing.remove_drawing(tool.Ifc, tool.Drawing, drawing=element)
|
return bonsai.core.drawing.remove_drawing(tool.Ifc, tool.Drawing, drawing=element)
|
||||||
if element.is_a("IfcRelSpaceBoundary"):
|
elif element.is_a("IfcRelSpaceBoundary"):
|
||||||
ifcopenshell.api.run("boundary.remove_boundary", tool.Ifc.get(), boundary=element)
|
ifcopenshell.api.run("boundary.remove_boundary", tool.Ifc.get(), boundary=element)
|
||||||
return bpy.data.objects.remove(obj)
|
return bpy.data.objects.remove(obj)
|
||||||
if element.is_a("IfcGridAxis"):
|
elif element.is_a("IfcGridAxis"):
|
||||||
is_last_axis = False
|
is_last_axis = False
|
||||||
# Deleting the last W axis is OK
|
# Deleting the last W axis is OK
|
||||||
if ((grid := element.PartOfU) and len(grid[0].UAxes) == 1) or (
|
if ((grid := element.PartOfU) and len(grid[0].UAxes) == 1) or (
|
||||||
@@ -134,6 +135,12 @@ class Geometry(bonsai.core.tool.Geometry):
|
|||||||
return
|
return
|
||||||
ifcopenshell.api.run("grid.remove_grid_axis", tool.Ifc.get(), axis=element)
|
ifcopenshell.api.run("grid.remove_grid_axis", tool.Ifc.get(), axis=element)
|
||||||
return bpy.data.objects.remove(obj)
|
return bpy.data.objects.remove(obj)
|
||||||
|
elif element.is_a("IfcGrid"):
|
||||||
|
axes = list(element.UAxes or []) + list(element.VAxes or []) + list(element.WAxes or [])
|
||||||
|
for axis in axes:
|
||||||
|
if axis_obj := tool.Ifc.get_object(axis):
|
||||||
|
bpy.data.objects.remove(axis_obj)
|
||||||
|
ifcopenshell.api.grid.remove_grid_axis(tool.Ifc.get(), axis=axis)
|
||||||
|
|
||||||
collection = obj.BIMObjectProperties.collection
|
collection = obj.BIMObjectProperties.collection
|
||||||
if collection:
|
if collection:
|
||||||
|
|||||||
Reference in New Issue
Block a user