Line rotation with various length and angle


I would like to bend line at various angles just like robot arms. I am trying to do in 2D first but cant form the algorithm effectively other than repeating the same definition over and over. Kindly see my file and make it effectively.

It would be good if I can develop N number of lines with N number of lengths and angles for each and in 3D (8.9 KB)