Accessing Arrays in TOPs

   481   5   1
User Avatar
Member
4 posts
Joined: July 2023
Offline
In TOPs after adding a “Wait For All” node and adding all the attributes to an array I have a really hard time accessing the values.
Does anyone know how I can print all the values in the array with a “pythonscript” node?
User Avatar
Member
318 posts
Joined: Jan. 2013
Offline
Hi,
Can you show an example of what your network looks like?
User Avatar
Member
4 posts
Joined: July 2023
Offline
Hi Alex,


here are the steps:

find all the usd files

in wait for all I append the values to an array


now I have all the filenames in an array on one job


when I print the attribute it is not an array, but only prints the first value
Image Not Found


I have tried:
item = work_item.stringAttribArray("`@filename`")
print( item )

but that doesn't seem to work either
Edited by sd_tony - Dec. 6, 2024 06:09:32

Attachments:
print_filename.png (27.0 KB)
appendToArray.png (120.5 KB)

User Avatar
Member
4 posts
Joined: July 2023
Offline
Sorry I am getting a bit confused with the syntaxes


It is listing attributes so I don't need the @

This works:

item = work_item.attribArray("filename")
print (item )
User Avatar
Member
318 posts
Joined: Jan. 2013
Offline
This method only needs the attribute name
names = work_item.stringAttribArray("filename")
print(names)
User Avatar
Member
6 posts
Joined: June 2015
Offline
Thanks Alex! I just discovered that myself after spending way too much time on this 😅
  • Quick Links