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.