The only real problem here is the sensor. Everything else is fairly easy to do.
You can use a Hall effect sensor or a pickup coil. Both require small magnets installed somehow on the moving part of the machine. These magnets activate the sensors. You can install more than one magnet. I would try to glue them using epoxy.
The Hall sensors would be my preferred choice. You can re-use the sensors you find in the 5 ¼ inch floppy drives. Can you get such an oldie?
The sensor has to be really close to the magnet (and to the moving part), and installed securely (against vibrations) and protected by some sort of cover, for protection.
Optical sensors are also possible: basically a disk with holes around its edge can be installed on the moving part of the machine and you can use a photointerrupter, from an old printer for example, to "see" those holes. Again, mechanical precision and protection are essential.
If you think it is easier to install a switch somehow and some sort of cam on the moving part, that is also OK. Ideally, the switch should be closed/ open more than once/ revolution.
You have to decide which solution is more feasible, depending on what the actual machine looks like, what the available space it, etc.
Once you have that going, you can use a programmable counter and make it stop the machine after x turns.
If you prefer, you can use a microcontroller. Are you comfortable with PIC's?
Again, this is the easy part, I am not at all concerned about it.