3dSynth

Docs / Custom G-code

Open in the interactive docs reader

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

ToolWhat it doesExample
Change speedMultiply or set feedrate for all moves in the selectionMultiply all F values by 0.8 to slow a section by 20%
Change flowScale E values by a multiplierMultiply all E values by 1.1 for 10% more extrusion
Insert temperatureAdd a temperature command at the start of the selectionInsert M104 S210 before a specific layer
Insert fanAdd a fan speed command at the start of the selectionInsert M106 S200 to increase cooling
Insert pauseInsert 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-codeInsert any G-code snippet at the cursorAdd 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:

OperationWhat it does
Normalize feedrateEnsures every G1 move has an explicit F parameter (inherits from the last set feedrate)
Merge redundant tempsRemoves consecutive M104 commands with the same target temperature
Remove no-opsRemoves G1 commands that don't change any coordinates
Toggle extrusion modeSwitches between M82 (absolute) and M83 (relative) extrusion

Spatial operations

These are geometry-aware operations that modify the toolpath structure:

OperationWhat it does
Linearize ArcsConverts 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 arcsInverse of linearize: weld stable G1 runs into G2/G3 within a tolerance (default 0.05 mm). Refused when the printer profile has arcSupport off.
RedistributeRe-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

  1. Initiate — drag sections in the Outline Panel or select a reorder from the context menu
  2. Analyze — the system simulates machine state at every boundary and checks for breaks
  3. Preview — a dialog shows:
  4. Approve — toggle which transitions to include, then confirm or cancel
  5. Apply — the source is updated with sections in the new order and approved transitions inserted

Dependency break types

Break typeWhat's wrongAuto-fixable?
TemperatureNozzle not at expected temperatureYes (inserts M109)
HomingMotion before G28 in new orderYes (inserts G28, requires approval)
Extrusion modeM82/M83 mismatch at boundaryYes (inserts mode switch)
Motion modeG90/G91 mismatch at boundaryYes (inserts mode switch)
RetractionRetracted/unretracted state mismatchYes (inserts G10/G11)
FanFan speed differs at boundaryYes (inserts M106/M107)
PositionLarge XY jump without travelYes (inserts G0 travel)
Z collisionZ decreases after reorderNo (requires manual decision)

Use cases

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

  1. Open the Snapshots tab in the dock
  2. Type a name (e.g. "Before speed change" or "Original import")
  3. Click Save

The snapshot stores the full G-code source text with a timestamp and line count.

Managing snapshots

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:

FieldDescription
X, Y, ZCurrent nozzle position (mm)
ECurrent E position (mm)
FCurrent feedrate (mm/min)
Total extrudedCumulative filament used (mm)
Nozzle targetTarget nozzle temperature (°C)
Bed targetTarget bed temperature (°C)
Fan speedFan PWM value (0-255)
FlowVolumetric flow rate (mm3/s)
Move distanceDistance of current move (mm)
Elapsed timeEstimated time from start (s)
Extrusion modeAbsolute or relative
Motion modeAbsolute or relative
RetractedYes or No
AccelerationCurrent acceleration (mm/s2)

Step controls

ControlAction
Step ForwardAdvance one line
Step BackwardGo back one line
Next CommandSkip blank lines and comments
To BreakpointRun until the next breakpoint
LayerJump to next layer change
RetractJump to next retraction
TempJump 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.

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:

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.