Do you want me to just start out with a 2 or 3 resistor (end sections and one middle section) and then you can write the code and expand from there?
I see where you are going with this... it may work... I am not a coder, but it would be interesting to see how it all comes out.
The one you sent me, the bendable legs lost something in translation, (a minor issue) but I really do see why this part needs bendable lets anyway. In real life they don't have bendable legs... I will draw it up where it can be expanded and the center section can be duplicated and you can take it from there...