Bambu Lab P1 X1 Dust Cap for linear guidance
Print Profile(1)

Description
Linear guidance for Bambu Lab P1 X1 :D G-code included in the description
This model modifies the original Bambu Lab printer's end G-code to prevent damage to the enclosure
Why?
In the standard end code, the printer moves to a maximum Z-height of 250 mm after printing. With some models—particularly those with very low part heights—the Z-axis carriage (or Z-sled) may travel so far down that it penetrates the enclosure or collides with internal components. This can lead to unnecessary stress or even damage.
Our Solution:
We have therefore deliberately limited the maximum Z-travel height in the end G-code to 210 mm.
Do you wish to print the model higher than 210 mm?
No problem! Simply adjust the Z-limit in the G-code—for example, to:
gcode
CopyEdit
G1 Z230 F600 G1 Z228 F600
Or use the original end code if you are certain that your build provides sufficient clearance.
Original Machine End G-code:
;===== date: 20230428 =====================
M400 ; wait for buffer to clear
G92 E0 ; zero the extruder
G1 E-0.8 F1800 ; retract
G1 Z{max_layer_z + 0.5} F900 ; lower z a little
G1 X65 Y245 F12000 ; move to safe pos
G1 Y265 F3000
G1 X65 Y245 F12000
G1 Y265 F3000
M140 S0 ; turn off bed
M106 S0 ; turn off fan
M106 P2 S0 ; turn off remote part cooling fan
M106 P3 S0 ; turn off chamber cooling fan
G1 X100 F12000 ; wipe
; pull back filament to AMS
M620 S255
G1 X20 Y50 F12000
G1 Y-3
T255
G1 X65 F12000
G1 Y265
G1 X100 F12000 ; wipe
M621 S255
M104 S0 ; turn off hotend
M622.1 S1 ; for prev firware, default turned on
M1002 judge_flag timelapse_record_flag
M622 J1
M400 ; wait all motion done
M991 S0 P-1 ;end smooth timelapse at safe pos
M400 S3 ;wait for last picture to be taken
M623; end of "timelapse_record_flag"
M400 ; wait all motion done
M17 S
M17 Z0.4 ; lower z motor current to reduce impact if there is something in the bottom
{if (max_layer_z + 100.0) < 250}
G1 Z{max_layer_z + 100.0} F600
G1 Z{max_layer_z +98.0}
{else}
G1 Z250 F600
G1 Z248
{endif}
M400 P100
M17 R ; restore z current
M220 S100 ; Reset feedrate magnitude
M201.2 K1.0 ; Reset acc magnitude
M73.2 R1.0 ;Reset left time magnitude
M1002 set_gcode_claim_speed_level : 0
M17 X0.8 Y0.8 Z0.5 ; lower motor current to 45% power
Modified Machine G-code:
; === Print completion with Z-limit and gentle XY return ===
M400 ; Wait until all movements are complete
G92 E0 ; Zero extruder
G1 E-0.8 F1800 ; Retraction
; Z only up to max. 210 mm
{if (max_layer_z + 0.5) < 210}
G1 Z{max_layer_z + 0.5} F600
G1 Z{max_layer_z + 0.3} F600
{else}
G1 Z210 F600
G1 Z208 F600
{endif}
; Gentle XY return by approx. 50 mm
; Example model center at X150 Y150
G1 X200 Y200 F3000 ; Return with offset and moderate speed
; Continue as usual
M140 S0 ; Turn off heated bed
M106 S0 ; Turn off fan
M104 S0 ; Turn off hotend
M84 ; Turn off motors
M117 Print complete – in park position




Comment & Rating (16)