#Print end help: how to get the maximum height of printed objects to raise toolhead above them?

17 messages · Page 1 of 1 (latest)

normal yacht
#

I want to modify my print end macro to get the height of the highest layer in the gcode that was just printed, to move the nozzle above it and then move it all the way back without knocking anything over. Preferably more gracefully than just moving it to maximum Z height, and so that it works when there are multiple objects printed one by one. Is there a way to do this?
Asking because I've managed to tear a chip off the bed probe yesterday after forgetting to set proper print order in the slicer.

proper tide
#

Just use a relative move for the lift

#

Or look at the one provided in mainsail.cfg for a fancier example

normal yacht
#

So, for example I would use something like
G91
G0 Z20
To move the nozzle 20mm above current position, right?

#

Would it move it 20mm above current z position, or above the highest point of the gcode file? Because when printing objects sequentially, the last position of the nozzle can be below the highest point of another model that was printed previously.

proper tide
normal yacht
#

Yes, that's how it should be ideally, but sometimes I forget about and find it out later when I hear a loud bang. This is supposed to be a safeguard.

proper tide
#

Fair enough...

#

Hmm. Does your slicer let you run some gcode at the end of the part? If so, you could write a macro that stores z at that point...

#

Even just layer change gcode, if there's no "end of part " one

normal yacht
#

I'm using Orca, it has a section for end gcode, yes.

proper tide
normal yacht
#

Well, there is this, I assume it's something that's supposed to be injected between objects.

#

Not a lot of info about it.

#

There's also a gcode editor with some known variables, nothing about last layer dimensions though.

proven spear
#

You could probably setup something like that (not tested):

[gcode_macro SAVE_MAX_Z]
variable_max_z: 0
gcode:
    {% set max_z = printer['gcode_macro SAVE_MAX_Z'].max_z %}
    {% set cur_z = printer.toolhead.position.z %}

    SET_GCODE_VARIABLE MACRO=SAVE_MAX_Z VARIABLE=max_z VALUE={[max_z, cur_z] | max}

[gcode_macro RESET_MAX_Z]
gcode:
    SET_GCODE_VARIABLE MACRO=SAVE_MAX_Z VARIABLE=max_z VALUE=0

Then add a call to RESET_MAX_Z to your print start macro, add a call to SAVE_MAX_Z to your slicer layer change gcode, and use printer['gcode_macro SAVE_MAX_Z'].max_z in your end print macro

proper tide