mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 23:00:53 +00:00
Fix #4178. Bug when removing the wrong classification reference.
This commit is contained in:
@@ -289,21 +289,23 @@ class RemoveClassificationReference(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
else:
|
else:
|
||||||
objects = [self.obj]
|
objects = [self.obj]
|
||||||
|
|
||||||
identification = tool.Ifc.get().by_id(self.reference)[0]
|
active_reference = tool.Ifc.get().by_id(self.reference)
|
||||||
|
identification = active_reference[1]
|
||||||
|
|
||||||
for obj in objects:
|
for obj in objects:
|
||||||
ifc_definition_id = blenderbim.bim.helper.get_obj_ifc_definition_id(context, obj, self.obj_type)
|
ifc_definition_id = blenderbim.bim.helper.get_obj_ifc_definition_id(context, obj, self.obj_type)
|
||||||
element = tool.Ifc.get().by_id(ifc_definition_id)
|
element = tool.Ifc.get().by_id(ifc_definition_id)
|
||||||
references = ifcopenshell.util.classification.get_references(element, should_inherit=False)
|
references = ifcopenshell.util.classification.get_references(element, should_inherit=False)
|
||||||
for reference in references:
|
for reference in references:
|
||||||
if reference[0] == identification:
|
if (identification and reference[1] == identification) or (
|
||||||
|
not identification and reference == active_reference
|
||||||
|
):
|
||||||
ifcopenshell.api.run(
|
ifcopenshell.api.run(
|
||||||
"classification.remove_reference",
|
"classification.remove_reference",
|
||||||
tool.Ifc.get(),
|
tool.Ifc.get(),
|
||||||
reference=reference,
|
reference=reference,
|
||||||
product=element,
|
product=element,
|
||||||
)
|
)
|
||||||
break
|
|
||||||
|
|
||||||
|
|
||||||
class EditClassificationReference(bpy.types.Operator, tool.Ifc.Operator):
|
class EditClassificationReference(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
|
|||||||
Reference in New Issue
Block a user