Fix bug where removing mapped representations leaving you with nothing was a poor user experience

This commit is contained in:
Dion Moult
2021-02-20 18:03:03 +11:00
parent 1892e9cc86
commit 0178804feb
2 changed files with 3 additions and 6 deletions
@@ -20,7 +20,6 @@ class Usecase:
for item in self.settings["representation"].Items:
item.MappingSource = dummy_representation_map
ifcopenshell.util.element.remove_deep(self.file, self.settings["representation"])
self.file.remove(self.settings["representation"])
def remove_entire_representation_tree(self):
dummy_context = self.file.create_entity("IfcRepresentationContext")
@@ -181,13 +181,11 @@ class UnassignClass(bpy.types.Operator):
product = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
self.remove_representations(obj, product)
IfcStore.unlink_element(product, obj)
usecase = remove_product.Usecase(
self.file,
{"product": product},
)
usecase.execute()
remove_product.Usecase(self.file, {"product": product}).execute()
if "/" in obj.name and obj.name[0:3] == "Ifc":
obj.name = "/".join(obj.name.split("/")[1:])
if obj.data and obj.data.name == "Void":
bpy.data.objects.remove(obj)
return {"FINISHED"}
def remove_representations(self, obj, product):