For Python's unique node in code feature, so many components now have little banners at the bottom that allow right-click options to be set. For instance, CullDuplicates (CullPt):
CullDuplicates works in Python:
...and if I print ghc.CullDuplicates(curve_points) I see the actual names of the outputs in the Python editor:
...so I can either do:
a,b,c = ghc.CullDuplicates(curve_points)
...or:
a = ghc.CullDuplicates(curve_points)[0]
b = ghc.CullDuplicates(curve_points)[1]
c = ghc.CullDuplicates(curve_points)[2]
...or even:
a = ghc.CullDuplicates(curve_points).points
b = ghc.CullDuplicates(curve_points).indices
c = ghc.CullDuplicates(curve_points).valence
And multiple inputs are just separated by commas within the parenthesis.
But the component is defaulting to Average instead of Leave One, which doesn't give me much useful. I'm trying to remove duplicate lines quickly, of 25K lines, and this is the fastest component in Grasshopper I've found to do that, by finding the line midpoint then getting the indices output from CullDuplicates to find out which are keepers.
There's no documentation about what Average even means, and it spits out a bunch of -1s, with the resulting lines culled by index of the good numbers being rather odd compared to Leave One, which just works naturally, like a human being would want it to.
Is it possible to change the component mode from Average to Leave One from Python?
Rhinocommon seems to lack a cull duplicate lines/curves command, so I'm hoping Grasshopper components will be faster than raw interpreted (uncompiled) Python.
peter fotiadis
Well ... this is a "bit" off-topic (C#) but give the good old HashSet a spin.
How it works:
1. Creates some random duplicate Lines (Tree).
2. Makes a chaos List out of 1.
3. Does the unique thingy.
Feb 11, 2016
djordje
Hi Nik,
Currently all node in code python functions only work in its default mode (so right-click-on-component-modes can not be changed).
I think Giulio might be able to answer whether or not this will change once public version of Rhino 6 gets released.
Feb 11, 2016