Hi
Delving into python and noticed some trouble with getting array attributes with it. Scene attached.
When it comes to processing a whole geo an generate lists of an attribute's values in all elements or a list of the unique values, I'm guessing VEX is faster than Python, no? So I generated those in VEX and was expecting to collect them in Python, but no luck.
Am I missing something or are arrays not supported? Values fetched for arrays seem to be default: 0, “”, etc.
Thanks
Python: Arrays supported?
4239 6 2- probiner
- Member
- 340 posts
- Joined: June 2013
- Online
- Andr
- Member
- 900 posts
- Joined: Feb. 2016
- Offline
- probiner
- Member
- 340 posts
- Joined: June 2013
- Online
Thanks, that works!
When I was roaming hou.Geometry() [www.sidefx.com] I did a page search for “array” and nothing of the sort was picked up, so thought the other one was the way to go.
Cheers
When I was roaming hou.Geometry() [www.sidefx.com] I did a page search for “array” and nothing of the sort was picked up, so thought the other one was the way to go.
Cheers
- Andr
- Member
- 900 posts
- Joined: Feb. 2016
- Offline
Hello again,
I was trying to collect the values of a point attribute with the following:
and I get this error: “Attribute must support tuple access”
I guess that's because my attribute is an integer array, and that function can't deal with it?
Anyway, I can collect the arrays if I iterate through each point:
but I wanted to use the pointIntAttribValues() function because it is said to be faster than iterating through each point, when you want all the values for one attribute.
I was trying to collect the values of a point attribute with the following:
geo.pointIntAttribValues("myAttribute")
and I get this error: “Attribute must support tuple access”
I guess that's because my attribute is an integer array, and that function can't deal with it?
Anyway, I can collect the arrays if I iterate through each point:
allArrays = [] for point in geo.points(): myAttribute = point.intListAttribValue("myAttribute") allArrays.append(myAttribute)
but I wanted to use the pointIntAttribValues() function because it is said to be faster than iterating through each point, when you want all the values for one attribute.
- Johan Boekhoven
- Member
- 72 posts
- Joined:
- Offline
Big coincidence, I'm working on a weights exporter (unpacking capture weights first) where I need to use pointIntAttribValues as well.
Exactly for what Andr is saying…Any insights would be great, got a feeling it's a bug, because what other type then list can we store in a point attribute if we need variable lenght.
-Johan
Exactly for what Andr is saying…Any insights would be great, got a feeling it's a bug, because what other type then list can we store in a point attribute if we need variable lenght.
-Johan
Edited by Johan Boekhoven - Feb. 18, 2019 12:05:34
- probiner
- Member
- 340 posts
- Joined: June 2013
- Online
- Johan Boekhoven
- Member
- 72 posts
- Joined:
- Offline
Here's a test file, the error is:
So it seems that function can only pull int values that are “packed” as tuples. But if you think about it it makes little sense.
And the helpfile is quite ambiguous about the method.
return _hou.Geometry_pointIntAttribValues(*args)
OperationFailed: The attempted operation failed.
Attribute must support tuple access
So it seems that function can only pull int values that are “packed” as tuples. But if you think about it it makes little sense.
And the helpfile is quite ambiguous about the method.
-
- Quick Links