Repositioning automatically - Siblings DC issue

Hello masters!

I’m looking for a solution from a old problem in DC. I read some topics about this, but I can’t fix this issue in my project. I’m using Sketchup 2020, and trying programming in Ruby Console + of @Aerilius.

The problem is: when I modify the FREE position (by click and drag with mouse) of shelf bellow and the position of shelf above is parametric (calculating the height (H) remaining space and dividing for the quantity of shelves), the shelf above (3 for ex) looses the info about position of shelf 2 and dont assume the new parametric place.

I’m looking for Ruby solution beacause I understand that is the way to force this arrangement. The position is realocated correctly when I move the shelves with mouse, but this becomes impractical when having to change positions multiple times (and having to move all shelves to recalculate).

Actually, in my project, each shelf, have the follow attributes:

Z = Parametic (height / Shelf Quantity) or Free (without formula, to be possible drag with mouse)
space= (Space between base and roof - shelfbellow! position Z ) this is why I’m using siblings reference and this is why is no working well, because the ref is not getting attribute from parent! - I made in this method to be possible the drag with mouse instead put values in parent!, trying make a more intuitive way to designers

Is possible a solution to this? I saw some old topics, but I don’t know if have new solutions from this issue.

thanks a lot

some topics visited: