mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
purging of cost and task inverse relationships in ifcopenshell.api, and amendement to cost item values editing UX in BlenderBIM
This commit is contained in:
@@ -332,6 +332,7 @@ class EnableEditingCostItemValues(bpy.types.Operator):
|
||||
props = context.scene.BIMCostProperties
|
||||
props.active_cost_item_id = self.cost_item
|
||||
props.cost_item_editing_type = "VALUES"
|
||||
bpy.ops.bim.disable_editing_cost_item_value()
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import ifcopenshell.api
|
||||
|
||||
|
||||
class Usecase:
|
||||
def __init__(self, file, **settings):
|
||||
self.file = file
|
||||
@@ -7,4 +10,13 @@ class Usecase:
|
||||
|
||||
def execute(self):
|
||||
# TODO: do a deep purge
|
||||
for inverse in self.file.get_inverse(self.settings["cost_item"]):
|
||||
if inverse.is_a("IfcRelNests"):
|
||||
if inverse.RelatingObject == self.settings["cost_item"]:
|
||||
for related_object in inverse.RelatedObjects:
|
||||
ifcopenshell.api.run("cost.remove_cost_item", self.file, cost_item=related_object)
|
||||
elif inverse.RelatedObjects == tuple(self.settings["cost_item"]):
|
||||
self.file.remove(inverse)
|
||||
elif inverse.is_a("IfcRelAssignsToControl"):
|
||||
self.file.remove(inverse)
|
||||
self.file.remove(self.settings["cost_item"])
|
||||
|
||||
@@ -25,4 +25,6 @@ class Usecase:
|
||||
ifcopenshell.api.run("sequence.remove_task", self.file, task=related_object)
|
||||
elif inverse.RelatedObjects == tuple(self.settings["task"]):
|
||||
self.file.remove(inverse)
|
||||
elif inverse.is_a("IfcRelAssignsToControl"):
|
||||
self.file.remove(inverse)
|
||||
self.file.remove(self.settings["task"])
|
||||
|
||||
Reference in New Issue
Block a user