mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Fix bug where only a light removal occured when removing elements. Now, a full geometry purge is done as well.
This commit is contained in:
@@ -24,7 +24,7 @@ class Data:
|
||||
else:
|
||||
representations = []
|
||||
elif product.is_a("IfcTypeProduct"):
|
||||
representations = [rm.MappedRepresentation for rm in product.RepresentationMaps]
|
||||
representations = [rm.MappedRepresentation for rm in product.RepresentationMaps or []]
|
||||
for representation in representations:
|
||||
c = representation.ContextOfItems
|
||||
rep_id = int(representation.id())
|
||||
|
||||
@@ -230,8 +230,7 @@ class RemoveRepresentation(bpy.types.Operator):
|
||||
bpy.data.meshes.remove(mesh)
|
||||
product = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
|
||||
unassign_representation.Usecase(self.file, {"product": product, "representation": representation}).execute()
|
||||
if not is_mapped_representation:
|
||||
remove_representation.Usecase(self.file, {"representation": representation}).execute()
|
||||
remove_representation.Usecase(self.file, {"representation": representation}).execute()
|
||||
Data.load(product.id())
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import blenderbim.bim.module.root.create_product as create_product
|
||||
import blenderbim.bim.module.root.remove_product as remove_product
|
||||
import blenderbim.bim.module.root.reassign_class as reassign_class
|
||||
import blenderbim.bim.module.root.copy_class as copy_class
|
||||
from blenderbim.bim.module.geometry.data import Data as GeometryData
|
||||
from blenderbim.bim.ifc import IfcStore
|
||||
|
||||
|
||||
@@ -178,6 +179,7 @@ class UnassignClass(bpy.types.Operator):
|
||||
if not obj.BIMObjectProperties.ifc_definition_id:
|
||||
continue
|
||||
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,
|
||||
@@ -188,6 +190,11 @@ class UnassignClass(bpy.types.Operator):
|
||||
obj.name = "/".join(obj.name.split("/")[1:])
|
||||
return {"FINISHED"}
|
||||
|
||||
def remove_representations(self, obj, product):
|
||||
GeometryData.load(product.id())
|
||||
for representation_id in GeometryData.products[product.id()]:
|
||||
bpy.ops.bim.remove_representation(obj=obj.name, representation_id=representation_id)
|
||||
|
||||
|
||||
class UnlinkObject(bpy.types.Operator):
|
||||
bl_idname = "bim.unlink_object"
|
||||
|
||||
Reference in New Issue
Block a user