Bambu Studio Layer G-code#
What Was Established#
Methods for applying custom G-code to specific layers in Bambu Studio, including Height Range Modifiers and the Layer Range G-code interface. Specific commands for Bambu Lab printers to control infill angles, wall order, and layer pauses.
Key Decisions#
- Layer Range G-code Interface: Preferred for direct layer-specific application without Height Range Modifiers.
- Layer Numbering: The Layer Range G-code UI uses 1-indexed layer numbers. Conditional logic (
{if layer_num == X}) uses 0-indexed numbers. - Bambu Proprietary G-code: Commands like
M9000(infill angle) andM9001(wall order) are specific to Bambu Lab firmware.
Current Configuration#
Layer Range G-code Setup#
- Slice the model.
- Navigate to the G-code tab.
- Scroll to Layer Range G-code in the left panel.
- Click + Add.
- Enter From and To layer numbers.
- Enter G-code in the field.
Examples#
-
Layer 27 Direction Change:
- From:
27, To:27 - G-code:
M9000 I90 ; 90-degree infill M9001 P2 ; Outer walls first M118 P0 S"Layer 27: Modified" - Restore Defaults:
- From:
31, To:[last_layer] - G-code:
M9000 I45 ; Default 45-degree infill M9001 P0 ; Normal wall order
- From:
- From:
-
Layer 2 Pause & Speed Change:
- From:
2, To:2 - G-code:
M400 ; Wait for moves M600 ; Pause (filament change) G4 P5000 ; Wait 5 seconds G1 F1200 ; Set speed to 20mm/s - Restore Speed:
- From:
3, To:[last_layer] - G-code:
G1 F6000 ; Restore 100mm/s
- From:
- From:
Alternative: Visual Speed Controls#
Bambu Studio also supports a GUI-based approach for layer-specific speed changes:
- Switch to Strength view (bottom-left view selector)
- Click the Speed tab
- Use the layer slider to select the target layer
- Click Add Speed Change
- Set speed to desired value (e.g., 20 mm/s)
Speed unit conversion: 20 mm/s = 1200 mm/min (G-code F values use mm/min).
Alternative: M220 S20 sets speed percentage to 20% of normal speed on Bambu Lab printers.
Historical Notes#
- Conversation dates: 2026-01-26 (layer direction), 2026-01-26 (print speed).
- Bambu Studio version not specified; commands assume standard Bambu Lab firmware support.
M9000andM9001are proprietary extensions; verify compatibility with printer firmware.
Open Questions#
- Does
M9001work on all Bambu Lab printer models? - How to handle layer numbering discrepancies between slicer view and G-code output?
Related Pages#
- None yet.
Sources#
ingested/chats/162-Adjust Layer Print Direction in Bambu Studio.mdingested/chats/161-Set Print Speed to 20mm-s in Bambu Studio.md- DeepSeek conversation: “Adjust Layer Print Direction in Bambu Studio” (chat 162)
- DeepSeek conversation: “Set Print Speed to 20mm-s in Bambu Studio” (chat 161)