Grasshopper

algorithmic modeling for Rhino

So I thought I had a pretty good grasp on tree structures, but have either encountered a bug or a don't understand something.

So if I merge several trees, each simplified and with a depth of one, everything works as expected.

Spread A:

{0} 10 items

{1} 5 items

{2} empty

Spread B:

{0} 3 items

{1} empty

{2} 4 items

Merged:

{0} 13 items

{1} 5 items

{2} 4 items

Fine.

But now I have the situation that the number of branches can go down to 1, resulting in simplify effectively flattening the list, but merge somehow "remembers" the data structure and will result in something like:

Merged:

{0} 1 items

{0;0;0;0;0;0} 100 items

So this is happening even though all inputs are simplified. Shouldn't simplify also reduce all the items to just {0}, even when just one branch is present?

So is this expected behaviour? Surely the number of branches should be irrelevent for simplify.

Any workaround? I tried trim tree, but it fails because there is one branch with the correct {0} identifier. Basically it should flatten in that case, but not when there is more than 1 branch.

In the screenshot, D2 contains no data, but D1 is simplified, but retains its depth information and should also be {0}, as it does for any data that has more than 1 branch. The merge component makes it visible. Flattening is not an option.

Views: 839

Replies to This Discussion

I can't really tell because there is no GH file, but usually when this happens to me, it is because I need to 'Shift Paths' before plugging into the 'Merge' component. Looks like you will need to shift paths after or somewhere before the boolean component. 

Its hard to tell with no GH file, but try playing around with shifting the path at different locations and viewing the output with a param viewer to make sure it is {0}. See Attached image and file for a typical condition. 

Here is the file. 

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service