forked from youen/assembly_handbook
fixed bug when selecting linked objects
This commit is contained in:
parent
9dbaa141f1
commit
dd3044dbb6
@ -16,11 +16,15 @@ class DocLinkObserver:
|
|||||||
objList = App.getDocument(doc).getObject(obj).getSubObjectList(sub)
|
objList = App.getDocument(doc).getObject(obj).getSubObjectList(sub)
|
||||||
# Build the name of the selected sub-object for multiple sub-assembly levels
|
# Build the name of the selected sub-object for multiple sub-assembly levels
|
||||||
subObjName = ''
|
subObjName = ''
|
||||||
# first look for the linked object of the selected entity:
|
# look for the link to the selected entity.
|
||||||
# Get linked object name that handles sub-sub-assembly
|
# We select the first link we find (removing the "break" statement would instead select the bottom-most sub-sub-...-sub-assembly)
|
||||||
for subObj in objList:
|
for subObj in objList:
|
||||||
if subObj.TypeId=='App::Link':
|
if subObj.TypeId=='App::Link':
|
||||||
subObjName = subObjName + subObj.Name + '.'
|
subObjName = subObjName + subObj.Name + '.'
|
||||||
|
break
|
||||||
|
elif subObj.TypeId == 'Part::FeaturePython' and hasattr(subObj, 'LinkedObject'): # variant link
|
||||||
|
subObjName = subObjName + subObj.Name + '.'
|
||||||
|
break
|
||||||
# if no App::Link found, let's look for other things:
|
# if no App::Link found, let's look for other things:
|
||||||
if subObjName == '':
|
if subObjName == '':
|
||||||
for subObj in objList:
|
for subObj in objList:
|
||||||
@ -28,8 +32,9 @@ class DocLinkObserver:
|
|||||||
# the objList contains also the top-level object, don't count it twice
|
# the objList contains also the top-level object, don't count it twice
|
||||||
if subObj.Name != obj:
|
if subObj.Name != obj:
|
||||||
subObjName = subObjName + subObj.Name + '.'
|
subObjName = subObjName + subObj.Name + '.'
|
||||||
|
break
|
||||||
# if we found something, make it the selection
|
# if we found something, make it the selection
|
||||||
if subObjName != '':
|
#if subObjName != '':
|
||||||
Gui.Selection.removeSelection(doc, obj, sub)
|
Gui.Selection.removeSelection(doc, obj, sub)
|
||||||
Gui.Selection.addSelection(doc, obj, subObjName)
|
Gui.Selection.addSelection(doc, obj, subObjName)
|
||||||
#FCC.PrintMessage("*"+doc+"*"+obj+"*"+subObjName+"*\n")
|
#FCC.PrintMessage("*"+doc+"*"+obj+"*"+subObjName+"*\n")
|
||||||
|
Loading…
Reference in New Issue
Block a user