All right I took a closer look at your script.
Are you running this over Points or Detail ?
If it's over Points, then you will get a long array on every point, due to the fact you are looping over points inside a Point Wrangle. Also when working with a huge data set you might encounter performance issues due to the for loop.
If it's over Detail, then it should not work at all because @ptnum does not have sense in a Detail Wrangle, it's only usefull when running over elements like Points/Vertices/Prims.
Now if I understand the problem you are trying to solve, you want to build an array of point IDs where they have more than 2 neighbours, right ? If it's so, I can suggest a couple of methods here, and you could adapt them to your problem :
1. Build everything with a Detail Wrangle :
i[]@intersectionList = array();
for (int pt = 0; pt < @numpt; pt++)
{
int nc = neighbourcount(0, pt);
int intersectionid = nc > 2;
setpointattrib(0, "nc", pt, nc);
setpointattrib(0, "intersectionid", pt, intersectionid);
if (intersectionid)
{
append(i[]@intersectionList, pt);
}
}
2. Assign point attributes with a Point Wrangle then build the list in a second time with a Detail Wrangle :
2a. Point Wrangle
i@ptid = @ptnum;
int nc = neighbourcount(0, @ptnum);
i@nc = nc;
i@intersectionid = nc > 2;
2b. Detail wrangle
i[]@intersectionList = array();
for (int pt = 0; pt < @numpt; pt++)
{
int intersectionid = point(0, "intersectionid", pt);
if (intersectionid)
{
append(i[]@intersectionList, pt);
}
}
3. Same as 2. but instead of Detail Wrangle remove points where intersectionid == 0 and promote their ID to an array using Attribute Promote SOP (see in the hip file)