Prusa Slicer Z offset G Code Help
 
Notifications
Clear all

Prusa Slicer Z offset G Code Help  

  RSS
huczekdesign
(@huczekdesign)
Active Member
Prusa Slicer Z offset G Code Help

Hey everyone,

Just a quick question concerning z offset and gcode using prusaslicer. I'm currently trying to dial in my z offset after leveling and my current procedure is to tram with a .2mm feeler gauge, the add that value as a negative value offset in prusa (-0.2mm). I just need some help interpreting the gcode it outputs.

So I see G1 and then Z listed as 0.00. Then the following line says AFTER LAYER CHANGE; 0.2. Shouldn't that read -0.2 or is that just how prusa outputs the code? Just want to make sure I'm correct here. Oh and my initial first layer height is 0.2 as well.

Thanks!

 

G92 E0 ; Reset Extruder
M140 S65; set bed temp
M190 S65; wait for bed temp
M104 S210; set extruder temp
M109 S210; wait for extruder temp
G28 ; Home all axes
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position
G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
G1 X0.4 Y200.0 Z0.3 F5000.0 ; Move to side a little
G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line
G92 E0 ; Reset Extruder
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X5 Y20 Z0.3 F5000.0 ; Move over to prevent blob squish
G21 ; set units to millimeters
G90 ; use absolute coordinates
M83 ; use relative distances for extrusion
; Filament gcode
;LAYER_CHANGE
;Z:0.2
;HEIGHT:0.2
;BEFORE_LAYER_CHANGE
G92 E0
;0.2


G1 E-5.00000 F1500.000
G1 Z0.000 F9000.000
;AFTER_LAYER_CHANGE
;0.2
G1 X84.630 Y85.052
G1 E5.00000 F2400.000
;TYPE:Skirt
;WIDTH:0.42
G1 F600.000
G1 X87.321 Y82.581 E0.11567
Napsal : 11/09/2021 5:16 pm
BogdanH
(@bogdanh)
Honorable Member
....
G1 Z0.000 F9000.000
;AFTER_LAYER_CHANGE
;0.2
....

-lines that start with with semicolon are comments (are not read/executed by printer).

[Mini+] [MK3S+BEAR]

Napsal : 12/09/2021 9:11 am
huczekdesign
(@huczekdesign)
Active Member
Topic starter answered:
Prusa Slicer Z offset G Code Help

Ah thanks. So where does it implement the change I requested in the slicer then?

I scrolled all the way to the end of the gcode and saw this line:

; z_offset = -0.2

But you're saying because it has a semicolon it was not executed. Sorry I'm a bit confused

Napsal : 12/09/2021 2:02 pm
BogdanH
(@bogdanh)
Honorable Member

Not sure I understand what you wish to accomplish, but at least to my limited knowledge, you can't change (first layer) Z-offset inside G-code. Every print will start at layer height 0 (zero).. that is, printer reads Z-offset (from printer memory) and adds 0 for first layer. When next layer starts, current Z height is increased by layer height value (0.2mm, for example).. and so on with all layers that follow.
Sorry if I missed the point of your question.

[Mini+] [MK3S+BEAR]

Napsal : 12/09/2021 3:19 pm
Neophyl
(@neophyl)
Illustrious Member

The gcode prusa slicer generates as a copy of all the settings used placed at the end of it.  So without seeing the full listing or having a copy of the saved 3mf project file used to generate it it is likely that theres a -.2 setting already configured someonewhere and thats just the copy.

 

Napsal : 12/09/2021 4:00 pm
huczekdesign se líbí
huczekdesign
(@huczekdesign)
Active Member
Topic starter answered:
.
Posted by: @bogdanh

Not sure I understand what you wish to accomplish, but at least to my limited knowledge, you can't change (first layer) Z-offset inside G-code. Every print will start at layer height 0 (zero).. that is, printer reads Z-offset (from printer memory) and adds 0 for first layer. When next layer starts, current Z height is increased by layer height value (0.2mm, for example).. and so on with all layers that follow.
Sorry if I missed the point of your question.

Oh that's ok I'm probably not explaining it properly. I'm just trying to confirm where my print head is on the z axis when I start printing. I'm adjusting for what my printer thinks is "zero" with my negative z offset from when I level the bed, but I wasn't sure if Prusa (or any slicer) was adding in any extra distance when it actually goes to print. I've watched a few videos on youtube that suggest that's the case. Here's a recent example:

 

Napsal : 13/09/2021 1:50 pm
BogdanH
(@bogdanh)
Honorable Member

Confusion probably comes from "bed leveling" vs "auto bed leveling", where "auto bed leveling" actually isn't bed leveling at all... or let's say it's more a "virtual bed leveling".

Bed leveling is needed to be done on every printer that doesn't have a probe/sensor that senses proximity to bed -"classsic" Ender3, for example. Here bed sheet must be perfectly flat and horizontal, because height of the nozzle is constant during printing each layer. So, if print bed would be anywhere on whole surface 0.2mm (for example) higher than the rest of the print bed, then nozzle would just scrub into the print bed. So, user must manually level the bed to make it flat.
As soon printer has a distance sensor (SuperPINDA, etc.), then flatness of the print bed isn't that important anymore. What auto bed leveling does is, it measures imperfections of the bed. Let's say, there's a slight bump in the middle of the print bed. In this case, the probe will sense that Z height needs to be (just a bit) increased in the middle of the bed -for nozzle to have equal distance to the bed on whole bed area. Now, during print, each time nozzle comes to middle area of print bed, Z height will be automatically increased by needed amount.. and lowered back when nozzle comes out of that area. That is, G-code from slicer assumes that bed is 100% flat, but during printing "auto bed leveling" values (stored in printer memory) are used and taken into account. In short, we are able to print on non perfectly flat bed.

[Mini+] [MK3S+BEAR]

Napsal : 13/09/2021 2:45 pm
huczekdesign se líbí
jppoirier79
(@jppoirier79)
New Member
RE: Prusa Slicer Z offset G Code Help

Bed virtual bed leveling is achieved with G80 (also included in the G28 home all routine). This stores the height position for the mesh selected (3x3 or 7x7) in the memory. Once the g-code is posted, the machine access the position previously stored. This is why you don't see this explicitly in the g-code. It doesn't belong there.

If you add a Z offset, then prusaslicer will add it to the stored Z height. In your post, you can see the first layer is at Z0.3. This height includes your Z offset.

Napsal : 26/12/2021 1:29 am
Share: