Set Maximum X and Y Travel

Is it possible to set a maximum X and Y travel distance so that the router will not go past the maximum X and Y setpoints ?
I would like to do this so it would not go past the maximum boundary of my work space.
I have tried to search this out but I am not sure what to search for.

I did install the dual endstops and got them working correctly.


I’m assuming you are running Marlin. I cannot think of a way to do this using g-code, and I doubt there is any simple/standard way to make this happen. Marlin, derived more from 3-D printing rather than CNC work, has no concept of a work piece. I don’t thing GRBL g-code has this concept either, but I’m not 100% sure. In addition in the way most MPCNC owners use Marlin, it has no absolute concept of the work piece origin. Coordinates are relative to the work piece.

But CAM software does have a coordinate system relative to the work piece and can know the size of the stock. I’m not sure what specific problem you are trying to solve, but in Fusion 360 I can confine a particular toolpath to a specified area. So you might take a look at the setting you have for your CAD/CAM software.

Gcode in general, and grbl and Marlin both, support both machine and workpiece coordinate systems. Grbl supports multiple coordinate systems in its default configuration. If you want multiple coordinate systems in Marlin that’s a choice in the config-adv.h file.

You can set the machine travel limits in Marlin but I believe you have to recompile the firmware once you’ve made the edits in the config.h file in order for them to take effect.

For example, on my 3D printer the Xmin is -5 mm, Xmax is 219mm and X axis length is 200mm. This is driven by where the end stop and physical edge of the axis is relative to the 200mm width of my build platform. This allows full use of the build platform but allows for travel moves outside to set up a purge zone. On my MPCNC I only have about .5 mm of travel space reserved so I’ve maximized flexibility of workpiece placement within the machine movement envelope without risking hitting the end stop by mistake.

I was just trying to set a maximum boundary that would/could not be exceeded incase I messed up in telling it to router a job beyond the boundaries (so the router would not crash past the maximum working area), not sure how to explain it.

Before I respond, I want you to know that I misread your original question. I thought you were trying to confine the router to the area of the work piece, not confine router to the work area of your machine.

I was just trying to set a maximum boundary that would/could not be exceeded incase I messed up in telling it to router a job beyond the boundaries

When you crash against your machine limits (and I’m saying “when” not “if”), your machine will make this awful, ugly, nasty sounds that you will swear is the pully grinding up the belt or some gears in the motor grinding against each other. I remember the first time I had this happen with my Burly, and I carefully inspected the belt for damage and just prayed I had not destroyed the steppers. According to folks in this forum that have far more engineering knowledge I do, that sound is totally non-destructive. It is the stepper failing to take a step, and on a further step, the stepper whipping around the opposite direction…essentially oscillating. Given how steppers work, nothing is being damaged inside the stepper and there is not enough force applied by the stepper to hurt things like the trucks or the belts.

The one exception concerning damage is the limit switches. It is possible to smash the limit switches and potentially damage them. You can mitigate this problem by making your home/origin as close to the end of the tube as possible. Your limits switches should click just before the truck hits the end of its travel. That way if/when you reach the end of the travel, the truck will bottom out before the limit switches are smashed.

Now that I understand a bit more of what you are trying to do, there is a way to make it happen. Note this is only theory on my part since I’ve not done these steps on my machine:

  1. Enable max software endstops. You need to uncomment this line in Configuration.h:


  1. You need to set X_BED_SIZE and Y_BED_SIZE in Configuration.h to the size of your work area.

  2. Re-flash the firmware after making these two changes.

  3. You will need to add some command(s) to your g-code file that changes to a different work space before you start cutting. See the reference for G54-G59.3.

That is you cannot execute a G92 while in the machine workspace. You need to switch to another workspace before resetting the origin relative to the stock. By switching to a different workspace, your machine workspace remains intact and the soft limits can work. Depending on your software pipeline, you may just be able to add a G55 to your start g-code and optionally a G53 to your end g-code.


Well that’s a relief! :grin:

1 Like