papsphilip Posted December 16, 2021 Share Posted December 16, 2021 How can i export all wedge attributes and custom attributes i created along the line into a single csv? I made this work with CSV TOP node but i had to manually write the attributes. Using option 'By Attribute' i can specify 'wedgeattribs' as the attribute array to read from, but the other custom made attributes do not appear there Also tried in a python script work_item.attribNames() but this gives you every attribute listed - even the ones created automatically like the value type for each wedge attribute Quote Link to comment Share on other sites More sharing options...
papsphilip Posted December 16, 2021 Author Share Posted December 16, 2021 I ended up having all my custom attributes start with "__" for example "__myattrib" So i took the wedgeattribs list and the attribNames() list - filtered the last on to keep only names with "__" as a substring and finally merged them and wrote them to an attribute. import pdg active_item = pdg.EvaluationContext.workItem() attribs = work_item.attribNames() #get all attribute names search = "__" myattribs = [attr for attr in attribs if search in attr] #filter them - my custom attributes begin with __ data = work_item.data wedges = data.stringDataArray("wedgeattribs") # get all wedges attributes values = myattribs + wedges #merge two lists work_item.setStringAttrib('a', values) #create string array atribute to use in csv output Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.