How to tell machine how far travel limits without switches I have a 3d printer that is homebuilt with salvaged parts. Occasionally there is some kind of error and when i start my code the minute it starts it max out on x and y axis and continues to do it until i kill the connection and reset everything. I have found that when i put G21 G90 into the first line of the file it doesnt do this anymore. But I'm wondering if i can "teach" my machine how far it can go before it stops? I am using "grbl controller" to send g-code to my arduino uno woth grbl loaded onto it.
Since 3D printers works with coodinates and the gcode generator requires the origin point and bed shape and bed size. knowing this your programs never will be out of the printing area.

My printer has a printing area of 16.5 x 16.5 cm, so I set this parameter to CURA, Slic3r and 3dsimplify and I can't generate the gcode if the part does not fit on the bed. So I print parts with 15cm maximum

Also the firmware has this limits to 16cm, the 0.5 cm is just for safety

Of course if I send a command with pronterface or any other gbrl controler I can go over the limits due the X0Y0 could be out of position (offset), but if you respect the origin point and don't try to go over the limits by yourself the machine will be ok.