Cabinets Webinar - Snap Adjusted Boxes

Hello,

Cabinets_Snap Issue.gh (265.9 KB)

I am adjusting and example definition that @edsahergom created for the Fall ‘24 Webinar. I removed the option to add boxes on top of one another (linear progression only) and changed the default shape and allowed the only new parameter to be the “Width”.

But, now I have an issue when adjusting the “width” of individual boxes. When I add new boxes in a row and then change the “Width” of one, the rest do not ‘snap’ to the surroundings. See Below:

Instead of having the gap between the two and option to add on either end, the 3rd box should ‘snap’ back to the end point of the previous box.

Everything I have tried has failed due to creating a recursive data stream where I am creating a loop of components within Grasshopper.

Something I am missing to make this happen?

Hi @Dominic_Large ,

Apologies for the late reply.

The problem in your script is that you are using the position before the new lengths are changed from the JSON state. Since you want to keep one element after the other, you can use their lengths after they are replaced with the new ones. Here is the solution:

Can you please share a link to this definition with your “solution".” When I try to recreate I am met with a new version of the error where things snap but snap incorrectly.

Here it is:

Cabinets_Snap Issue.gh (268.3 KB)

You can see here that it is working:

This works with one addition.

Adding a clean tree component to remove Null values otherwise the snap does not work entirely.

Thank you for the help!