I tried using mach for punching holes in foam but I was using an air solenoid controlling a linear slide to control the punch (annular cutter really) held in a collet. Just a simple X/Y table with a brain that fired the output to the solenoid every time the Z DRO was less than zero, and retracted the solenoid when Z was greater than zero. Worked pretty well actually but I ended up going to a heated cutter.