array attributes to python

   10217   9   1
User Avatar
Member
98 posts
Joined: Jan. 2008
Online
I have a per-point integer array attribute which I would like to access in python but when I try to so I get only zeros. Are array attributes accessible with the “point.attribValue(“attribname”)” method?
User Avatar
Member
678 posts
Joined: July 2005
Offline
Have you solved this?

I'm facing the same problem. floatAttribValue() is for attribs of size 1, floatListAttribValue() should in theory return tuple, but it looks that it's only for vectors and such, not when you have array.

Let's say you have on each point, anyone knows how to access array attribute per point in Python?
User Avatar
Member
5 posts
Joined: Aug. 2014
Offline
I'm having the same problem, trying this with Houdini 14.0.472:

I have an attribute that I created of type “Integer Array” and in Python when I try to access this attr it's not working…

>>> print geo.points().attribValue(“myIntArray”)
0

Stumped, I saw there was another method that looks like what I needed however…
>>> print geo.points().intListAttribValue(“myIntArray”)
(0,)


But the data is there–If I use vex in a wrangle I can get access to the values:
>>> printf(“attr: %g\n”, i@myIntArray);
attr: {2, 26, 50}

I'd rather not write a wrangle to copy this array to an N sized int just to access it in Python but maybe that's what I have to do?

Anyone know how to access array attributes from Python?

thanks!
User Avatar
Staff
4159 posts
Joined: Sept. 2007
Online
Unfortunately, array attribute Python bindings were missed, but it's been logged. Hopefully before long we'll see them!
I'm o.d.d.
User Avatar
Member
5 posts
Joined: Aug. 2014
Offline
I'm working around this by copying this array data with vex to a different attribute type so I can access it in Python. Kinda gross but I'm glad the root problem has been logged.

Thanks yet again goldleaf!
User Avatar
Member
126 posts
Joined: Aug. 2010
Offline
Hei, I'm suffering from the same problem! Any chance this will be fixed soon?
Edited by aeaeaeae - July 8, 2016 07:31:44
User Avatar
Member
126 posts
Joined: Aug. 2010
Offline
is this fixed yet??
User Avatar
Staff
6175 posts
Joined: July 2005
Offline
The intListAttribValue() should work in 16.0.
User Avatar
Member
30 posts
Joined: July 2005
Offline
Hi Jeff… Can you point me at the docs for intListAttribValues(), please - and an example in use. I'm not immediately finding it. Thanks!
My avatar was rendered from PRISMS
User Avatar
Member
7737 posts
Joined: Sept. 2011
Online
Hi Caleb,
You can find it under hou.Geometry or one of the geometry class pages such as hou.Point.

http://www.sidefx.com/docs/houdini/hom/hou/Geometry#intListAttribValue [www.sidefx.com]
http://www.sidefx.com/docs/houdini/hom/hou/Point#intListAttribValue [www.sidefx.com]
  • Quick Links