Add an override for Z Offset in filament settings
Is there an existing issue for this feature request?
- [X] I have searched the existing issues
Is your feature request related to a problem?
If changing filaments, the Z Offset might need to be different because it very much depends on the filament material. Currently, Z Offset is in the printer profile and aims to compensate for bad distance between nozzle and bed. This ignores the fact that the Z Offset often needs to be adapted to the filament material used, regardless of printer conditions.
For example, if my printer has been well calibrated concerning height of the build bed and I mostly print in PETG, everything is fine. But if I change the filament to PLA, I need the nozzle closer to the bed for the 1st layer to adhere properly (PLA needs more "squish"). Printing PLA using the same printer profile could fail, although it is the same printer.
Which printers will be beneficial to this feature?
All
Describe the solution you'd like
In order to account for filament needs, the Z Offset should be put in the override list of the filament profile. In consequence of doing this, the user would change the filament used to print without having to take care about changing printer settings (which would be not logical since he is using the same unchanged printer).
I have had print fails because I forgot to adapt the Z Offset when changing the filament material.
Describe alternatives you've considered
Alternatively, define two different Z Offsets: "Printer Z Offset" for the printer, valid for all filaments and used to remedy bad height calibration, and "1st Layer Z Offset" for the filament, which would be saved in the filament profile. In this case of having two different Z Offset types, the Z Offset value for the filament concerns only the 1st layer, meaning that the second layer would need to compensate the height difference introduced, to avoid an overall change of the printed piece dimensions.
Additional context
See also closed (orphaned) request: Custom Overrides #2869
If you are using Klipper you can do it easily... I don't see any advantage or doing it tbh.
Start Gcode in Slicer:
START_PRINT BED_TEMP="M140 S[first_layer_bed_temperature]" EXTRUDER_TEMP="M104 S[first_layer_temperature]" FILAMENT_TYPE="{filament_type[0]}"
CONFIGURE_FILAMENT_OFFSET macro:
[gcode_macro CONFIGURE_FILAMENT_OFFSET]
gcode:
{% set FILAMENT_TYPE = params.FILAMENT_TYPE %}
{% if FILAMENT_TYPE == 'PLA' %}
# PRESSURE ADVANCE
# SET_PRESSURE_ADVANCE ADVANCE=0.0558
{% elif FILAMENT_TYPE in ['PET','PETG'] %}
# PETG Zoffset
SET_GCODE_OFFSET Z=+0.075
# PRESSURE ADVANCE
#SET_PRESSURE_ADVANCE ADVANCE=0.125
{% elif FILAMENT_TYPE in ['ASA','ABS'] %}
# ABS/ASA Zoffset
SET_GCODE_OFFSET Z=-0.030
# PRESSURE ADVANCE
{% else %}
# Other kind of filament we reset to 0
SET_GCODE_OFFSET Z=0.0
{% endif %}
START_PRINT macro
[gcode_macro START_PRINT]
gcode:
{% set BED_TEMP = params.BED_TEMP|default(60) %}
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(200) %}
{% set FILAMENT_TYPE = params.FILAMENT_TYPE %}
# Fans
#CHAMBERFAN_ON
#{% if FILAMENT_TYPE in ['ASA','ABS'] %}
# EXHAUSTFAN_ON
#{% endif %}
# Heating hotend and bed
M117 Heating
M140 S{BED_TEMP}
M104 S{EXTRUDER_TEMP}
# Set and wait for nozzle to reach temperature
M109 S{EXTRUDER_TEMP}
M190 S{BED_TEMP}
# Home the printer
G28
# Use absolute coordinates
G90
# Mesh Bed Level
BED_MESH_CLEAR
BED_MESH_CALIBRATE
BED_MESH_PROFILE LOAD=default
# We set our offset based on filament type
CONFIGURE_FILAMENT_OFFSET FILAMENT_TYPE={FILAMENT_TYPE}
CLEAN_NOZZLE
# Move to the starting line position at a fast feed rate.
G1 X1 Y1 Z2 F9000
# Prime line
PLAY_START_PRINT
PRIME_EXTRUDER
M117 Printing
If you are using Klipper you can do it easily... I don't see any advantage or doing it tbh.
Not everyone is using Klipper.
I'm on Marlin2, thus can't use the Klipper macro. My solution is borrowed from the cura z-offset plugin. Move the printhead somewhere where no filament was extruded yet and execute in the filament start gcode:
; filament start gcode
G0 F6000 Z{first_layer_height-0.05} ; Adjust Z by -0.05
G92 Z{first_layer_height} ; Override original Z-Offset for this print
All subsequent moves to e.g. Z0.4 will actually resolve to a move to Z0.35, even though 0.4 is written in the gcode
I’d like to request the addition of a feature that allows for easy switching between different Z-offset values for various filament types, such as PETG and PLA. This would be particularly useful as these materials require significantly different Z-offset settings to achieve proper adhesion (e.g., a Z-offset of .09 for PETG and .04 for PLA). TPU also has unique requirements in this regard.
Creating separate printer profiles solely for Z-offset differences is not efficient. It introduces complexity and the potential for errors when tuning other settings, as adjustments would need to be duplicated across multiple profiles. Additionally, adding custom G-code for Z-offset changes is not always clear and can complicate troubleshooting and future tuning efforts.
We already have filament profiles to manage vendor and material differences, which helps keep settings organized. Adding a Z-offset override in these profiles would be consistent with existing organizational structures and just as crucial as other settings like retraction.
This feature would enhance usability and streamline the process of switching between filament types, ensuring optimal print quality without the need for redundant profiles or opaque G-code adjustments.
Thank you for considering this enhancement. I believe it would greatly benefit users who frequently switch between different materials.