iterating over prims

   3930   2   0
User Avatar
Member
224 posts
Joined: June 2009
Offline
got stuck again…

I have a polygon with an attribute that specifies a thickness. I would like to use the Wireframe or Polywire SOP to thicken my line, and I would like to set the radius according to my attribute.

I tried writing an expression in the Radius parameter box, like this

prim = hou.pwd().curPrim()
return prim.attribValue(“thickness”)

but that throws an error… the error message says: “ Not currently iterating over primitives”

Any suggestions…
Patrick
User Avatar
Member
224 posts
Joined: June 2009
Offline
I figured out one way of doing it - not sure if it is the best, but it works. I have used a ForEach loop, and then inside the loop, I PolyWire and retrieve the attribute value for the radius

See attached

Attachments:
iterating.hipnc (36.2 KB)

Patrick
User Avatar
Member
1928 posts
Joined: Nov. 2006
Offline
The error message is a result of the fact that the PolyWire Sop doesn't perform its operation on a primitive by primitive basis (it doesn't iterate over each primitive and operate on it individually like you want it), hence the error message about it not iterating over primitives. Using the ForEach is probably your best bet.
Graham Thompson, Technical Artist @ Rockstar Games
  • Quick Links