Blocks on curves with varied width, spacing between, height and length

Hi All,
I have been working on this problem for quite some time now and cannot reach a solution that incorporates all the variability that I want.

Here is what I’m loosly aiming for:

Here is how I imagine the script to work:

I have successfully managed parts of this, but never the whole idea and would really appreciate the help.

Thanks in advance.