This morning, after spraying dry lube on lead screw and guide rails on my CNC router at the program for mentally handicapped people, I move the gantry along the X-Axis by entering G0 Xnumber. If I enter G0 X400 when the gantry is at home position, it worked. If I enter G0 X-400 when the gantry is at 400 mm position, the gantry crashes into the X-Axis limit switch which confused me. If I home the machine, enter G0 X400 to move the gantry to the 400 mm position, and enter G0 X0, the gantry moves to the home position. I don't want to make mistake of entering G0 X-400 again. How can I fix the problem?
When using manual commands instead of the UI buttons and entry fields, its up to you the user to assert the correct modes. G90 vs G91, G20 vs G21 etc along with your move commands. It's never safe to Assume a Modal, one should always Assert the Modal you need at any point. That's what CAM applications do as well, they add Modals into the gcode rather than assume certain states are just set for them Much easier, just use CONTROL 's user interface elements (jog buttons, clicking on DRO, etc)
If OB Control software is correctly set up for the CNC machine's working area, the software should reject any values outside of the working area. For example, the machine's working area is 500 X 500 and the home position is 0,0, the software should reject G0 X-500 instead of letting the machine crash into the limit switches.