Conditional Z movement

Is there a way to conditionally raise the head at the end of a print run to 'at least' a value.

To explain...
If a print completes I would like the print head to rise enough to clear the built object and the bed to slide forward.

If a print fails and I abort it I want head to rise at least Z100 above the bed and the bed to slide forward to allow me to clean the mess before it cools.

The second scenario is only safe if the object that failed is less than 100 high or the head might go down into it.

So, is there a way to write gcode to execute when a print stops which says go up 5 relative - and - IF the absolute height is less than 100 absolute go up to 100 absolute.

you probably could achieve this with the gcode scripts assuming your firmware reports positioning. there are examples of a nifty pause and resume script here as an example of dealing with positional data and you can use if statements against those and run blocks of code.

Edit: this might only work with pause though now that I read the docs.

I think M114 would tell me something useful if I knew enough how to read the answer back and use it.
I need a tutorial for newbies to this. Anyone able to point me in a useful direction?

Would it be easier to switch to relative mode and move up by 100, if the printer gets to the top of it's range of motion then it should stop and not crash if it's been configured correctly.

2 Likes