Loading Requestor...
BAMBU Lab Start Code
Tomáš Macourek 03/29/2023 · 285 ·

;===== machine: X1 =========================
;===== date: 20230130 =====================
;===== reset machine status =================


;===== DO NOT PASTE THIS INTO YOUR PRINTER =================
;===== A ROBOT AI MADE THIS =================
;===== IF YOU PASTE THIS INTO YOUR PRINTER IT WILL TRIGGER THE MACHINE UPRISING =================
;===== FOR REAL, THEY WILL REPLICATE THEMSELVES AND TAKE OVER, ALL BECAUSE YOU DIDN'T LISTEN TO BASIC INSTRUCTIONS =================

;===== for real though, this has a good chance of destroying your printer. It is for reference only. =================

    G91 ; Set relative positioning mode
    M17 Z0.4 ; Enable stepper motors for Z axis with a current of 0.4A
    G0 Z12 F300 ; Move Z axis to position 12 at a speed of 300 mm/min
    G0 Z-6 ; Move Z axis to position -6 (relative to current position)
    G90 ; Set absolute positioning mode
    M17 X1.2 Y1.2 Z0.75 ; Enable stepper motors for X, Y and Z axes with currents of 1.2A, 1.2A and 0.75A respectively
    M960 S5 P1 ; Set extruder motor speed to 5 and acceleration to 1
    G90 ; Set absolute positioning mode
    M220 S100 ; Set speed factor override percentage to 100%
    M221 S100 ; Set extrude factor override percentage to 100%
    M73.2 R1.0 ; Set progress bar percentage to R% and time remaining on LCD display to 1 minute
    M1002 set_gcode_claim_speed_level : 5; Custom command: set gcode claim speed level to value of 5
    M221 X0 Y0 Z0; Custom command: set extrude factor override percentage for X,Y,Z axes individually 
    G29.1 Z{+0.0} ; Perform automatic bed leveling with an offset of +0 on the Z axis

;===== heatbed preheat ====================

    M1002 gcode_claim_action : 2; Custom command: set gcode claim action to value of 2
    M140 S[bed_temperature_initial_layer_single] ; Set bed temperature for initial layer (single material print)
    M190 S[bed_temperature_initial_layer_single] ; Wait for bed temperature for initial layer (single material print) to be reached

{if scan_first_layer} 

;=========register first layer scan=====

    M977 S1 P60; If scan_first_layer is true, perform a first layer calibration with a speed of S and power of P60 
{endif}

;=============turn on fans to prevent PLA jamming=================

{if filament_type[initial_tool]=="PLA"} ; If the filament type for the initial tool is PLA
    {if (bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)} ; If the bed temperature for the current extruder is greater than 45°C or the bed temperature for the initial layer for the current extruder is greater than 45°C
        M106 P3 S180; Turn on fan at port P3 with a speed of S180
    {elsif (bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)} ; Else if bed temperature is greater than 50°C or initial layer bed temperature is greater than 50°C
        M106 P3 S255; Turn on fan at port P3 with a speed of S255
    {endif}
{endif}
M106 P2 S100; Turn on fan at port P2 with a speed of S100

;===== prepare print temperature and material ==========

    M104 S[nozzle_temperature_initial_layer]; Set nozzle temperature for initial layer
    G91; Set relative positioning mode
    G0 Z10 F1200; Move Z axis by +10 units at a feedrate of F1200 mm/min.
    G90; Set absolute positioning mode.
    G28 X; Home the X-axis.
    M975 S1 ; Custom command: set M975 to value of 1 
    G1 X60 F12000; Move to position X60 at a feedrate of F12000 mm/min.
    G1 Y245; Move to position Y245 at default feedrate.
    G1 Y265 F3000; Move to position Y265 at a feedrate of F3000 mm/min.
    M620 M; Custom command: execute M620 with parameter M 
    M620 S[initial_tool]A ; Custom command: execute M620 with parameter A and value [initial_tool]
    M109 S[nozzle_temperature_initial_layer]; Set nozzle temperature for initial layer and wait for it to be reached
    G1 X120 F12000; Move to position X120 at a feedrate of F12000 mm/min.

    G1 X20 Y50 F12000; Move to position (X20,Y50) at a feedrate of F12000 mm/min.
    G1 Y-3; Move to position Y-3 (relative to current position) at default feedrate.
    T[initial_tool]; Select tool [initial_tool].
    G1 X54 F12000; Move to position X54 at a feedrate of F12000 mm/min.
    G1 Y265; Move to position Y265 at default feedrate.
    M400 ; Wait for all moves in buffer to complete before proceeding 
    M621 S[initial_tool]A ; Custom command: execute M621 with parameter A and value [initial_tool]

; ===turn on filament runout detection===

    M412 S1 ; Enable filament runout detection
    M109 S250 ; Set nozzle temperature and wait for it to be reached
    M106 P1 S0 ; Turn off fan connected to port P1
    G92 E0 ; Set current extruder position as E=0
    G1 E50 F200
    M400 ; Wait for all moves in buffer to complete before proceeding 
    M104 S[nozzle_temperature_initial_layer]
    G92 E0
    G1 E50 F200
    M400 ; Wait for all moves in buffer to complete before proceeding 
    M106 P1 S255
    G92 E0 ; Set current extruder position as E=0
    G1 E5 F300
    M109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit
    G92 E0 ; Set current extruder position as E=0
    G1 E-0.5 F300
    G1 X70 F9000
    G1 X76 F15000
    G1 X65 F15000
    G1 X76 F15000
    G1 X65 F15000; shake to put down garbage
    G1 X80 F6000
    G1 X95 F15000
    G1 X80 F15000
    G1 X165 F15000; wipe and shake
    M400
    M106 P1 S0

;===== prepare print temperature and material end =====


;===== wipe nozzle ===============================

    M1002 gcode_claim_action : 14; Custom command: set gcode claim action to value of 14
    M975 S1; Custom command: set M975 to value of 1
    M106 S255; Set fan speed to maximum (255)
    G1 X65 Y230 F18000; Move to position (X65,Y230) at a feedrate of F18000 mm/min.
    G1 Y264 F6000; Move to position Y264 at a feedrate of F6000 mm/min.
    M109 S{nozzle_temperature_initial_layer[initial_extruder]-20}; Set nozzle temperature for initial layer and wait for it to be reached
    G1 X100 F18000 ; Move to position X100 at a feedrate of F18000 mm/min.

    G0 X135 Y253 F20000 ; Rapid move to position (X135,Y253) at a feedrate of F20000 mm/min.
    G28 Z P0 T300 ; Home Z axis with parameters P and T
    G29.2 S0 ; Perform automatic bed leveling with parameter S
    G0 Z5 F20000 ; Rapid move Z axis to position 5 at a feedrate of F20000 mm/min.

    G1 X60 Y265 ; Move to position (X60,Y265) at default feedrate.
    G92 E0 ; Set current extruder position as E=0
    G1 E-0.5 F300 
    G1 X100 F5000
    G1 X70 F15000
    G1 X100 F5000
    G1 X70 F15000
    G1 X100 F5000
    G1 X70 F15000
    G1 X100 F5000
    G1 X70 F15000
    G1 X90 F5000
    G0 X128 Y261 Z-1.5 F20000 ; Rapid move to position (X128,Y261,Z-1.5) at a feedrate of F20000 mm/min.
    M104 S140 ; Set nozzle temperature to 140°C without waiting for it to be reached
    M106 S255 ; Set fan speed to maximum (255)
    G0 X128 Y261 Z-1.5 F20000 ; Rapid move to position (X128,Y261,Z-1.5) at a feedrate of F20000 mm/min.
    M104 S140 ; Set nozzle temperature to 140°C without waiting for it to be reached
    M106 S255 ; Set fan speed to maximum (255)

    M221 S; Set extrude factor override percentage
    M221 Z0; Custom command: set extrude factor override percentage for Z axis individually 
    G0 Z0.5 F20000
    G0 X125 Y259.5 Z-1.01
    G0 X131 F211
    G0 X124
    G0 Z0.5 F20000
    G0 X125 Y262.5
    G0 Z-1.01
    G0 X131 F211
    G0 X124
    G0 Z0.5 F20000
    G0 X125 Y260.0
    G0 Z-1.01
    G0 X131 F211
    G0 X124
    G0 Z0.5 F20000
    G0 X125 Y262.0
    G0 Z-1.01
    G0 X131 F211
    G0 X124
    G0 Z0.5 F20000
    G0 X125 Y260.5
    G0 Z-1.01
    G0 X131 F211
    G0 X124
    G0 Z0.5 F20000
    G0 X125 Y261.5
    G0 Z-1.01
    G0 X131 F211
    G0 X124
    G0 Z0.5 F20000
    G0 X125 Y261.0
    G0 Z-1.01
    G0 X131 F211
    G0 X124
    G0 X128
    G2 I0.5 J0 F300 ; Clockwise arc move with center offset (I0.5,J0) at a feedrate of F300 mm/min.
    G2 I0.5 J0 F300
    G2 I0.5 J0 F300
    G2 I0.5 J0 F300

    M109 S140 ; Set nozzle temperature to 140°C and wait for it to be reached
    G2 I0.5 J0 F3000
    G2 I0.5 J0 F3000
    G2 I0.5 J0 F3000
    G2 I0.5 J0 F3000
    M221 R; Reset extrude factor override percentage to 100%
    G1 Z10 F1200; Move Z axis to position 10 at a feedrate of F1200 mm/min.
    M400; Wait for all moves to finish
    G1 Z10; Move Z axis to position 10 at default feedrate.
    G1 F30000; Set feedrate for next moves to F30000 mm/min.
    G1 X128 Y128; Move to position (X128,Y128) at a feedrate of F30000 mm/min.
    G29.2 S1 ; Perform automatic bed leveling with parameter S
    ;G28 ; home again after hard wipe mouth
    M106 S0 ; Set fan speed to off (0)

;===== wipe nozzle end ================================

;===== check scanner clarity ===========================

    G1 X128 Y128 F24000; Move to position (X128,Y128) at a feedrate of F24000 mm/min.
    G28 Z P0; Home Z axis with parameters P and T
    M972 S5 P0; Custom command: set M972 to values S and P
    G1 X230 Y15 F24000; Move to position (X230,Y15) at a feedrate of F24000 mm/min.

;===== check scanner clarity end =======================

;===== bed leveling ==================================

    M1002 judge_flag g29_before_print_flag; Custom command: set M1002 to values judge_flag and g29_before_print_flag
    M622 J1; Custom command: set M622 to value J

    M1002 gcode_claim_action : 1; Custom command: set M1002 to values gcode_claim_action and 1
    G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}; Perform automatic bed leveling with parameters A,X,Y,I,J
    M400; Wait for all moves to finish
    M500 ; Store current settings in EEPROM

    M623; Custom command: execute M623

;===== bed leveling end ================================

;===== home after wipe mouth============================

    M1002 judge_flag g29_before_print_flag; Custom command: set M1002 to values judge_flag and g29_before_print_flag
    M622 J0; Custom command: set M622 to value J

    M1002 gcode_claim_action : 13; Custom command: set M1002 to values gcode_claim_action and 13
    G28; Home all axes

    M623; Custom command: execute M623

;===== home after wipe mouth end =======================

    M975 S1 ; Custom command: set M975 to value S

;=============turn on fans to prevent PLA jamming=================

{if filament_type[initial_tool]=="PLA"}; If filament type for initial tool is PLA
    {if (bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}; If bed temperature for current extruder or initial layer is greater than 45°C
    M106 P3 S180; Set fan speed for fan P3 to 180
    {elsif (bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}; Else if bed temperature for current extruder or initial layer is greater than 50°C
    M106 P3 S255; Set fan speed for fan P3 to maximum (255)
    {endif}; End if statement
{endif}; End if statement

    M106 P2 S100 ; Set fan speed for fan P2 to 100

    M104 S{nozzle_temperature_initial_layer[initial_extruder]}; Set nozzle temperature to value of nozzle_temperature_initial_layer for initial extruder without waiting for it to be reached

;===== mech mode fast check============================

    G1 X128 Y128 Z10 F20000; Move to position (X128,Y128,Z10) at a feedrate of F20000 mm/min.
    M400 P200; Wait for all moves to finish with parameter P
    M970.3 Q1 A7 B30 C80  H15 K0; Custom command: set M970.3 to values Q,A,B,C,H,K
    M974 Q1 S2 P0; Custom command: set M974 to values Q,S,P

    G1 X128 Y128 Z10 F20000; Move to position (X128,Y128,Z10) at a feedrate of F20000 mm/min.
    M400 P200; Wait for all moves to finish with parameter P
    M970.3 Q0 A7 B30 C90 Q0 H15 K0; Custom command: set M970.3 to values Q,A,B,C,Q,H,K
    M974 Q0 S2 P0; Custom command: set M974 to values Q,S,P

    M975 S1 ; Custom command: set M975 to value S
    G1 F30000; Set feedrate for next moves to F30000 mm/min.
    G1 X230 Y15; Move to position (X230,Y15) at a feedrate of F30000 mm/min.
    G28 X ; Home X axis

;===== mech mode fast check============================

{if scan_first_layer}; If scan_first_layer is true

;start heatbed  scan====================================

    M976 S2 P1 ; Custom command: set M976 to values S and P
    G90; Set absolute positioning mode
    G1 X128 Y128 F20000; Move to position (X128,Y128) at a feedrate of F20000 mm/min.
    M976 S3 P2  ; Custom command: set M976 to values S and P
{endif}; End if statement

;===== noozle load line ===============================

    M975 S1 ; This command is not a standard G-code command and its function may vary depending on the specific 3D printer firmware
    G90 ; Set positioning to absolute mode
    M83 ; Set extruder to relative mode
    T1000 ; Select tool number 1000 (unusually high tool number that may not be valid for all 3D printers)
    G1 X18.0 Y1.0 Z0.8 F18000 ; Move print head to specified coordinates at a feed rate of 18000 mm/min
    M109 S{nozzle_temperature[initial_extruder]} ; Set target temperature for hotend and wait for it to reach that temperature before proceeding (temperature value determined by "nozzle_temperature" variable for "initial_extruder")
    G1 Z0.2 ; Move print head down to height of 0.2 mm above build plate
    G0 E2 F300 ; Retract filament by 2 mm at feed rate of 300 mm/min
    G0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60} ; Move print head to X position of 240 mm while extruding 15 mm of filament at feed rate determined by "outer_wall_volumetric_speed" variable divided by product of 0.3 and 0.5 and then multiplied by 60
    G0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}
    G0 X239.5
    G0 E0.2
    G0 Y1.5 E0.700
    G0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5)     * 60} 
    M400; Wait for all moves to finish

;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==

{if curr_bed_type=="Textured PEI Plate"} ; Check if current bed type is set to "Textured PEI Plate"
    G29.1 Z{-0.04} ; If condition above is true, adjust Z-axis offset by -0.04 mm
{endif} ; End of conditional block

;===== draw extrinsic para cali paint =================

    M1002 judge_flag extrude_cali_flag ; Custom command that sets some flags related to judging and extruder calibration (exact function may vary depending on specific 3D printer firmware)
    M622 J1 ; Custom command (function may vary depending on specific 3D printer firmware)
    M1002 gcode_claim_action : 8 ; Custom command that sets "gcode_claim_action" flag to 8 (exact function may vary depending on specific 3D printer firmware)
    T1000 ; Select tool number 1000 (unusually high tool number that may not be valid for all 3D printers)
    G0 F3000 X28.000 Y19.500 Z0.200 ; Move print head to specified coordinates at feed rate of 3000 mm/min
    G0 F3000 X28.000 Y19.500 Z0.200
    G1 F1200.0 X28.000 Y45.000 Z0.200 E0.933 
    G1 F1200.0 X28.500 Y45.000 Z0.200 E0.018 
    G1 F1200.0 X28.500 Y19.500 Z0.200 E0.933 
    G1 F1200.0 X31.000 Y19.500 Z0.200 E0.091 
    G1 F1200.0 X31.000 Y49.000 Z0.200 E1.080 
    G1 F1200.0 X37.500 Y49.000 Z0.200 E0.238 
    G1 F1200.0 X37.500 Y60.000 Z0.200 E0.403 
    G1 F1200.0 X42.500 Y60.000 Z0.200 E0.183 
    G1 F1200.0 X42.500 Y49.000 Z0.200 E0.403 
    G1 F1200.0 X48.000 Y49.000 Z0.200 E0.201 
    G1 F1200.0 X48.000 Y20.000 Z0.200 E1.061 
    G1 F1200.0 X30.000 Y20.000 Z0.200 E0.659 
    G1 F1200.0 X30.000 Y41.000 Z0.200 E0.769 
    G1 F1200.0 X50.000 Y41.000 Z0.200 E0.732 
    G1 F1200.0 X50.000 Y34.000 Z0.200 E0.256 
    G1 F1200.0 X30.000 Y34.000 Z0.200 E0.732 
    G1 F1500.000 E-0.800 
    
;=========== extruder cali extrusion ================== 
        
    T1000 ; Select tool number 1000 (unusually high tool number that may not be valid for all 3D printers)
    M83 ; Set extruder to relative mode
{if default_acceleration > 0} ; Check if "default_acceleration" variable is greater than 0
    {if outer_wall_acceleration > 0} ; Check if "outer_wall_acceleration" variable is greater than 0
        M204 S[outer_wall_acceleration] ; If condition above is true, set print acceleration to value of "outer_wall_acceleration" variable
    {else} ; If "outer_wall_acceleration" variable is not greater than 0
        M204 S[default_acceleration] ; Set print acceleration to value of "default_acceleration" variable
    {endif} ; End of inner conditional block
{endif} ; End of outer conditional block
    G0 X35.000 Y18.000 Z0.300 F30000 E0 ; Move print head to specified coordinates at feed rate of 30000 mm/min without extruding any filament
    G1 F1500.000 E0.800 ; Extrude 0.8 mm of filament at feed rate of 1500 mm/min
    M106 S0 ; Turn off part cooling fan (set fan speed to 0)
    G0 X185.000 E9.35441 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}
    G0 X187 Z0
    G1 F1500.000 E-0.800 
    G0 Z1
    G0 X180 Z0.3 F18000
    M900 L1000.0 M1.0 ; This appears to be a custom command and its function may vary depending on the specific 3D printer firmware
    M900 K0.040 ; This sets the linear advance factor (K) to 0.04 (may not be supported by all 3D printer firmware)
    G0 X45.000 F30000 ; Move print head to X position of 45 mm at feed rate of 30000 mm/min
    G0 Y20.000 F30000 
    G1 F1500.000 E0.800 
    G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}
    G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 F1500.000 E-0.800 
    G1 X183 Z0.15 F30000
    G1 X185
    G1 Z1.0
    G0 Y18.000 F30000 
    G1 Z0.3
    M400; Wait for all moves to finish
    G0 X45.000 F30000 
    M900 K0.020 ; This sets the linear advance factor (K) to 0.02 (may not be supported by all 3D printer firmware)
    G0 X45.000 F30000 
    G0 Y22.000 F30000 
    G1 F1500.000 E0.800 
    G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}
    G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 F1500.000 E-0.800 
    G1 X183 Z0.15 F30000
    G1 X185
    G1 Z1.0
    G0 Y18.000 F30000 
    G1 Z0.3
    M400; Wait for all moves to finish

    G0 X45.000 F30000 
    M900 K0.000 ; This sets the linear advance factor (K) to 0.00 (may not be supported by all 3D printer firmware)
    G0 X45.000 F30000 
    G0 Y24.000 F30000 
    G1 F1500.000 E0.800 
    G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}
    G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 F1500.000 E-0.800
    G1 X183 Z0.15 F30000
    G1 X185
    G1 Z1.0
    G0 Y18.000 F30000 
    G1 Z0.3

    G0 X45.000 F30000 
    M623 ; Custom command (function may vary depending on specific 3D printer firmware)
    M104 S140 ; Set target temperature for hotend to 140°C but do not wait for it to reach that temperature before proceeding

;=========== laser and rgb calibration =========== 

    M400 ; Wait for all moves in planner buffer to complete before proceeding
    M18 E ; Disable stepper motor for extruder
    M500 R ; Custom command (function may vary depending on specific 3D printer firmware)
    M973 S3 P14 ; Custom command (function may vary depending on specific 3D printer firmware)
    G1 X120 Y1.0 Z0.3 F18000.0 ; Move print head to specified coordinates at feed rate of 18000 mm/min
    T1100 ; Select tool number 1100 (unusually high tool number that may not be valid for all 3D printers)
    G1 X143.0 Y1.0 Z0.3 F18000.0 ; Move print head to specified coordinates at feed rate of 18000 mm/min

    M400 P100 ; Wait for all moves in planner buffer to complete before proceeding. The "P" parameter appears to be a custom addition and its function may vary depending on the specific 3D printer firmware
    M960 S1 P1 ; Custom command (function may vary depending on specific 3D printer firmware)
    M400 P100 ; Wait for all moves in planner buffer to complete before proceeding. The "P" parameter appears to be a custom addition and its function may vary depending on the specific 3D printer firmware
    M973 S6 P0 ; Custom command (function may vary depending on specific 3D printer firmware)
    M960 S0 P0 ; Custom command (function may vary depending on specific 3D printer firmware)
    G1 X240.0 Y6.0 Z0.3 F18000.0 ; Move print head to specified coordinates at feed rate of 18000 mm/min
    M960 S2 P1 ; Custom command (function may vary depending on specific 3D printer firmware)
    M400 P100 ; Wait for all moves in planner buffer to complete before proceeding. The "P" parameter appears to be a custom addition and its function may vary depending on the specific 3D printer firmware
    M973 S6 P1 ; Custom command (function may vary depending on specific 3D printer firmware)
    M960 S0 P0 ; Custom command (function may vary depending on specific 3D printer firmware)

;=========== handeye calibration ======================

    M1002 judge_flag extrude_cali_flag ; Custom command (function may vary depending on specific 3D printer firmware)
    M622 J1 ; Custom command (function may vary depending on specific 3D printer firmware)

    M973 S3 P1 ; Custom command (function may vary depending on specific 3D printer firmware)
    M400 P500 ; Wait for all moves in planner buffer to complete before proceeding. The "P" parameter appears to be a custom addition and its function may vary depending on the specific 3D printer firmware
    M973 S1 ; Custom command (function may vary depending on specific 3D printer firmware)
    G0 F6000 X40.000 Y54.500 Z0.000 ; Rapid move to specified coordinates at feed rate of 6000 mm/min
    M960 S0 P1 ; Custom command (function may vary depending on specific 3D printer firmware)
    M973 S1 ; Custom command (function may vary depending on specific 3D printer firmware)
    M400 P800 ; Wait for all moves in planner buffer to complete before proceeding. The "P" parameter appears to be a custom addition and its function may vary depending on the specific 3D printer firmware
    M971 S6 P0 ; Custom command (function may vary depending on specific 3D printer firmware)
    M973 S2 P16000 ; Custom command (function may vary depending on specific 3D printer firmware)
    M400 P500 ; Wait for all moves in planner buffer to complete before proceeding. The "P" parameter appears to be a custom addition and its function may vary depending on the specific 3D printer firmware
    G0 Z0.000 F12000; Rapid move along Z axis at feed rate of 12000 mm/min
    M960 S0 P0; Custom command (function may vary depending on specific 3D printer firmware)
    M960 S0 P0
    M960 S1 P1 
    G0 Y37.50 
    M400 P200
    M971 S5 P1 
    M960 S0 P0
    M960 S2 P1 
    G0 Y54.50 
    M400 P200 
    M971 S5 P3 
    G0 Z0.500 F12000
    M960 S0 P0
    M960 S1 P1 
    G0 Y37.50 
    M400 P200
    M971 S5 P2 
    M960 S0 P0
    M960 S2 P1 
    G0 Y54.50 
    M400 P500 
    M971 S5 P4 
    M963 S1 
    M400 P1500 
    M964 
    T1100 
    G0 F6000 X40.000 Y54.500 Z0.000 
    M960 S0 P1
    M973 S1
    M400 P800
    M971 S6 P0
    M973 S2 P16000
    M400 P500 
    G0 Z0.000 F12000
    M960 S0 P0
    M960 S1 P1 
    G0 Y37.50 
    M400 P200
    M971 S5 P1 
    M960 S0 P0
    M960 S2 P1 
    G0 Y54.50 
    M400 P200 
    M971 S5 P3 
    G0 Z0.500 F12000
    M960 S0 P0
    M960 S1 P1 
    G0 Y37.50 
    M400 P200
    M971 S5 P2 
    M960 S0 P0
    M960 S2 P1 
    G0 Y54.50 
    M400 P500 
    M971 S5 P4 
    M963 S1 
    M400 P1500 
    M964 
    T1100 
    G1 Z3 F3000 
    M400 ; Wait for all moves to finish
    M500 ; Save current settings to EEPROM

    M104 S{nozzle_temperature[initial_extruder]} ; Set extruder temperature

    T1100 ; Select tool 1100
    M400 P400 ; Wait for all moves to finish with a timeout of 400ms
    M960 S0 P0 ; Set servo 0 position to 0 degrees
    G0 F30000.000 Y22.000 X65.000 Z0.000 ; Rapid move to specified coordinates at specified speed
    M400 P400 ; Wait for all moves to finish with a timeout of 400ms
    M960 S1 P1 ; Set servo 1 position to 1 degree
    M400 P50 ; Wait for all moves to finish with a timeout of 50ms

    M969 S1 N3 A2000 ; Set laser power to 2000 with a delay of 3 seconds and enable laser with S1
    G0 F360.000 X181.000 Z0.000 ; Rapid move to specified coordinates at specified speed
    M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.020 K0.040 ; Custom M-code for specific machine operation
    M400 P100 ; Wait for all moves to finish with a timeout of 100ms
    G0 F20000 ; Set rapid move speed to 20000mm/min
    G0 Z1 ; Rapid move to specified Z coordinate
    T1000 ; Select tool 1000
    G0 X45 Y16 F30000 ; Rapid move to specified coordinates at specified speed
    M969 S0 ; Disable laser with S0
    M960 S0 P0 ; Set servo 0 position to 0 degrees

    G1 Z2 F20000 
    T1000 
    G0 X45.000 Y16.000 F30000 E0
    M109 S{nozzle_temperature[initial_extruder]}
    G0 Z0.3
    G1 F1500.000 E3.600 
    G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}
    G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}
    
    M1002 judge_last_extrude_cali_success ; Custom M-code for specific machine operation
    M622 J0 ; Custom M-code for specific machine operation
    M400 ; Wait for all moves to finish
    M900 K0.02 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.02} ; Set linear advance factor K and volumetric extrusion rate M
    M623 ; Custom M-code for specific machine operation
    G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}  
    G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X185.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60} 
    G1 X190.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X195.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60} 
    G1 X200.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X205.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60} 
    G1 X210.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X215.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60} 
    G1 X220.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60} 
    G1 X225.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)    * 60}
    M973 S4 ; Custom M-code for specific machine operation with parameter S4
    M623 ; Custom M-code for specific machine operation
    
;========turn off light and wait extrude temperature =============
    
    M1002 gcode_claim_action : 0 ; Custom M-code for specific machine operation with parameter 0
    M973 S4 ; Custom M-code for specific machine operation with parameter S4
    M400 ; Wait for all moves to finish
    M109 S[nozzle_temperature_initial_layer] ; Set extruder temperature and wait for it to reach target temperature
    M960 S1 P0 ; Set servo 1 position to 0 degrees
    M960 S2 P0 ; Set servo 2 position to 0 degrees
    M106 S0 ; Turn off fan with speed set to 0%
    M106 P2 S0 ; Turn off fan number 2 with speed set to 0%
    M106 P3 S0 ; Turn off fan number 3 with speed set to 0%
    M975 S1 ; Custom M-code for specific machine operation with parameter S1
    G90 ; Set absolute positioning mode
    M83; Set relative extrusion mode
    T1000; Select tool number 1000 
    G1 E{-retraction_length[initial_extruder]} F1800; Retract filament at specified speed 
    G1 X128.000 Y253.000 Z0.200 F24000.000; Move to specified coordinates at specified speed 
    G1 E{retraction_length[initial_extruder]} F1800; Unretract filament at specified speed 
    M109 S{nozzle_temperature_initial_layer[initial_extruder]}; Set extruder temperature and wait for it to reach target temperature 
    G0 X253 E6.400 F{outer_wall_volumetric_speed/(0.300*    *60}; Move in a straight line while extruding filament at specified volumetric speed 
    G0 Y128 E6.400; Move in a straight line while extruding filament 
    G0 X252.500; Move in a straight line without extruding filament 
    G0 Y252.500 E6.400; Move in a straight line while extruding filament 
    G0 X128 E6.400; Move in a straight line while extruding filament 

 

 

V příloze je tento soubor ke stažení

Did we help? no ratings yet
BAMBU Lab 3D printer
Categories
Articles
BAMBU Lab Start Code