POPs: Getting point index as attribute

Hello everyone,

I am trying to filter a list of POPs of variable length so that it is clamped to a max length. So for example if it has 100 points, I want to keep 10 random ones, but if it has less than 10 points I leave it unchanged.

I thought of doing this by giving each point a new random attribute and then sorting by this attribute so that the order of all the points is randomized (using Random and then Sort POPs). Then I would like to take only the first 10 points, I thought I would do this by making the index of each point an attribute of that points and then using a Delete POP with a threshold of 10 to keep only the 10 points with lowest indices.

The above would be my ideal case as its the simplest, right now Im using a Python script to do this, but it is very inconvenient and slow as well.

Anyone have any ideas?

Hi @tiemp.ie,

theoretically this could just be done with the Sort POP and Delete POP outright per POP in your list.
Do you have a example file that illustrates the issue you are trying to solve?

cheers
Markus

Im not sure how I would do this with just the Sort and Delete POPs, here is an example. The upper pathway into the switch (index 0) would be the ideal case that Im trying to achieve and the lower pathway into the switch (index 1) is how I currently do it.

PointDeletionExample.toe (5.1 KB)

Hi @tiemp.ie,

instead of the Random POP, which creates an attribute with random values, use the Sort POP to randomize the point order by setting the Point Method parameter to “Random”.
Now you can use the Delete POP and remove all points with an index higher than 10.
For this, there are some extra attributes that are available for a lot of the POPs which contain things like point index (_PointI) and similar.

Attached your example using the 2 mentioned POPs.
A great resource for checking on practical examples that show how POPs work, please have a look at OP Snippets as well as the POPGuide that is part of the examples download available from here:

Hope this helps
cheers
Markus
PointDeletionExampleMH.toe (3.9 KB)

Oh this is awesome! Thanks for all the help Markus!

1 Like