# Primpoints problem? Getting a list of points in a point wrangle

## Recommended Posts

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};

setpointattrib(0, "num", npt, len(pts));```

Thanks for taking a look!

pointCreate_01.hipnc

##### Share on other sites

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

##### Share on other sites

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};

which will instead of last point of the prim use last point of the geo

##### Share on other sites

Hey Tomas,

That was very informative. I really appreciate it, thank you!!

Edited by tanzola

## Create an account

Register a new account