Tools and debugging
Beyond viewing and analyzing, the Custom G-code Editor provides tools for modifying G-code precisely, reordering sections safely, and debugging execution step by step.
Precision editing tools
Select any range of lines (in the editor or via the Outline Panel) and apply targeted modifications. Every operation shows you exactly what will change before you confirm.
Selection operations
| Tool | What it does | Example |
|---|---|---|
| Change speed | Multiply or set feedrate for all moves in the selection | Multiply all F values by 0.8 to slow a section by 20% |
| Change flow | Scale E values by a multiplier | Multiply all E values by 1.1 for 10% more extrusion |
| Insert temperature | Add a temperature command at the start of the selection | Insert M104 S210 before a specific layer |
| Insert fan | Add a fan speed command at the start of the selection | Insert M106 S200 to increase cooling |
| Insert pause | Insert a firmware-aware pause (Marlin M0, Prusa M601, Klipper PAUSE, Bambu M400 U1 — never M600 on Bambu) | Insert a pause at the current line |
| Insert custom G-code | Insert any G-code snippet at the cursor | Add a custom priming sequence or retraction routine |
Each tool has an input field for the value and an Apply button. Confirm opens a Monaco diff of current vs proposed text. After Apply you can undo typing with Ctrl+Z in the editor, or restore a snapshot.
Batch operations
These apply to the entire file with one click:
| Operation | What it does |
|---|---|
| Normalize feedrate | Ensures every G1 move has an explicit F parameter (inherits from the last set feedrate) |
| Merge redundant temps | Removes consecutive M104 commands with the same target temperature |
| Remove no-ops | Removes G1 commands that don't change any coordinates |
| Toggle extrusion mode | Switches between M82 (absolute) and M83 (relative) extrusion |
Spatial operations
These are geometry-aware operations that modify the toolpath structure:
| Operation | What it does |
|---|---|
| Linearize Arcs | Converts G2/G3 arc commands into G1 linear segments at a configurable chord length (0.1–2.0mm). Makes arcs editable as individual points. E values are distributed evenly across generated segments. |
| Fit arcs | Inverse of linearize: weld stable G1 runs into G2/G3 within a tolerance (default 0.05 mm). Refused when the printer profile has arcSupport off. |
| Redistribute | Re-spaces points evenly along their paths at a target spacing while preserving corners sharper than the threshold angle. Total extrusion per path segment is conserved. |
Both operations can target the current selection or the entire file.
Safe reordering
The reorder engine lets you rearrange sections of G-code (layers, regions within layers) while checking for dependency breaks — problems that would occur if the machine state isn't correct at section boundaries.
How it works
- Initiate — drag sections in the Outline Panel or select a reorder from the context menu
- Analyze — the system simulates machine state at every boundary and checks for breaks
- Preview — a dialog shows:
- Approve — toggle which transitions to include, then confirm or cancel
- Apply — the source is updated with sections in the new order and approved transitions inserted
Dependency break types
| Break type | What's wrong | Auto-fixable? |
|---|---|---|
| Temperature | Nozzle not at expected temperature | Yes (inserts M109) |
| Homing | Motion before G28 in new order | Yes (inserts G28, requires approval) |
| Extrusion mode | M82/M83 mismatch at boundary | Yes (inserts mode switch) |
| Motion mode | G90/G91 mismatch at boundary | Yes (inserts mode switch) |
| Retraction | Retracted/unretracted state mismatch | Yes (inserts G10/G11) |
| Fan | Fan speed differs at boundary | Yes (inserts M106/M107) |
| Position | Large XY jump without travel | Yes (inserts G0 travel) |
| Z collision | Z decreases after reorder | No (requires manual decision) |
Use cases
- Print infill before perimeters for strength optimization
- Reorder islands to reduce travel distance
- Group similar features for thermal consistency
- Move support sections for better surface quality
Bed array
The Array card in the Custom G-code dock copies the motion body across the bed (grid or polar). Startup and shutdown stay once. Optional snippet between copies (for example M0 ; pause). A bed-fit warning appears if copies leave the machine volume. This is a tool, not a separate app: use </> from a vase module, then array.
Snapshots
Snapshots let you save named versions of your G-code as you work. Think of them as manual save points.
Creating a snapshot
- Open the Snapshots tab in the dock
- Type a name (e.g. "Before speed change" or "Original import")
- Click Save
The snapshot stores the full G-code source text with a timestamp and line count.
Managing snapshots
- Restore — click to replace the current source with the snapshot's content
- Delete — remove a snapshot you no longer need
- Compare — opens a Monaco diff of the snapshot versus the current source
Debugger
The G-code debugger lets you step through commands one at a time and inspect the complete machine state at every line — like a debugger for code, but for printer instructions.
Machine state inspector
At the current debug line, you can see every tracked value:
| Field | Description |
|---|---|
| X, Y, Z | Current nozzle position (mm) |
| E | Current E position (mm) |
| F | Current feedrate (mm/min) |
| Total extruded | Cumulative filament used (mm) |
| Nozzle target | Target nozzle temperature (°C) |
| Bed target | Target bed temperature (°C) |
| Fan speed | Fan PWM value (0-255) |
| Flow | Volumetric flow rate (mm3/s) |
| Move distance | Distance of current move (mm) |
| Elapsed time | Estimated time from start (s) |
| Extrusion mode | Absolute or relative |
| Motion mode | Absolute or relative |
| Retracted | Yes or No |
| Acceleration | Current acceleration (mm/s2) |
Step controls
| Control | Action |
|---|---|
| Step Forward | Advance one line |
| Step Backward | Go back one line |
| Next Command | Skip blank lines and comments |
| To Breakpoint | Run until the next breakpoint |
| Layer | Jump to next layer change |
| Retract | Jump to next retraction |
| Temp | Jump to next temperature change |
Breakpoints
Click Add BP to set a breakpoint at the current line. Breakpoints show as red badges in the sidebar. During playback, execution pauses automatically when a breakpoint is reached.
- Set breakpoints on any line
- Clear individual breakpoints or all at once
- Click a breakpoint badge to jump to that line
Watch expressions
Select which machine state fields to monitor in the Watch panel. Watched values update in real time as you step through commands. This is useful for tracking how a specific value (like temperature or flow) changes over the course of the file.
Viewport actions
Click a toolpath in the 3D view to select a line, then use the action HUD:
- Pause — firmware-aware (
M0/M601/PAUSE/ BambuM400 U1) - Filament change — dialect snippet (never
M600on Bambu) - Slow 50% — insert a feedrate override at the selection
- Fan — insert
M106/ dialect equivalent - Skip layer — jump the remaining body of the current layer
- Copy line — copy the raw command
The Outline panel context menu offers the same pause / filament / slow / fan actions.
Resume from Z
If a print failed part-way, Resume from Z keeps the startup sequence, drops motion below the chosen Z, then splices a firmware-aware recover block (G90, M82, G92 E0). It does not emit G28 Z. Klipper uses SET_KINEMATIC_POSITION; Marlin homes X/Y only.