Assigning values to null items

Hi everyone, I’d greatly appreciate some help understanding how to work with components like Dispatch, Combine data, replace nulls, weave, etc. I imagine these are useful to what I am trying to do but not sure how to implement!

I’d like {0;1}(0) to equal {0;0}(0),
{1;1}(0) and {1;2}(0) to equal {1;0}(0), and so on.

In other words, for any null item, replace with the closest previous non null item in the tree. Ideally I’d like to do this with grasshopper components.

I am hesitant to attach my definition as I might end up in the Rhino Inside Revit section of the forum, but am doing so anyway. (18.2 KB)


For one it is not really clear what you want to achieve here. Can show the result you are after?

And also internalize your data so that people who do not have your same plugins can take a look at the definition and work with it.

Is this what you are after?

replace (14.3 KB)

Hi Shynn, thank you so much for your response and effort putting this example together

Below is a panel that shows what output I’d like to have… please excuse my sloppy photoshop sketch, I am not sure how to construct the necessary panel in Grasshopper for demonstration purposes.

What I notice is that each null value (returns True) needs to be replaced by the non-null value (returns False) that precedes it. The tree could have thirty null values from index 1 to 31, and they would all be replaced by a non-null value at index 0.

Note - Thanks for mentioning the data internalization, I am not sure how to do this. Did some brief research but did not figure it out yet

To internalize data you can right click on a component input and choose ‘internalize data’

It basically stores the data up to that point. It is usually done with components that work as containers such as “Data”, “Curve” etc.


Regarding your issue, thanks for the explanation. Isn’t it analogous to just figuring out how many empty spaces you have per branch and then stacking the data as many times?

stack (15.6 KB)

This is exactly the kind of answer I was hoping for, and it looks pretty simple when I see someone lay it out for me. I had watched a couple videos about the stack data component and played around with it, but did not reach a level of understanding necessary to incorporate it into my own solution like you have. Thank you!

1 Like