Problem with data matching


Since a couple of days I am struggling with a grasshopper definition. I think it all comes down to data matching.

As you can see in the picture of the GH canvas I have six branches of lines consisting in only one line per each. In the picture of the viewport it is visible that only 4 lines actually exist.

What is happening here!? I´m pulling my hair over here! This doesn´t look normal at all. (41.2 KB)

2 lines are duplicated / identical.
bake them

_selLast to select backed geometry. → 6 Curves

_selDup (see screenshot above )

1 Like


Still, what could I do to get the same for the other chunk?

changed to GH category (56.0 KB)

the above definition uses the first planar face per brep.
(assuming there is one, and assuming that the uv-direction of the underlaying surfaces fits)
you might want to do some sorting here, to decide, which surface / plane to use.

using a plane to generate a boudingbox per object in the spacial direction of above plane

evalute the bounding box to get the points / create the lines.

does this help ?

(added screenshot)
Above approach does not answer the initial question how to sort / access / match the given Datatree.
Instead of fiddling with datatrees i prefer to have the geometry already generated in a readable order.
A boundingbox / evaluate Boundingbox will have a consistent order of faces.
Regarding readability, i do not mind to have a few components 3 times - for more complex definitions this might be a cluster.
I think it s a good practice to check the data-structure after each step / component and keep it simple but in a meaningful organisation.



This List Item can’t be working properly, there is a 1-level tree in the first input and a 2-level tree in the second input.

I used Graft Parallel from Elefront plugin to duplicate the branches.
Then you can avoid your Partition List with a simple Polyline.

image (28.1 KB)

1 Like

Hi @magicteddy. Your help was lifesaving. I managed to solve the issue by using the component you suggested.

You also pointed at the problem with the data matching. I had the feeling that that might be the cause. This is the very thing that I keep struggling to understand with grasshopper. Could you please suggest a source where I could learn about the topic?

Of course it helped! Thanks @Tom_P for taking the time to review my definition and provide guidance!

May I also ask: how could I achieve the same by using just grasshopper native components?

Data tree management is indeed a bit tricky but there are a few rules to keep in mind :

  • provide lists that have the same length, or trees with the same structure (i.e. same amount of branches, same branches numbers, and same amount of items per branch).
  • if you provide lists of different lenghts or trees that don’t match structure, the last item/branch only in repeated to match the longest list/tree, so in 99.9999% of cases this results in errors.
  • if you provide different structures (for instance an item and a list, or a list and a tree) to a component that has several as item inputs - and that is the vast majority -, then Grasshopper will repeat the weakest structure as many times as necessary to match the strongest structure : it will therefore create repetitions.

A great video there (although for the last minutes, I’m a bruteforce Simplify/Trim Tree guy instead of Shift Paths :D)

1 Like

It’s a great exercice of Duplicate Data and Partition List that you’ll probably want to do once to understand the principle, then switch to Graft Parallel for the rest of your life ! (43.2 KB)

Edit : another native solution with Unflatten Tree that works in this case. (30.5 KB)

1 Like

My solution uses only native gh components.
See my edit in my initial post with a comment on data-structure.

1 Like

Hi @magicteddy and @Tom_P. You make so happy by providing such rich answers and valuable content. I can not check them all right now as you got me in the middle of a project, but they look really good and promising. I´ll get back to you in the future for sure.

1 Like