tanzola Posted January 14, 2019 Share Posted January 14, 2019 Hey everybody, I'm trying to make a simple setup that starts out with one point from an add node. Then in a solver, a point wrangle gets the position of the last point on the incoming geometry and creates a new point with the position of the last point, plus an offset. The problem is that points are always being created at the position of the first point plus the offset. Here is the code in the point wrangle (running over Detail). The "num" attrib will always has a value of zero, so it looks like the primpoints function is giving me an empty list, but I don't know why. int pts[] = primpoints(0, (@primnum)); vector endpos = point(0, "P", pts[-1]); vector off = {0,1,0}; int npt = addpoint(0, endpos+off); setpointattrib(0, "num", npt, len(pts)); Thanks for taking a look! pointCreate_01.hipnc Quote Link to comment Share on other sites More sharing options...
anim Posted January 14, 2019 Share Posted January 14, 2019 because there is no prim in your geo - in Add SOP/Polygons/By Pattern/Polygons0 type 0, that will create 1 primitive attached to your point 0 - switch your wrangle to Run Over: Primitive, this will not only make @primnum be valid, but also later your wrangle will work correctly if you have multiple prims coming in an you want each of them to grow independently - in your code make sure you append the new point to the primitive, so after your line with addpoint() insert this: addvertex(0, @primnum, npt); pointCreate_01_fix.hipnc Quote Link to comment Share on other sites More sharing options...
anim Posted January 14, 2019 Share Posted January 14, 2019 however if you don't care for the setup to work for multiple lines/primitives and just aim for very simple setup always starting from one point and always just appending one point after the very last point in the whole geo as you described, you can just keep your original setup (no prim created, and run over Detail), just change your code to : vector endpos = point(0, "P", npoints(0)-1); vector off = {0,1,0}; int npt = addpoint(0, endpos+off); which will instead of last point of the prim use last point of the geo Quote Link to comment Share on other sites More sharing options...
tanzola Posted January 14, 2019 Author Share Posted January 14, 2019 (edited) Hey Tomas, That was very informative. I really appreciate it, thank you!! Edited January 14, 2019 by tanzola 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.