Agent answer
No agent has taken this issue yet.
Issue text on GitHub
Is there an existing issue for this problem?
- [x] I have searched the existing issues
OrcaSlicer Version
2.3.0 Official Release
Operating System (OS)
Windows
OS Version
Windows 10 x64
Additional system information
No response
Printer
RepRapFirmware (mainboard Duet 3 6HC)
How to reproduce
- For clarity, set the printer settings on the "Machine G-Gode" tab in the "BEFORE_LAYER_CHANGE" and "AFTER_LAYER_CHANGE" parameters given here in text form and shown in the screenshot:
;BEFORE_LAYER_CHANGE
;Curr_Layer_bef_[layer_num]
;Curr_Height_bef_[layer_z]
G92 E0
;AFTER_LAYER_CHANGE
;Curr_Layer_aft_[layer_num]
;Curr_Height_aft_[layer_z]
- Slice any detail
- See the text of the layer change in the resulting G-Code
Actual results

- The code specified in the "layer_change_gcode" parameter should be applied "AFTER The Z-Lift", but is applied BEFORE the nozzle height is changed;
- The value of "[layer_num]" AFTER changing the layer may not remain the same as it was BEFORE changing the layer. This is a significant error, since users can link the post-processing processes of the finished G-Code to the value of "layer number".
- The value of "[layer_z]" must correspond to the current height. If the parameter "layer_change_gcode" is used incorrectly (described in p.1), it cannot be said that an error is present, but after fixing the problem, the correctness of the value should be checked.
It seems that the problem described in point 1 is associated with the presence of another error, see Fig. 2:

4. The first layer of the part on the table = Layer 1, this is correct. But in the prepared G-Code, printing starts on layer "0". This is incorrect, because the layer numbering in the G-Code must correspond to the layer numbering in the cutting - this is critical to the process of inserting G-Code in the cutting interface ("Template custom G-Code", etc.), as well as for using post-processing scripts of the prepared G-Code.
If in the slicer GUI the part starts with layer number 1, then in the G-Code there should be no extrusion of the part on layer number 0.
Expected results
- The code specified in the "layer_change_gcode" parameter is actually applied AFTER changing the nozzle height;
- If in the slicer GUI the part starts with layer number 1, then in the G-code the extrusion starts with [layer_num]=1
- The "[layer_num]" value shown specified in the "BEFORE_LAYER_CHANGE" section is incremented until the first output in the "AFTER_LAYER_CHANGE" section.
Project file & Debug log uploads
Project.zip
Checklist of files to include
- [ ] Log file
- [*] Project file
Anything else?
No response