python - query the second/third component of an attribute

   5189   4   0
User Avatar
Member
345 posts
Joined:
Offline
Hi,

I am trying to access the second value of the float attribute (size of 3). How can I do this? Let say I have an attribute named centroid:

geo = hou.pwd().geometry()

geo.primFloatAttribValues('centroid1')
hou.hscriptExpression('prim(“../” + opinput(“.”, 0), $PR, “centroid”, 1)')

if I set the size back to 1 the following line works:

geo.primFloatAttribValues('centroid')


I assume the the attribute with the size greater then one returns a list or atuple. I tried to display it with following method which fails as well.
hou.ui.displayMessage(str(value(1)))
hou.ui.displayMessage(str(value))

I guess the same things is with vector attributes. Can somebody put me on a right track, please.
Thanks.
Kuba
User Avatar
Member
665 posts
Joined: July 2005
Offline
Has anyone had any luck with this?

I too, am curious.


cheers,
-j
User Avatar
Member
401 posts
Joined:
Offline
My geometry has an attribute called Cd:

me = hou.node('/obj/geo1/null_out').geometry().prims()
me.floatListAttribValue('Cd')



Is this what you are looking for?
this is not a science fair.
User Avatar
Member
665 posts
Joined: July 2005
Offline
Brilliant!

Heh, I actually did find it about to seconds after posting. That morning coffee is becoming more and more helpful.


Though, calling it float attribute to query a vector IS a bit counter intuitive…. :?
User Avatar
Member
401 posts
Joined:
Offline
indeed.
It's called floatListAttribValue which is another word for: AListOfFloatAttributeValues …
this is not a science fair.
  • Quick Links