Grasshopper

algorithmic modeling for Rhino

I am trying to combine several streams of data using Combine Data, but have come across some weird behaviour.

According to its description it "combines non-null items out of several inputs", yet it doesn't do just that. I have 3 inputs which contain curves, one of the inputs usually has <null> items in it, so I am trying to filter out those nulls. The 3 inputs have different amounts of curves in them, normally one of the inputs is grafted as well.

So one would assume it just gets rid of the nulls and thats it. Well it doesn't. In my case it simply takes the curve from the first input (1 curve) and copies it 20 times (the second input contains 20 curves). The nulls are gone, but so are 19 other curves!? Maybe I don't understand the component properly, but its not doing what I am expecting.

Using a Merge component works as expected.

I am aware of checking for Null Items and using Dispatch, but I thought Combine Data is exactly for that purpose!?

Flattening the inputs makes no difference.

Views: 1087

Attachments:

Replies to This Discussion

Combine data is designed to be at the other end of Sift. It only works well if all inputs contain the same number of elements, and ideally amongst all inputs there is only one non-null item per index. If you have multiple non nulls for a given index then the topmost one wins. If your lists are not equally long, then the short lists get elongated (i.e. longest list logic). This is why your first input gets repeated.

You'll have to find a way to make your first list contain 19 nulls, or, you can Combine list 2 and 3, then insert the one curve from list 1 into index 0 of the result.

Ok, thats fair enough. I have used it for that purpose before and found it very useful, but didn't realize its limitations.

So I made a little user object doing what I wanted - cleaning out any Nulls, discarding any branches which only contain Nulls.

On the inside:

Will attach the user object in case anybody might need it :)

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