Jump to content

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


MBaadsgaard

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!

Link to comment
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
Link to comment
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
Link to comment
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..

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...