GCode reader shows incorrect Z height during PA line calibration if there is a purge in start Gcode (G0 Z followed by G1 E of any type) #586

Open
opened 2026-04-05 16:23:19 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @Wegerich on 2/26/2026

Is there an existing issue for this problem?

  • I have searched the existing issues

OrcaSlicer Version

2.3.2-beta

Operating System (OS)

Windows

OS Version

Win 11

Additional system information

No response

Printer

MK4S

How to reproduce

  1. Generate a PA Line calibration pattern.
  2. Include some start GCode with a G0 Z command with a subsequent G1 E command after it

This is my snippet, but you should see the full Gcode though because I don't know if I understand it fully. It seems like it considers the first G move with both an E coordinate and an X coordinate?

;purge
G0 Z0.3913 F1000
G1 X{first_layer_print_min[0] - 1} E{cooling_tube_length*0.3333} F100
G0 Z{first_layer_height} F600
G10 ;retraction to break PETG stringing
G1 Z1 Y{first_layer_print_min[1] - 3} F1000
G1 Y{first_layer_center_no_wipe_tower[1]} F{travel_speed*60};approach start point
G90 ;All axes absolute
M83 ; Extruder relative
G92 E0

After a long time messing around, I managed to find that putting this above my purge fixes the problem completely, to the extent that the slicer suddenly recognises that there are 2 different purge extrusion heights, but still thinks that the main print is happening at the same height as the second purge!

;Prevent a bug where Gcode readers use the first G0 command before an extrude command as their value for the first layer height of a calibration pattern.
G0 Z0.333 F1000
G0 Z{first_layer_height} F60 ;the main print actually uses a z-offset
G0 E0.02 X{first_layer_print_min[0] - 11} F100

;Create a purge line
G0 Z0.333 F1000
G0 X{first_layer_print_min[0] - 1} E{cooling_tube_length*0.3333} F100
G10 ;retraction to break PETG stringing
G0 Z1 Y{first_layer_print_min[1] - 3} F1000
G0 Y{first_layer_center_no_wipe_tower[1]} F{travel_speed*60};approach start point
G90 ;All axes absolute
M83 ; Extruder relative
G92 E0

;End Start GCode

However, putting this gcode after the offending purge does not result in the system recognising different layer height.

;Prevent a bug where Gcode readers use the first G0 command before an extrude command as their value for the first layer height of a calibration pattern.
G0 Z0.333 F1000
G0 Z{first_layer_height-z_offset} F60
G1 E0.02 X{first_layer_print_min[0] - 11} F100

Actual results

For the rest of the PA line test, the Gcode reader thinks that the "layer height" is 0.391mm, and it uses this to incorrectly calculate the line width.

Expected results

The GCode reader should check the current height of the nozzle when an extrusion is performed to ensure the value provided is correct.

I was able to replicate the bug in prusa gcode viewer, but they don't allow you to generate calibration patterns so I guess they have never noticed it.

While this bug exists, a sensible workaround would be to add this gcode to the start of the PA Line calibration test, but I can't figure out what that would be.

Project file & Debug log uploads

first layer incorrect height Pressure Advance Test (2).zip

Checklist of files to include

  • Log file
  • Project file

Anything else?

I'm having a little cry because I spent a load of time collecting calibration data into my spreadsheet and I thought it was a quirk of the test that you can never change the layer height or line width, but when you change the layer height the line width changes. So I was using that to modify the volumetric flow, and now the backpressure of the build plate is going to have a strong effect on my Pressure Advance values.

*Originally created by @Wegerich on 2/26/2026* ### Is there an existing issue for this problem? - [x] I have searched the existing issues ### OrcaSlicer Version 2.3.2-beta ### Operating System (OS) Windows ### OS Version Win 11 ### Additional system information _No response_ ### Printer MK4S ### How to reproduce 1. Generate a PA Line calibration pattern. 2. Include some start GCode with a `G0 Z` command with a subsequent `G1 E` command after it This is my snippet, but you should see the full Gcode though because I don't know if I understand it fully. It seems like it considers the first G move with both an E coordinate and an X coordinate? ``` ;purge G0 Z0.3913 F1000 G1 X{first_layer_print_min[0] - 1} E{cooling_tube_length*0.3333} F100 G0 Z{first_layer_height} F600 G10 ;retraction to break PETG stringing G1 Z1 Y{first_layer_print_min[1] - 3} F1000 G1 Y{first_layer_center_no_wipe_tower[1]} F{travel_speed*60};approach start point G90 ;All axes absolute M83 ; Extruder relative G92 E0 ``` After a long time messing around, I managed to find that putting this above my purge fixes the problem completely, to the extent that the slicer suddenly recognises that there are 2 different purge extrusion heights, but still thinks that the main print is happening at the same height as the second purge! ``` ;Prevent a bug where Gcode readers use the first G0 command before an extrude command as their value for the first layer height of a calibration pattern. G0 Z0.333 F1000 G0 Z{first_layer_height} F60 ;the main print actually uses a z-offset G0 E0.02 X{first_layer_print_min[0] - 11} F100 ;Create a purge line G0 Z0.333 F1000 G0 X{first_layer_print_min[0] - 1} E{cooling_tube_length*0.3333} F100 G10 ;retraction to break PETG stringing G0 Z1 Y{first_layer_print_min[1] - 3} F1000 G0 Y{first_layer_center_no_wipe_tower[1]} F{travel_speed*60};approach start point G90 ;All axes absolute M83 ; Extruder relative G92 E0 ;End Start GCode ``` However, putting this gcode after the offending purge does not result in the system recognising different layer height. ``` ;Prevent a bug where Gcode readers use the first G0 command before an extrude command as their value for the first layer height of a calibration pattern. G0 Z0.333 F1000 G0 Z{first_layer_height-z_offset} F60 G1 E0.02 X{first_layer_print_min[0] - 11} F100 ``` ### Actual results For the rest of the PA line test, the Gcode reader thinks that the "layer height" is 0.391mm, and it uses this to incorrectly calculate the line width. ### Expected results The GCode reader should check the current height of the nozzle when an extrusion is performed to ensure the value provided is correct. I was able to replicate the bug in prusa gcode viewer, but they don't allow you to generate calibration patterns so I guess they have never noticed it. While this bug exists, a sensible workaround would be to add this gcode to the start of the PA Line calibration test, but I can't figure out what that would be. ### Project file & Debug log uploads [first layer incorrect height Pressure Advance Test (2).zip](https://github.com/user-attachments/files/25578306/first.layer.incorrect.height.Pressure.Advance.Test.2.zip) ### Checklist of files to include - [ ] Log file - [x] Project file ### Anything else? I'm having a little cry because I spent a load of time collecting calibration data into my spreadsheet and I thought it was a quirk of the test that you can never change the layer height or line width, but when you change the layer height the line width changes. So I was using that to modify the volumetric flow, and now the backpressure of the build plate is going to have a strong effect on my Pressure Advance values.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/OrcaSlicer#586