Fix #5493: Bonsai, error when using , in drawing names and clicking on the drawing in the sheet part of UI.

This commit is contained in:
Ryan Schultz
2024-09-25 18:36:39 -05:00
parent 41d5c391e1
commit d581174513
+13 -5
View File
@@ -436,15 +436,23 @@ class BIM_PT_sheets(Panel):
if active_sheet.reference_type == "DRAWING":
drawingnamesvg = active_sheet.name
drawingname = drawingnamesvg.split(".")[0]
drawingname = drawingnamesvg.split(".svg")[0]
ifc_file = tool.Ifc.get()
ifc_annotations = ifc_file.by_type("IfcAnnotation")
drawingid = None
for annotation in ifc_annotations:
if annotation.Name == drawingname:
Annotation_Name = annotation.Name.replace(",", "") # Remove commas
if Annotation_Name == drawingname:
drawingid = annotation.id()
drawing_button = row.row(align=True)
op = drawing_button.operator("bim.activate_drawing", icon="OUTLINER_OB_CAMERA", text="")
op.drawing = drawingid
break
if drawingid is not None:
drawing_button = row.row(align=True)
op = drawing_button.operator("bim.activate_drawing", icon="OUTLINER_OB_CAMERA", text="")
op.drawing = drawingid
else:
print(f"No matching drawing ID found for {drawingname}")
row.operator("bim.edit_sheet", icon="GREASEPENCIL", text="")
row.operator("bim.open_sheet", icon="URL", text="")