Grasshopper

algorithmic modeling for Rhino

Hi there !

I hit a roadblock in my definition.

I have a tree containing lists of integers.

I need to merge the lists that contain at least one identical integer.

Since the number of lists can vary depending on upstream components, I don't see how I can use the components in the "Sets" tab to reach my goal...

Views: 731

Replies to This Discussion

Does sound complicated. To be sure I understand, what you have is:

{44, 9}, {42, 5}, {4, 42}, {41, 11}, {0, 10}, {9, 6}, {12, 14}, {45, 25}, {42, 21}, {20, 43}, {41, 27}, {16, 26}, {25, 22}, {28, 30}, {36, 46}, {38, 49}, {19, 3}, {17, 1}

and what you're after is:

{44, 9, 9, 6}, {42, 5, 4, 42, 42, 21}, {41, 11, 41, 27}, {0, 10}, {12, 14}, {45, 25, 25, 22}, {20, 43}, {16, 26}, {28, 30}, {36, 46}, {38, 49}, {19, 3}, {17, 1}

correct?

Hi David !

Yes, that's what I want.

A bit of background : I'm using the "Topology" component on closed polysurfaces to perform sheet metal flattening.

I need to find the lists of faces which are tangentially connected ; these are generally the "extrados" and "intrados" of my bent sheet metal parts, excluding all the sides.

In the case "01", I can join all the faces that are tangentially connected, and I will end up with two polysurfaces which I can then unfold.

In the case "02", I have a set of "edge" faces which are also tangentially connected, and after "join", it will join outer and inner skin together, and I can't unfold that.

I really need to get a tree with lists of tangentially connected faces.

There might be a simpler way to achieve this, but still, I thought it would be possible to use a couple of "Set" tools to process my tree and get the right lists.

Cheers,

I'm expecting guests any moment, didn't have time to think about this in any depth. It'll have to be C# code for the time being... I think it does show a gap in the standard Set functionality.

Attachments:

Thanks David !

You can hit the peanuts now :)

Actually, no :(

Kick your friends out and back to work ;)

In the attached example, in the merged tree, there are two separate branches containing common items...

Attachments:

Making the merged tree go through a second C# component provides the expected result though...

Oh I finally see. The 47 doesn't get added to Branch[1] until after Branch[39] has already decided that it has nothing in common with Branch[1].

Tricky, a whole other approach may be needed or some recursion needs to be added.

How about this?

Attachments:

Yep ! it seems to work.

At least it produces the same (expected) result as passing the tree two time through the first version of the component.

Thanks David !

Hi David,

Unfortunately, it will not work if I have mutiple objects as an input (raising the tree grafting level).

I'd like to process main branches separately, but the number of these main branches could change....

So you only want to merge branches that have a path like {0;?} and perform a completely different merge on branches that look like {1:?}

Because the script right now doesn't take that into account at all, it just iterates over all branches in the tree, regardless of path overlap.

Anyway, I sent you my definition.

The "Topology" component seemed to be the elegant solution here, but if I can't process the information it gives me, I'm stuck.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service