From 20895bbf4b57c115f4ae07c7b9787885f0f905bb Mon Sep 17 00:00:00 2001 From: Youen Date: Mon, 2 Jan 2023 16:55:02 +0100 Subject: [PATCH] fixed error when a document is being loaded (balloons source object are not available yet) --- ahb_techdraw_extensions.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ahb_techdraw_extensions.py b/ahb_techdraw_extensions.py index 43dda58..5874fb8 100644 --- a/ahb_techdraw_extensions.py +++ b/ahb_techdraw_extensions.py @@ -521,14 +521,15 @@ class TechDrawExtensions: obj = self.getBalloonSourcePart(balloon) path = self.getBalloonSourcePartPath(balloon) - partDisplayName = 'Inconnu' if obj is None else self.getPartDisplayName(obj) + if obj is not None: + objectCenterView = workbench.techDrawExtensions.computePartCenter(view, obj, path) - objectCenterView = workbench.techDrawExtensions.computePartCenter(view, obj, path) - - balloon.OriginX = objectCenterView.x + balloon.Assembly_handbook_OriginOffsetX - balloon.OriginY = objectCenterView.y + balloon.Assembly_handbook_OriginOffsetY + balloon.OriginX = objectCenterView.x + balloon.Assembly_handbook_OriginOffsetX + balloon.OriginY = objectCenterView.y + balloon.Assembly_handbook_OriginOffsetY + + partDisplayName = 'Inconnu' if obj is None else self.getPartDisplayName(obj) + balloon.Text = partDisplayName - balloon.Text = partDisplayName balloon.ViewObject.Font = 'DejaVu Sans' balloon.ViewObject.Fontsize = 4 balloon.BubbleShape = 'Inspection'