Hi @JAC ,
my first thought when I see your problem is that adaptive components would probably be a good approach. Have you tried them? Or do you absolutely want to do it with dynamo ?
One nice way of doing it would be to define a function that creates a module from 4 points (a,c,i and g) like this :
The function needs some work to have the correct geometry but this is the general idea…