FIt array within volume


I made a script to cover a volume with an accordion fold (please ignore anything outside the black circling). When unfolded, I would like for the shape to match the volume’s dimensions. This would imply that the creases on the longer side would be less folded so we keep the same amount of folds on both sides. The panels stay the same dimension, they just fold and unfold (important so I can make a physical model out of it :slight_smile: )

Now it closes weird because I used the wrong divide curve. I already made the divisions that would fit (circled in green) to replace the rest (in red). However I am not able to substitute it. How would it be possible? My brain melted a little :smiling_face_with_tear:

Thank you very much, (189.0 KB)
Structure.3dm (162.0 KB)