H2D Z-offset for the first layer

Yes, the firmware update improved things on my end, and I also discovered that I had a faulty offset sensor. Since then, everything has gotten better.

It also got better for me but I still have the problem with underextrusion on top surfaces sometimes, especially large, flat surfaces.


that’s not enough sparse infill. For large flat parts you would always need more sparse infill and more top layers

OK thank you I am trying right now. Printer works good but I have some boogies on first layer printing PETG HF matte on 0.2 nozzle

Hello,
Thank you for the work you have done to identify this issue. From my experience the nozzle was far too close to the bed, hence the scraping of filaments such as PETG (and ABS,TPU etc would be the same).

I have read this thread and it appears people are asking for a variance in Z Offset dependant upon the main filament being laid down. As such I have changed the following two sections from the latest “Machine start G-code” sections;

;=====printer start sound ===================
M17
G383.4 ; left-extruder load status detection
M400 S1

{if ((filament_type[initial_no_support_extruder] =~ /\bPETG.*/) ||
(filament_type[initial_no_support_extruder] =~ /\bTPU.*/) ||
(filament_type[initial_no_support_extruder] =~ /\bABS.*/) ||
(filament_type[initial_no_support_extruder] =~ /\bPA.*/))}
  M1006 S1
  M1006 A53 B14 L99 C53 D14 M99 E53 F14 N99 
  M1006 A56 B9 L99 C56 D9 M99 E56 F9 N99 
  M1006 A61 B9 L99 C61 D9 M99 E61 F9 N99 
  M1006 A53 B14 L99 C53 D14 M99 E53 F14 N99 
  M1006 A56 B9 L99 C56 D9 M99 E56 F9 N99 
  M1006 A61 B18 L99 C61 D18 M99 E61 F18 N99 
  M1006 W
{else}
  M1006 S1
  M1006 A61 B14 L99 C61 D14 M99 E61 F14 N99 
  M1006 A56 B9 L99 C56 D9 M99 E56 F9 N99 
  M1006 A53 B9 L99 C53 D9 M99 E53 F9 N99 
  M1006 A61 B14 L99 C61 D14 M99 E61 F14 N99 
  M1006 A56 B9 L99 C56 D9 M99 E56 F9 N99 
  M1006 A53 B18 L99 C53 D18 M99 E53 F18 N99 
  M1006 W
{endif}
;=====printer start sound ===================

And also;

;===== for PEI Plates , lower the nozzle as the nozzle was touching topmost of the texture when homing ==
{if (filament_type[initial_no_support_extruder] =~ /\bPETG.*/) ||
(filament_type[initial_no_support_extruder] =~ /\bTPU.*/) ||
(filament_type[initial_no_support_extruder] =~ /\bABS.*/) ||
(filament_type[initial_no_support_extruder] =~ /\bPA.*/)}
; === Z-Offset for PETG, ABS and PA type filaments (Raised Slightly More from Default) ===
   {if curr_bed_type=="Textured PEI Plate"}
        G29.1 Z{0.02} ; for Textured PEI Plate = Bambu Lab default -0.02
   {else} 
        G29.1 Z{0.05} ; for Smooth PEI Plate = Bambu Lab default 0.00
   {endif}
   M400 S1
   M1006 S1
   M1006 A36 B24 L99 C53 D24 M99 E53 F24 N99 
   M1006 A0 B15 L0 C0 D15 M0 E0 F15 N0 
   M1006 A38 B8 L99 C53 D8 M99 E53 F8 N99 
   M1006 A42 B16 L99 C53 D16 M99 E53 F16 N99 
   M1006 W    
{else}
; === Z-Offset for ALL OTHER type filaments (Raised Slightly from Default) ===
    {if curr_bed_type=="Textured PEI Plate"}
         G29.1 Z{0.00} ; for Textured PEI Plate = Bambu Lab default -0.02
    {else} 
         G29.1 Z{0.03} ; for Smooth PEI Plate = Bambu Lab default 0.00
    {endif}
    M400 S1
    M1006 S1
    M1006 A42 B24 L99 C53 D24 M99 E53 F24 N99 
    M1006 A0 B15 L0 C0 D15 M0 E0 F15 N0 
    M1006 A40 B8 L99 C53 D8 M99 E53 F8 N99 
    M1006 A36 B16 L99 C53 D16 M99 E53 F16 N99 
    M1006 W    
{endif}

The first section simply gives an immediate notification via audio of how high or low the Z Offset will be set; Chime going up for raised Z Offset (PETG, ABS and PA), and Chime going down for a lowered Z Offset (normal)

The second section is an adaptation of your code whereby it again gives an audible indication of the height of the Z Offset after setting this parameter.

The values I have used work flawlessly for me. However, I only noticed this after PETG was scraping the first layer which also highlighted I needed to do another calibration bed levelling (the 30min one from the configurationsettings on the printer). After that was done and I experiemented with a reasonable Z Offset to be as low as I could get it without issue, I have had perfect first layers and subsequent layers since.

(Edit: Tweaked my original code to be far more elegant in it’s operation, and tested it quite extensively, but not exhaustively, so do beware!)

I hope this helps someone :smiley:

Hello,
In addition to be above I have noticed a bug in Bambu Studio where it will strip the characters such as " \ " from the G-Code, rendering the above solution inoperable as it will never find the RegEx match so never lift the Z-Offset for PETG etc.

As such I have provided the following workaround, although this wouldn’t be my first choice of code, it will get the job done until, or even if BL fix the issue.

;=====printer start sound ===================
M17
G383.4 ; left-extruder load status detection
M400 S1

{if ((filament_type[initial_no_support_extruder] =~ /.*PETG.*/) ||
(filament_type[initial_no_support_extruder] =~ /.*TPU.*/) ||
(filament_type[initial_no_support_extruder] =~ /.*ABS.*/) ||
(filament_type[initial_no_support_extruder] =~ /.*PA.*/))}
  M1006 S1
  M1006 A53 B14 L99 C53 D14 M99 E53 F14 N99 
  M1006 A56 B9 L99 C56 D9 M99 E56 F9 N99 
  M1006 A61 B9 L99 C61 D9 M99 E61 F9 N99 
  M1006 A53 B14 L99 C53 D14 M99 E53 F14 N99 
  M1006 A56 B9 L99 C56 D9 M99 E56 F9 N99 
  M1006 A61 B18 L99 C61 D18 M99 E61 F18 N99 
  M1006 W
{else}
  M1006 S1
  M1006 A61 B14 L99 C61 D14 M99 E61 F14 N99 
  M1006 A56 B9 L99 C56 D9 M99 E56 F9 N99 
  M1006 A53 B9 L99 C53 D9 M99 E53 F9 N99 
  M1006 A61 B14 L99 C61 D14 M99 E61 F14 N99 
  M1006 A56 B9 L99 C56 D9 M99 E56 F9 N99 
  M1006 A53 B18 L99 C53 D18 M99 E53 F18 N99 
  M1006 W
{endif}
;=====printer start sound ===================

And the section;

;===== for PEI Plates , lower the nozzle as the nozzle was touching topmost of the texture when homing ==
{if (filament_type[initial_no_support_extruder] =~ /.*PETG.*/) ||
(filament_type[initial_no_support_extruder] =~ /.*TPU.*/) ||
(filament_type[initial_no_support_extruder] =~ /.*ABS.*/) ||
(filament_type[initial_no_support_extruder] =~ /.*PA.*/)}
; === Z-Offset for PETG, ABS and PA type filaments (Raised Slightly More from Default) ===
   {if curr_bed_type=="Textured PEI Plate"}
        G29.1 Z{0.02} ; for Textured PEI Plate = Bambu Lab default -0.02
   {else} 
        G29.1 Z{0.05} ; for Smooth PEI Plate = Bambu Lab default 0.00
   {endif}
   M400 S1
   M1006 S1
   M1006 A36 B24 L99 C53 D24 M99 E53 F24 N99 
   M1006 A0 B15 L0 C0 D15 M0 E0 F15 N0 
   M1006 A38 B8 L99 C53 D8 M99 E53 F8 N99 
   M1006 A42 B16 L99 C53 D16 M99 E53 F16 N99 
   M1006 W    
{else}
; === Z-Offset for ALL OTHER type filaments (Raised Slightly from Default) ===
    {if curr_bed_type=="Textured PEI Plate"}
         G29.1 Z{0.00} ; for Textured PEI Plate = Bambu Lab default -0.02
    {else} 
         G29.1 Z{0.03} ; for Smooth PEI Plate = Bambu Lab default 0.00
    {endif}
    M400 S1
    M1006 S1
    M1006 A42 B24 L99 C53 D24 M99 E53 F24 N99 
    M1006 A0 B15 L0 C0 D15 M0 E0 F15 N0 
    M1006 A40 B8 L99 C53 D8 M99 E53 F8 N99 
    M1006 A36 B16 L99 C53 D16 M99 E53 F16 N99 
    M1006 W    
{endif}

Any issues and I’ll take a look if you let me know about them.
Thanks.

Sorry, late to this thread but how did you determine that you had a faulty offset sensor? I’ve been suffering with very stuck PETG on my H2D since delivered last March. I’ve suspected first layer z-offset. Same filament works fine on my X1C.