Grasshopper

algorithmic modeling for Rhino

Difference between two sets of geometric objets/Using a data tree as a mask

Hi

 

I have 2 sets of lines (say A and B), where B is a sub-set of A.

I would like to form their difference A\B, i.e. to create a set including all lines that form part of A, but not of B - and somehow I am struggling to achieve this!

 

I have tried to use the Set Difference component with A and B as input data, but it doesn't appear to support sets of geometrical objects.

If instead of A and B I use the corresponding data trees as displayed in Panels, then the Set Difference component works, and the output is the data tree of lines that form part of A\B. 

 

Is there any way I can use this data tree as a mask to extract A\B from A? Or any simpler way to form differences between sets of geometric objets?

Views: 2054

Replies to This Discussion

Hello Eric!

I think what you're missing is the split tree component.

Two methods to get the result you want : the one on top is the one you're using, and below is a simpler one.

Is this what you're loking for ?

Hi FRiou,

Thanks for your response!

It looks like what I am looking for, but for some reason when I am trying to do it myself it doesn't appear to be working in my case (cf. attachement). Any idea of what I might be doing wrong?

Attachments:

You need to use the Param Viewer instead of the Panel (the yellow one).

But you need to graft your curves first in your A set and your B set, since with this method you do not use the sets components on the curves but on their path.

Which means each curve must have its own individual path.

Although, in your example, if B is a part of A (ie included) how can B be bigger than A ? (in your capture A{0;0} has 14 items and B{0;0} has more than 16...).

Hi FRiou,

Thanks for your response.

You are right about B being 'bigger' than A, I guess the reason for that is the way I have generated my subset B - by extracting different bits of A and combining them together. If I run B through a Clean Tree component then lists are all smaller.

Anyway thanks to your good advice I don't get an error message anymore, but the result is not exactly A\B. I attach the file just in case you want to have a look (the A\B part is at the bottom of the screen). Obviously I won't take it personnally if you don't!

Attachments:

Hi Eric,

Sorry, I don't have the kangaroo plug-in. You'll need to internalise your curves (A set and B set) if you want me to take a look at your definition.

Also, maybe you could give me an example of how you extracted your B set, because I have a feeling this could be why my method isn't working.

Hi FRiou,

Thanks for offering to look at my file.

One problem (which might be what you had in mind) is that I extracted B in 3 or 4 bits, then merged them together - the reason why ultimately lists in B were longer. At the end of the day although elements in B were a subset of A they ended up (after cleaning) not being in the same branches as originally in A, which I guess is one reason this couldn't work.

I have now adressed this problem, so B is identical to A, with the difference that certain elements have become null. But still it doesn't quite work, as you will see from the attached (from which I have deleted all Kangaroo components).

 

 

Attachments:

Hmmm... I probably should have mentionned that I am still using the 0.9.0075 version of GH.

I'm currently working on a very large definition righ now, and because of incompatibility issues, I can't update GH to 0.9.0076 until I'm completely done.

Which means some components (I think mostly the clean tree) won't load... I have a file with holes (see the capture).

Maybe you could take some captures of these missing parts so I can put it back together with my (old) components ?

Hi FRiou,

Attached are screenshots which should clarify the missing bit.

Attachments:

Ok Eric, I think I found out where your problem comes from.

Your B set still contains null elements. The Param viewer gives you the path of each branch in the tree, even if it's empty. So you're removing from A curves that aren't actually in B.

You need to remove the empty branches from B before using the Param viewer and the split tree, like below.

Hi FRiou,

I works indeed. Thank you very much for your help!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service