//nbkelley /homelab

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) and M9001 (wall order) are specific to Bambu Lab firmware.

Current Configuration#

Layer Range G-code Setup#

  1. Slice the model.
  2. Navigate to the G-code tab.
  3. Scroll to Layer Range G-code in the left panel.
  4. Click + Add.
  5. Enter From and To layer numbers.
  6. 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
  • 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

Alternative: Visual Speed Controls#

Bambu Studio also supports a GUI-based approach for layer-specific speed changes:

  1. Switch to Strength view (bottom-left view selector)
  2. Click the Speed tab
  3. Use the layer slider to select the target layer
  4. Click Add Speed Change
  5. 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.
  • M9000 and M9001 are proprietary extensions; verify compatibility with printer firmware.

Open Questions#

  • Does M9001 work on all Bambu Lab printer models?
  • How to handle layer numbering discrepancies between slicer view and G-code output?
  • None yet.

Sources#

  • ingested/chats/162-Adjust Layer Print Direction in Bambu Studio.md
  • ingested/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)