MBaadsgaard Posted November 23, 2018 Share Posted November 23, 2018 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! Quote Link to comment Share on other sites More sharing options...
Atom Posted November 23, 2018 Share Posted November 23, 2018 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) Quote Link to comment Share on other sites More sharing options...
MBaadsgaard Posted November 23, 2018 Author Share Posted November 23, 2018 (edited) 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 November 23, 2018 by MBaadsgaard Quote Link to comment Share on other sites More sharing options...
3dome Posted November 23, 2018 Share Posted November 23, 2018 (edited) 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 November 23, 2018 by 3dome Quote Link to comment Share on other sites More sharing options...
MBaadsgaard Posted November 23, 2018 Author Share Posted November 23, 2018 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.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.