forked from youen/assembly_handbook
Merge pull request 'Part name used in sub assembly are now properly display' (#1) from AndreasL/assembly_handbook:master into master
Reviewed-on: youen/assembly_handbook#1
This commit is contained in:
commit
078ce07b86
@ -70,6 +70,7 @@ class AHB_New_Step:
|
|||||||
|
|
||||||
view = doc.addObject('TechDraw::DrawViewPart', 'View')
|
view = doc.addObject('TechDraw::DrawViewPart', 'View')
|
||||||
view.Perspective = False
|
view.Perspective = False
|
||||||
|
view.CoarseView = True
|
||||||
view.addProperty("App::PropertyString", "Assembly_handbook_PreviousStepView", "Assembly_handbook")
|
view.addProperty("App::PropertyString", "Assembly_handbook_PreviousStepView", "Assembly_handbook")
|
||||||
view.addProperty("App::PropertyBool", "Assembly_handbook_RasterView", "Assembly_handbook")
|
view.addProperty("App::PropertyBool", "Assembly_handbook_RasterView", "Assembly_handbook")
|
||||||
view.Assembly_handbook_RasterView = raster_view
|
view.Assembly_handbook_RasterView = raster_view
|
||||||
|
@ -542,6 +542,8 @@ class TechDrawExtensions:
|
|||||||
return part.Document.Name + '#' + part.Name
|
return part.Document.Name + '#' + part.Name
|
||||||
|
|
||||||
def isPartLink(self, obj):
|
def isPartLink(self, obj):
|
||||||
|
if obj is None:
|
||||||
|
return False
|
||||||
if obj.TypeId == 'App::Link':
|
if obj.TypeId == 'App::Link':
|
||||||
return True
|
return True
|
||||||
if obj.TypeId == 'Part::FeaturePython' and hasattr(obj, 'LinkedObject'): # variant link
|
if obj.TypeId == 'Part::FeaturePython' and hasattr(obj, 'LinkedObject'): # variant link
|
||||||
@ -550,7 +552,7 @@ class TechDrawExtensions:
|
|||||||
|
|
||||||
def getPartDisplayName(self, obj):
|
def getPartDisplayName(self, obj):
|
||||||
if self.isPartLink(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:
|
if 'Assembly_handbook_PartDisplayName' in linked_obj.PropertiesList:
|
||||||
return linked_obj.Assembly_handbook_PartDisplayName
|
return linked_obj.Assembly_handbook_PartDisplayName
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user