Replace items from a list

Hi Grasshopper friends,

I tried to use a solution from David Rutten from this location, but was not successful: https://www.grasshopper3d.com/forum/topics/if-then-component

Therefore I’d like to ask you for a solution for the situation above.

Please also see the GH definition BilgeScript - discourse.gh (17.9 KB)

Depending on the value of the ‘offset’ slider, some Y values exceed a certain value, in this case 6250. How can I replace them then with the value 6250?

The same counts for the Z values that become smaller than the value 0.

Thank you in advance for your support.

Gerard

You can use pick and choose for this

this also looks like a good use case for Min and Max:


BilgeScript - discourse_MinMax.gh (29.2 KB)

Thank you Martin,

Unfortunately, I am not successful with this as the length of the pattern can differ depending on the amount of offset. And then I am stuck with it.
Still I am curious how you would solve this with the Pick’n’Choose component.

Inno’s solution also works for me and his screenshot shows what I need to achieve. However, if you like to show me your solution, I am very happy to learn from it.

Thank you

Thank you Inno!
That works perfect for me.

I’m away from my computer but I’ll try in a few days

Great, thank you!

This is how you would use pick and choose. It requires two lists with the same length, hence the longest component…

BilgeScript - pick and choose.gh (30.3 KB)

@inno approach with min max in this case seems to be more appropriate

Oh great, thank you very much Martin!

I will investigate it later to fully comprehend it.

You can use the expression {x.x,Max(x.y,y),Min(x.z,0)} for the Evaluate component… That’s essentially the same thing as Alessandro’s solution.

Thank you Volker!
That’s also a valuable way to solve this.