Hi, I’m relatively new to Grasshopper, so I’m still trying to learn all the components.
I have a set of points from a hexagonal x/y grid, where the Z values for the some of the points are nonzero. I want the algorithm to look at each points 6 neighbours and if at least one of them is > than 0, then the Z value of this point should be changed to 25.
I created a list with the Z values of the points from the hexagonal grid. For each point there is a paths with 7 indices. The first index (marked as y in the screenshot) is the index of the Z value of the main point, the other 6 indices (marked with x) are the Z values of the 6 neighbouring points. Now I want the algorithm to look at the the Indices 1-6 and if any of them is more than 0, then change the value of index 0 to 25.
I tried to do it with an If statement and different components, especially the List components. However after trying and searching for 2 days, I still have no progress. Would be really grateful for any help. Thanks in advance!
this is one way among the many:
split each list in 2 → isolating the original index 0 from the “others”
in the “others” → check if any of them has value higher than zero (output is a boolean: 0/1)
the mass addition component works like putting all of them into a big “OR” component: if any of them has value 1, then whole section value will be greater than zero (which means “we have some values greater than zero, somewhere in this branch”)
the IF statement generates a brand new “index 0” item, for each branch in list:
→ if the relative OR statement is True (mass addition > 0) then use the value “25”
→ if the relative OR statement is False (mass addition = 0) then take the original “index 0” before the split list occoured
last step: inserts this newly generated item at index 0 for each branch
30.11.2020_Question_re.gh (22.2 KB)
the definition of simultaneous
Depends, do you and @HS_Kim share a frame of reference?
Perfect! Thanks, that’s exactly what I needed.
Thanks to you too, I guess that’s another solution, but I guess I will stick with the version from @inno
better we do, otherwise he got there first