Cull Duplicates Does Not Work Correctly

Cull Duplicates returns the full list of points when there are no duplicates found…

This makes no sense and is also useless. I have a dynamic input that sometimes contains duplicate points and sometimes does not. When no duplicates are found, Cull Duplicates component should find no “culled points” are none are culled, are there are no duplicates, but instead it lists every index as if all were duplicates.

That’s because that’s not what the “culled indices” are. The naming is misleading. It is the reverse. It is the indices that are left over after culling.


P.S. I agree that it should be the other way around, but they probably won’t change it because “breaks old scripts”. Also, there really should be the option “None” in addition to “Leave One”, “Cull All” and “Average” for the sake of identifying duplicates.

Also, the should be something similar for Duplicate Lines

Okay, but how would you tackle this then?

I have a list with duplicates and another without…

When they are duplicates I am deleting the single points.

But when they are not duplicates, I want to keep all points, even though they are single.

Lists Points.gh (10.5 KB)

Edit both should be “cull all” but still doesnt work.

The problem is that you are using Member Index which is basically overriding the work that Cull Duplicates is doing. I don’t know. I am busy ATM. I can look at it later for you if you haven’t found a solution by then.

@ShynnSup This will work, but only for your exact situation where the tree is fully grafted, i.e. one item per branch. It will not work as a generalization:

:thinking: Although, you could always forcibly graft the curve tree and trim the result, so I guess it IS a general solution.

So essentially so:

@ShynnSup P.P.S. This should also work with “Cull All”. Please let me know if this solves your problem.

It almost works, except that for the list with duplicates, I actually need to output the duplicated curves…

I ended up using a gate to just bypass the culling when no duplicates are found by comparing list length before and after culling.

I.. don’t understand why my solution with “Leave One” does not work for you then. I must be misunderstanding what you want.

Ah… I see. I had to recreate your script to understand what you wanted. You want either just the duplicates, or the original list if there are no duplicates. Is that correct? You have the duplicates… duplicated. Did you only want the duplicates singly?

Leave one does not cull the corners like I need it to.

The result I am after is:

With duplicates:
Keep only duplicates: (white)

Without duplicates, keep all.

ChatGPT said:

Why I like this approach

You don’t need to redesign the duplicate logic at all. You’re just saying:

If duplicates exist, remove the singles. If no duplicates exist, don’t perform that removal.

Still, did you want the duplicates singly or retreived in the multiples as they currently are?


This example demonstrates exacty why a “None” option is needed for Cull Duplicates Or that the Valence output should show the valence of the original list !


It seems you have your solution now. For what it is worth, this is how I would have approached the problem:


Lists Points VR1.gh (19.1 KB)

(I mis-named the curve containers. The container labelled to contain duplicates does not, and vis-versa)


If you wanted the duplicates singly:


Lists Points VR2.gh (22.6 KB)

I would use this solution because Member Index will work on the rounded display values of the point coordinates as text, and not treat them as numbers.