SelDup invoked on selection

How can I script this command when I already have the curves selected?

Alternatively, is there a method removing the duplicate curves or identifying them in RhinoCommon?

Thanks in advance.

Are you looking to find dups within the objects already selected? I guess the workaround with using rs.Command("SelDup") would be to temporarily lock the other objects (store the refs as a set perhaps), run SelDup and see what is selected, then see if any of those are in the above collection. Then unlock everything, unselect all and select only the intersection of the two sets above.

I’m guessing you would need to set up a loop and use this:

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_GeometryBase_GeometryEquals.htm

Like SelDup, I believe this will only find exact geometric duplicates. The native SelDup has also been ‘improved’ to find, say, duplicate lines but with directions reversed; not sure the RC method has that sophistication, so you might also need to add stuff like that as well…

1 Like

Huh, never would’ve guess that. :slight_smile:

I’ll try that. What I did so far was invert selection and hiding what’s rest. But if you have the objects selected and run SelDup nothing is added to selection :smiley: which is understandable, but not what I expected.

Thanks for the suggestions Mitch.

Rethinking my logic here, you don’t really need to lock the already-selected objects, just collect them in a set, unselect all, SelDup and find the intersection of the first set with the SelDup set.