Hello,

I am currently designing a safety enclosure for a small CNC machine that needs to have one main feature: if the doors are open, the user shouldn't be able to start a G-code or turn on the spindle. The machine should also go into E-stop mode if the door is opened during a job. I would like nonetheless the machine to be able to perform certain actions when the doors are open for ergonomic reasons, i.e. manual jog allowed, or using a tool measure length probe.

I have two ideas in mind, both with advantages and drawbacks:

1. Place a switch on the door frame, wired in series with the main e-stop switch. The advantage is that it will be reliable and work for the scenarios mentioned above, except that I won't be able to control the machine manually with an open door.

2. Place a reed switch or a sensor on the door frame, wired to an input of the Mk3/4 controller. I modified the OnStart and M3 scripts to check the state of that pin before starting a job or turning on the spindle and it works well, but the issue here is: how to stop the program while it's running if the door is suddenly opened?

Lastly, am I missing another possibility to achieve this?

If someone already tried something similar or has ideas to give me, I'd greatly appreciate it!