Message 1 of 5
linked assembly Bug? can't traverse over assy

Not applicable
09-28-2020
01:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I tried to modify the traverse-sample to output all occurrences with joints. The Script worked fine while testing with small assemblies, but as soon as I tested it on a larger assy with sub-assemblies, the occurrences in linked assys won´t get detected. Here is my modified script, it gets 'root.occurrences.asList' and an 'empty list'.
def traverseAssembly(occurrences, occList):
''' outputs a list of occurrences that have joints
'''
occ = adsk.fusion.Occurrence.cast(None)
for occ in occurrences:
try:
if occ.joints.count: # if the occurrence has joints, append the occ's name to the list
occList.append(occ.name)
except:
print('Error')
if occ.childOccurrences: # if there are childs, repeat the function
occList = traverseAssembly(occ.childOccurrences, occList)
if len(occList):
print(occList[-1])
return occList
If I manually break the link, the script works fine. So I think there is an issue with the link of the components?
Does anybody know if that's a bug or is my code wrong?
@goyals, can you help?
Thanks.