willlinks Posted April 14, 2022 Share Posted April 14, 2022 (edited) Hi There, I'm trying to grab all attributes on the current work item in TOP and assign them to points in SOP. I wrote a python script and it works fine in SOP lively but I'm getting an error or crush when I kick off ROP Geometry Output TOP. I used python approach because I have several attributes to transfer and the attributes can be changed in the future so I'd like to avoid using @xxxx with hardcoded attribute names in SOP. It would be great to have some suggestions. Thanks you ~ Edited April 27, 2022 by willlinks Quote Link to comment Share on other sites More sharing options...
willlinks Posted April 18, 2022 Author Share Posted April 18, 2022 Here are my updated simplified hip and script. import pdg node = hou.pwd() geo = node.geometry() # Setting target attributes top_node = hou.node("/obj/topnet1/partition_items") top_node.cookWorkItems() target_work_items = top_node.getPDGNode().workItems target_attrib_names = target_work_items[0].attribNames() # Current work item work_item = pdg.workItem() attrib_names = work_item.attribNames() # Make point attributes for attr in attrib_names: if attr in target_attrib_names: val = work_item.attribArray(attr)[0] geo.addAttrib(hou.attribType.Point, attr, val) # Set point attribute values i = 0 for point in geo.points(): for attr in attrib_names: if attr in target_attrib_names: vals = work_item.attribArray(attr) if len(vals)>1: val = vals[i] point.setAttribValue(attr, val) i += 1 Hip File : pdg_attributes.zip I see the error below but I don't see the python node erroring out... Quote Link to comment Share on other sites More sharing options...
willlinks Posted April 27, 2022 Author Share Posted April 27, 2022 I got a work around for the issue. I removed all my target attribute lines in python SOP and made an array for the target attributes in TOP. 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.