Skip to content

Commit 6d7a6ee

Browse files
committed
fixed bug removing representation item
if you'd click on "remove item" button for some item it wouldn't remove the corresponding item but would go for removing active item instead
1 parent c520e0e commit 6d7a6ee

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/blenderbim/blenderbim/bim/module/geometry/operator.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,6 +1614,8 @@ class RemoveRepresentationItem(bpy.types.Operator, Operator):
16141614
bl_label = "Remove Representation Item"
16151615
bl_options = {"REGISTER", "UNDO"}
16161616

1617+
representation_item_id: bpy.props.IntProperty()
1618+
16171619
@classmethod
16181620
def poll(cls, context):
16191621
if context.active_object is None or len(context.active_object.BIMGeometryProperties.items) <= 1:
@@ -1628,8 +1630,7 @@ def _execute(self, context):
16281630
props = obj.BIMGeometryProperties
16291631
ifc_file = tool.Ifc.get()
16301632

1631-
representation_item_id = props.items[props.active_item_index].ifc_definition_id
1632-
representation_item = ifc_file.by_id(representation_item_id)
1633+
representation_item = ifc_file.by_id(self.representation_item_id)
16331634
tool.Geometry.remove_representation_item(representation_item)
16341635
tool.Geometry.reload_representation(obj)
16351636

src/blenderbim/blenderbim/bim/module/geometry/ui.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,4 +510,5 @@ def draw_item(self, context, layout, data, item, icon, active_data, active_propn
510510
row.label(text=item.name, icon=icon)
511511
if item.layer:
512512
row.label(text="", icon="STICKY_UVS_LOC")
513-
row.operator("bim.remove_representation_item", icon="X", text="")
513+
op = row.operator("bim.remove_representation_item", icon="X", text="")
514+
op.representation_item_id = item.ifc_definition_id

0 commit comments

Comments
 (0)