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.
#Print end help: how to get the maximum height of printed objects to raise toolhead above them?
17 messages · Page 1 of 1 (latest)
Just use a relative move for the lift
Or look at the one provided in mainsail.cfg for a fancier example
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.
I'd say you need to rethink your plans. I mean, you're right. The relative move isn't going to account for the other part. But...nor are your printing moves. If you're doing sequential printing like that, I'd think you want put part one at the front of the bed, and part 2 farther back anyway, to avoid the gantry colliding with the part
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.
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
I'm using Orca, it has a section for end gcode, yes.
End of each part though? Or just the end of job
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.
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
Ya, that's the kind of thing I had in mind, except I haven't had mind share to actually write code. Thanks!