bambu icon indicating copy to clipboard operation
bambu copied to clipboard

No longer works in Bambu Studio v2.1.0.59

Open canton7 opened this issue 1 year ago • 7 comments

I noticed that this no longer works after upgrading to Bambu Studio v2.1.0.59.

I threw together a quick test, sliced with v1.10.1.50 (which works), and v2.1.0.59 (which does not).

Test-1.10.1.50.txt Test-2.1.0.59.txt

Diffing them highlights the problem nicely:

 ;===== machine: A1 mini =========================
 ;===== date: 20240830  =======================
 G392 S0
 M1007 S0
 ;M620 S1A ; REMOVED: skips all next code if no AMS is available
 M204 S9000
 
-G17
-G2 Z0.6 I0.86 J0.86 P1 F10000 ; spiral lift a little from second lift
-;=endif= ; MOVED DOWN: To ensure all needed code is executed. Changed curly braces signs to equal signs to solve parse error.
-G1 Z3.2 F1200
-
-M400
-M106 P1 S0
-M106 P2 S0
-
-M104 S220
-
-
-G1 X185 F18000 ; moves next to cutting position
-M17 S ; saves the default stepper current values
-M400 ; waits for commands to complete
-M17 X1 ; sets x stepper current higher
-G1 X197 F400 ; cuts filament a little slower, ADDED: finetuning by pakonambawan
-G1 X185 F500 ; returns back to position before cutting, ADDED: finetuning by pakonambawan
-M400 ; waits for commands to complete
-M17 R ; restores saved stepper current values
-
-M620.1 E F548 T240
-M620.10 A0 F548
-T1
-M620.1 E F548 T240
-M620.10 A1 F548 L140.108 H0.4 T240
-
-;G1 Y90 F9000 ; REMOVED from original GCODE
-; -- BEGIN ADDED LINES --
-G1 X0 Y90 F18000
-G1 X-13.5 F9000
-M73 P61 R3
-G1 E-13.5 F900
-
-; pause for user to load and press resume
-M400 U1
-; -- END ADDED LINES --
-
-
-M400
-
-G92 E0
-;M628 S0 ; REMOVED: causes printer to crash without AMS
-
-
-; FLUSH_START
-; always use highest temperature to flush
-M400
-M1002 set_filament_type:UNKNOWN
-M109 S240
-M106 P1 S60
-
-G1 E23.7 F548 ; do not need pulsatile flushing for start part
-G1 E0.927083 F50
-G1 E10.6615 F548
-M73 P66 R3
-G1 E0.927083 F50
-G1 E10.6615 F548
-G1 E0.927083 F50
-G1 E10.6615 F548
-G1 E0.927083 F50
-G1 E10.6615 F548
-
-; FLUSH_END
-G1 E-2 F1800
-G1 E2 F300
-M400
-M1002 set_filament_type:PLA
-
-
-
-; WIPE
-M400
-M106 P1 S178
-M400 S3
-G1 X-3.5 F18000
-G1 X-13.5 F3000
-G1 X-3.5 F18000
-G1 X-13.5 F3000
-G1 X-3.5 F18000
-G1 X-13.5 F3000
-M400
-M106 P1 S0
-
-
-
-M106 P1 S60
-; FLUSH_START
-G1 E12.6097 F548
-G1 E1.40108 F50
-G1 E12.6097 F548
-G1 E1.40108 F50
-G1 E12.6097 F548
-G1 E1.40108 F50
-G1 E12.6097 F548
-G1 E1.40108 F50
-G1 E12.6097 F548
-G1 E1.40108 F50
-; FLUSH_END
-M73 P67 R2
-G1 E-2 F1800
-G1 E2 F300
-
-
-
-
-
-
-
-
-
-
-M629
-
-M400
-M106 P1 S60
-M109 S220
-M73 P68 R2
-G1 E5 F548 ;Compensate for filament spillage during waiting temperature
-M400
-G92 E0
-G1 E-2 F1800
-M400
-M106 P1 S178
-M400 S3
-G1 X-3.5 F18000
-G1 X-13.5 F3000
-M73 P69 R2
-G1 X-3.5 F18000
-G1 X-13.5 F3000
-G1 X-3.5 F18000
-G1 X-13.5 F3000
-G1 X-3.5 F18000
-M73 P70 R2
-G1 X-13.5 F3000
-M400
-G1 Z3.2
-M106 P1 S0
-
-M204 S500
-
-
-
-; -- BEGIN ADDED LINES --
-
 M620 S1A
 T1
+M73 E1
 ; -- END ADDED LINES --
 M621 S1A
 
 
 M622.1 S0
 
-M9833 F6.28466 A0.3 ; cali dynamic extrusion compensation
+M9833 F7.36991 A0.3 ; cali dynamic extrusion compensation
 M1002 judge_flag filament_need_cali_flag
 M622 J1
   G92 E0
   G1 E-2 F1800
   M400
   
   M106 P1 S178
   M400 S7
   G1 X0 F18000
   G1 X-13.5 F3000
-M73 P71 R2
   G1 X0 F18000 ;wipe and shake
   G1 X-13.5 F3000
   G1 X0 F12000 ;wipe and shake
   G1 X-13.5 F3000
   G1 X0 F12000 ;wipe and shake
   M400
   M106 P1 S0 
 M623
 
 G392 S0
 M1007 S1

It looks like the new Bambu Studio is setting toolchange_count to 0, so that everything between the this {if toolchange_count > 0} and this {endif} is getting skipped.

I've run out of time to test removing the if/endif: I'll do that when I get the chance.

It would be great if someone else can test too, make sure it's not just some oddity with my setup!

canton7 avatar Jun 14 '25 20:06 canton7

Removing the two lines I highlighted works fine.

(You do need to remove them, not just comment them out, as the pre-processor doesn't take account of comments)

canton7 avatar Jun 26 '25 13:06 canton7

Same for me, I just tried the following and it works even within the same layer.

;===== Latest change filament code (no AMS for A1 Mini) can be found at:
;===== https://github.com/Dennis-Q/bambu
;=====
;===== Based on work of eukatree and some contributors (Hillbilly-Phil and pakonambawan)
;===== https://github.com/eukatree/Bambu_CustomGCode/
;=====
;===== Updated: 20250127
;================================================
;
;===== Install instructions (Bambu Studio / Orca Slicer):
;===== Copy this complete file (including all comments)
;===== to the 'Change filament G-code'-section which can be 
;===== found in 'Printer settings' - 'Machine code' menu.
;===== Then, save the printer and use it with multi-color prints.
;
;===== Instructions (by Hillbilly-Phil): =====
; when print has paused, go into control
; set the nozzle temp to the temp you were printing with
; unload the filament by pushing on the upper extruder-button 
; load the new filament by pushing on the lower extruder-button 
; resume the print (flushing will happen next,
; flushing volumes can be set in Bambu Studio as if using an AMS)
;
;===== machine: A1 mini =========================
;===== date: 20240830  =======================
G392 S0
M1007 S0
;M620 S[next_extruder]A ; REMOVED: skips all next code if no AMS is available
M204 S9000
G17
G2 Z{max_layer_z + 0.4} I0.86 J0.86 P1 F10000 ; spiral lift a little from second lift
;=endif= ; MOVED DOWN: To ensure all needed code is executed. Changed curly braces signs to equal signs to solve parse error.
G1 Z{max_layer_z + 3.0} F1200

M400
M106 P1 S0
M106 P2 S0
{if old_filament_temp > 142 && next_extruder < 255}
M104 S[old_filament_temp]
{endif}

G1 X185 F18000 ; moves next to cutting position
M17 S ; saves the default stepper current values
M400 ; waits for commands to complete
M17 X1 ; sets x stepper current higher
G1 X197 F400 ; cuts filament a little slower, ADDED: finetuning by pakonambawan
G1 X185 F500 ; returns back to position before cutting, ADDED: finetuning by pakonambawan
M400 ; waits for commands to complete
M17 R ; restores saved stepper current values

M620.1 E F[old_filament_e_feedrate] T{nozzle_temperature_range_high[previous_extruder]}
M620.10 A0 F[old_filament_e_feedrate]
T[next_extruder]
M620.1 E F[new_filament_e_feedrate] T{nozzle_temperature_range_high[next_extruder]}
M620.10 A1 F[new_filament_e_feedrate] L[flush_length] H[nozzle_diameter] T[nozzle_temperature_range_high]

;G1 Y90 F9000 ; REMOVED from original GCODE
; -- BEGIN ADDED LINES --
G1 X0 Y90 F18000
G1 X-13.5 F9000
G1 E-13.5 F900

; pause for user to load and press resume
M400 U1
; -- END ADDED LINES --

{if next_extruder < 255}
M400

G92 E0
;M628 S0 ; REMOVED: causes printer to crash without AMS

{if flush_length_1 > 1}
; FLUSH_START
; always use highest temperature to flush
M400
M1002 set_filament_type:UNKNOWN
M109 S[nozzle_temperature_range_high]
M106 P1 S60
{if flush_length_1 > 23.7}
G1 E23.7 F{old_filament_e_feedrate} ; do not need pulsatile flushing for start part
G1 E{(flush_length_1 - 23.7) * 0.02} F50
G1 E{(flush_length_1 - 23.7) * 0.23} F{old_filament_e_feedrate}
G1 E{(flush_length_1 - 23.7) * 0.02} F50
G1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}
G1 E{(flush_length_1 - 23.7) * 0.02} F50
G1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}
G1 E{(flush_length_1 - 23.7) * 0.02} F50
G1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}
{else}
G1 E{flush_length_1} F{old_filament_e_feedrate}
{endif}
; FLUSH_END
G1 E-[old_retract_length_toolchange] F1800
G1 E[old_retract_length_toolchange] F300
M400
M1002 set_filament_type:{filament_type[next_extruder]}
{endif}

{if flush_length_1 > 45 && flush_length_2 > 1}
; WIPE
M400
M106 P1 S178
M400 S3
G1 X-3.5 F18000
G1 X-13.5 F3000
G1 X-3.5 F18000
G1 X-13.5 F3000
G1 X-3.5 F18000
G1 X-13.5 F3000
M400
M106 P1 S0
{endif}

{if flush_length_2 > 1}
M106 P1 S60
; FLUSH_START
G1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}
G1 E{flush_length_2 * 0.02} F50
G1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}
G1 E{flush_length_2 * 0.02} F50
G1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}
G1 E{flush_length_2 * 0.02} F50
G1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}
G1 E{flush_length_2 * 0.02} F50
G1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}
G1 E{flush_length_2 * 0.02} F50
; FLUSH_END
G1 E-[new_retract_length_toolchange] F1800
G1 E[new_retract_length_toolchange] F300
{endif}

{if flush_length_2 > 45 && flush_length_3 > 1}
; WIPE
M400
M106 P1 S178
M400 S3
G1 X-3.5 F18000
G1 X-13.5 F3000
G1 X-3.5 F18000
G1 X-13.5 F3000
G1 X-3.5 F18000
G1 X-13.5 F3000
M400
M106 P1 S0
{endif}

{if flush_length_3 > 1}
M106 P1 S60
; FLUSH_START
G1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}
G1 E{flush_length_3 * 0.02} F50
G1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}
G1 E{flush_length_3 * 0.02} F50
G1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}
G1 E{flush_length_3 * 0.02} F50
G1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}
G1 E{flush_length_3 * 0.02} F50
G1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}
G1 E{flush_length_3 * 0.02} F50
; FLUSH_END
G1 E-[new_retract_length_toolchange] F1800
G1 E[new_retract_length_toolchange] F300
{endif}

{if flush_length_3 > 45 && flush_length_4 > 1}
; WIPE
M400
M106 P1 S178
M400 S3
G1 X-3.5 F18000
G1 X-13.5 F3000
G1 X-3.5 F18000
G1 X-13.5 F3000
G1 X-3.5 F18000
G1 X-13.5 F3000
M400
M106 P1 S0
{endif}

{if flush_length_4 > 1}
M106 P1 S60
; FLUSH_START
G1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}
G1 E{flush_length_4 * 0.02} F50
G1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}
G1 E{flush_length_4 * 0.02} F50
G1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}
G1 E{flush_length_4 * 0.02} F50
G1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}
G1 E{flush_length_4 * 0.02} F50
G1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}
G1 E{flush_length_4 * 0.02} F50
; FLUSH_END
{endif}

M629

M400
M106 P1 S60
M109 S[new_filament_temp]
G1 E5 F{new_filament_e_feedrate} ;Compensate for filament spillage during waiting temperature
M400
G92 E0
G1 E-[new_retract_length_toolchange] F1800
M400
M106 P1 S178
M400 S3
G1 X-3.5 F18000
G1 X-13.5 F3000
G1 X-3.5 F18000
G1 X-13.5 F3000
G1 X-3.5 F18000
G1 X-13.5 F3000
G1 X-3.5 F18000
G1 X-13.5 F3000
M400
G1 Z{max_layer_z + 3.0} F3000
M106 P1 S0
{if layer_z <= (initial_layer_print_height + 0.001)}
M204 S[initial_layer_acceleration]
{else}
M204 S[default_acceleration]
{endif}
{else}
G1 X[x_after_toolchange] Y[y_after_toolchange] Z[z_after_toolchange] F12000
{endif}

; -- BEGIN ADDED LINES --
M620 S[next_extruder]A
T[next_extruder]
; -- END ADDED LINES --
M621 S[next_extruder]A


M622.1 S0

M9833 F{outer_wall_volumetric_speed/2.4} A0.3 ; cali dynamic extrusion compensation
M1002 judge_flag filament_need_cali_flag
M622 J1
  G92 E0
  G1 E-[new_retract_length_toolchange] F1800
  M400
  
  M106 P1 S178
  M400 S7
  G1 X0 F18000
  G1 X-13.5 F3000
  G1 X0 F18000 ;wipe and shake
  G1 X-13.5 F3000
  G1 X0 F12000 ;wipe and shake
  G1 X-13.5 F3000
  G1 X0 F12000 ;wipe and shake
  M400
  M106 P1 S0 
M623

G392 S0
M1007 S1

Glydric avatar Jul 03 '25 20:07 Glydric

I tried with Studio 2.2.1.60 and it does not work

Prints the 1st colour > prints the 2nd without pause > pause for filament change. Like it is running the code after the change is required.

Seems to skip everything

From: M204 S9000

Until:

G1 X[x_after_toolchange] Y[y_after_toolchange] Z[z_after_toolchange] F12000
{endif}

Object Gcode looks like this:

G392 S0
M1007 S0
;M620 S1A ; REMOVED: skips all next code if no AMS is available
M204 S9000

M620 S1A
T1
M73 E3
; -- END ADDED LINES --
M621 S1A


M622.1 S0

Do I need to enable AMS? somewhere to make this code work even though I don't have one?

TeeZA42 avatar Sep 09 '25 14:09 TeeZA42

Same for me, I just tried the following and it works even within the same layer.

Ok this worked for me, a little too much poop on the flow calibration but I printed 2 colours...

TeeZA42 avatar Sep 10 '25 08:09 TeeZA42

I just wanted to confirm that the code pasted in Glydric's comment still works as of v. 2.5.0.66.

Thanks!

77xak avatar Feb 04 '26 04:02 77xak

Hi, new in ghithub and in 3d printing. The code works very well. After filament change non bubble. It also works well with A1, changing the coordinates in the right places. There's only one shift I couldn't manage. After the pause, when printing restarts, the first purge is performed correctly in the cleaning zone. Once the first purge is complete, the printhead moves to the right a few centimeters and starts purging again halfway between the plate and the purge zone. Then it returns to the correct position and completes the last two purges. I've checked and rechecked (but I'm a newbie) and I don't understand what's different about the other purges. Can I post the code modified here or is it out of context? EDIT: I solved the problem that was related to some coordinates on my A1. It works perfectly.

stegirelli-lab avatar Feb 12 '26 16:02 stegirelli-lab

I just wanted to confirm that the code pasted in Glydric's comment still works as of v. 2.5.0.66.

April 7th 2026 - Can confirm this code paste works.

Many thanks

Bytor3D avatar Apr 07 '26 14:04 Bytor3D