Yup, been there done that! E-Stop has been my best friend!!
Are these macros HAAS specific? I would love to have access to these conditional functions in our DMG... (while loop, if/then statements, etc.) We already have a lot of programs in our old machine written where the variables (#1, #2...) are specified on the first few lines, and it automatically calculates how to cut the part. For example I have a program to cut soft-jaws, where we simply specify width, length, and depth at the beginning of the program and it cuts whatever size soft jaw I needed. But there are some limitations currently the way I wrote them, for example depth must be divisible by 0.05 (otherwise depth of the two holes will be slightly off). When we move them I may rewrite them to be more efficient!
Wallace