Grasshopper

generative modeling for Rhino

Hi all,
How can I delete twice or congruent objects in Rhino model space?

Reply to This

Replies to This Discussion

Hi Rafi,

what kind of objects? Points? Curves? BReps?

And, do you want to delete exact duplicates, or do you want to delete objects which kinda-sorta look alike... a bit... somewhat?

--
David Rutten
david@mcneel.com
Poprad, Slovakia

Reply to This

David,

Looking at the number of questions regarding this, perhaps it might be worthwhile having a component that does this? Perhaps it could even have a user controlled tolerance for the kinda-sorta look alike... a bit... somewhat cases?

Reply to This

Yes, that's what I figured. As soon as you allow tolerances it becomes a whole lot harder to solve these cases (except for points). Exact duplicates shouldn't be too hard.

--
David Rutten
david@mcneel.com
Poprad, Slovakia

Reply to This

Hallo David,

I just want delete congruent curves and points which are exact duplicates!

Reply to This

Hi Rafi,

if you're looking at exact duplicates of curves and points, here's what I'd do:

1) Write a new class in a VB or C# component that implements IComparer(Of IOnCurve). You can check easy properties first (boundingbox, length, start and end points), if these all turn out to be the same, you'll eventually have to drill down all the way to Nurbs properties (i.e. compare the CV array and Knot-Vectors of the curves), but perhaps it's good enough to stick with the easy comparisons.

2) Iterate through a list of IOnCurves (or OnCurves, or OnNurbsCurves, whatever you've got), and slowly populate a SortedList or SortedDictionary as you loop. This SortedList must be aware of your Comparer. Then, whenever you encounter a curve which already has been handled before, you know you've got a duplicate.

This is not exactly trivial, not even for the somewhat experienced DotNetters. I'll see if I have some time tomorrow to implement this.

--
David Rutten
david@mcneel.com
Poprad, Slovakia

Reply to This

I was thinking this would have something to do with DataCRC (for exact matches)...?

Since you mention comparing the 'easy properties', does that imply you suggest using the IComparer for the kinda-sorta almost cases?

And if it were only limited to exact duplicates, which method would be faster -- IComparer or DataCRC?

Reply to This

Sorry!
I received just the 3D model from a customer, it is therefore not a Grasshopper Component to clean up!

Reply to This

I have exactly the same problem - In my case its identical points - or points that share the same z coordinate, but it would be great to have a component for all kinds of objects.

julian

Reply to This

I remember there was a somewhat simpler method, but can't think of it now. Maybe this will work for you.
Attachments:

Reply to This

Did anyone figure out an easy way to remove duplicate points from a list?

Thanks.

Reply to This

RSS

© 2010   Created by Scott Davidson on Ning.   Create a Ning Network!

Badges  |  Report an Issue  |  Privacy  |  Terms of Service