From 11116df87e901c6d23357aa933929cf957ecb23a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9as=20Livet?= Date: Thu, 24 Nov 2022 17:39:40 +0100 Subject: [PATCH] Part name used in sub assembly are now properly display Step view have CoerceView set to True by default --- ahb_cmd_new_step.py | 1 + ahb_techdraw_extensions.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ahb_cmd_new_step.py b/ahb_cmd_new_step.py index 8e924bf..4b29f4b 100644 --- a/ahb_cmd_new_step.py +++ b/ahb_cmd_new_step.py @@ -70,6 +70,7 @@ class AHB_New_Step: view = doc.addObject('TechDraw::DrawViewPart', 'View') view.Perspective = False + view.CoarseView = True view.addProperty("App::PropertyString", "Assembly_handbook_PreviousStepView", "Assembly_handbook") view.addProperty("App::PropertyBool", "Assembly_handbook_RasterView", "Assembly_handbook") view.Assembly_handbook_RasterView = raster_view diff --git a/ahb_techdraw_extensions.py b/ahb_techdraw_extensions.py index a6ada90..c57e86d 100644 --- a/ahb_techdraw_extensions.py +++ b/ahb_techdraw_extensions.py @@ -542,6 +542,8 @@ class TechDrawExtensions: return part.Document.Name + '#' + part.Name def isPartLink(self, obj): + if obj is None: + return False if obj.TypeId == 'App::Link': return True if obj.TypeId == 'Part::FeaturePython' and hasattr(obj, 'LinkedObject'): # variant link @@ -550,7 +552,7 @@ class TechDrawExtensions: def getPartDisplayName(self, obj): if self.isPartLink(obj): - linked_obj = obj.LinkedObject + linked_obj = obj.SourceObject if hasattr(obj, 'SourceObject') else obj.LinkedObject if 'Assembly_handbook_PartDisplayName' in linked_obj.PropertiesList: return linked_obj.Assembly_handbook_PartDisplayName else: