Please take this the way it is intended.
I just set my Osnaps to Center , Insert and Perp.
It took less than 10 seconds to repeat your lines.
Why particularly do you "need" a program to do this ??
I'll make a deal with you:
If you can write the algorithm to satisfy automating the process to meet ALL conditions that you may need to meet I will write the code as a community exercise ( or we could turn it into a *Challenge* ... but you must supply the exact specifications.
Regards,