Python create attribute

   2291   2   1
User Avatar
Member
10 posts
Joined: Nov. 2018
Offline
beginner for TOPs

I wanna know how to add attribute for each index,for example,I have a string array,and i wanna gave array element for each index.

Help pls
User Avatar
Staff
586 posts
Joined: May 2014
Offline
You can use a Python Script node to set string array attributes. For example:

work_item.setStringAttrib("name", "value", 0)
work_item.setStringAttrib("name", "other_value", 1)
work_item.setStringAttrib("name", "third_value", 2)

If you're on 18.0, you'll probably want to set the Evaluate Script During parameter to “Generate” as well, so the attributes are created during the work item generation step.
User Avatar
Member
10 posts
Joined: Nov. 2018
Offline
tpetrick
You can use a Python Script node to set string array attributes. For example:

work_item.setStringAttrib("name", "value", 0)
work_item.setStringAttrib("name", "other_value", 1)
work_item.setStringAttrib("name", "third_value", 2)

If you're on 18.0, you'll probably want to set the Evaluate Script During parameter to “Generate” as well, so the attributes are created during the work item generation step.
Sir,Hou.attribype.global can be translate what type of PDG attributr?
  • Quick Links