Jump to content
Sign in to follow this  
MBaadsgaard

hou.Geometry.point() not working..?

Recommended Posts

Simple problem: I have a foreach loop running over points on a curve each with an attribute that is randomized for which variety of geometry it needs to use.

The varieties are coming from 1 input, but where each variety has a different primitive attribute for which variety it is (I get the geometry in from Unity).

I got the geometry getting piped in to a copy to points node, in the foreach, but before that I need to delete, per loop, what is not used. Or I need to pick it, I don't know.

I just need the loop to select a variety based on the randomly generated attribute.

So the way I did it was with a delete node, with an expression with the following python code:

 

curVal = hou.pwd().curPrim().attribValue("namechoice") 
compareVal = hou.node("../foreach_plank_start").geometry().point(0).attribValue("nameselect")
if curVal != compareVal:
    return 0
else:
    return 1

Comparing the primitive attribute (int) with the point attribute (int).

 

But.. I get this error:

Error:       Unable to evaluate expression (
Traceback (most recent call last):
  File "<stdin>", line 3, in expression
AttributeError: 'Geometry' object has no attribute 'point'
 (/obj/worknode/fence_maker/delete2/filter)).

 

Explanations to why hou.Geometry.point() is not "valid", suggestions for other ways to code it or suggestions for other way to do the network are most welcome!

Share this post


Link to post
Share on other sites

Try using the full path to the geometry you need to target. That ../ stuff can get messed up.

print hou.node("/obj/geo1/foreach_begin1").geometry().point(0)

 

Share this post


Link to post
Share on other sites
33 minutes ago, Atom said:

Try using the full path to the geometry you need to target. That ../ stuff can get messed up.


print hou.node("/obj/geo1/foreach_begin1").geometry().point(0)

 

This is all happening in an HDA that will be used in Unity, so I have to keep all paths relative.

I tried doing it in a new scene with an absolute path, it still won't budge.

Did you get that example from some of your work or is it just an example?

Edited by MBaadsgaard

Share this post


Link to post
Share on other sites

seems like point() is a function added in H17. At least I can't find it in the 16.5 docs (which is the version I tried it with myself and got the same error) - can't try and confirm though as I don't have 17

so if that's the case, you are stuck for now with the overhead of using points() [returning a tuple] and then accessing your desired index of that tuple

Edited by 3dome

Share this post


Link to post
Share on other sites
6 minutes ago, 3dome said:

seems like point() is a function added in H17. At least I can't find it in the 16.5 docs (which is the version I tried it with myself and got the same error) - can't try and confirm though as I don't have 17

so if that's the case, you are stuck for now with the overhead of using points() [returning a tuple] and then accessing your desired index of that tuple

Damn, I didn't realize. Thanks!

Yea I am on 16.5..

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×