How to extract the rotation angles so that this wall can be built on site

@HS_Kim Thank you for your help once again. I am working with grasshopper for past 1.5 years, still it feels like I am a noob here. I just want to know how are you able to solve all the questions that people post here. How to you always know the solution for every algorithm. How to think for a solution and where can I learn to solve problems so efficiently and help other members of the forum.

Also I’ll be trying few more things with script above. Will let you know if I am stuck anywhere. Thank you so much! Cheers!