3dSynth

Docs / Custom G-code

Open in the interactive docs reader

Editor features

The Custom G-code Editor uses Monaco (the same engine behind VS Code) with a purpose-built G-code language definition. Every feature is tuned for working with printer instructions — not generic code.

Syntax highlighting

G-code commands are colored by function so you can scan a file at a glance. Each token type maps to a dedicated color that follows your app theme:

TokenExamplesPurpose
MotionG0, G1, G2, G3Movement commands (blue)
PositionX100.5, Y50.2, Z0.3Coordinate parameters (teal)
ExtrusionE1.234Filament extrusion (green)
FeedrateF1200Speed parameter (orange)
TemperatureM104, M109, M140, M190Thermal commands (red)
Fan/coolingM106, M107Cooling commands (light blue)
Control flowM0, M1, M600Pauses and filament changes (yellow)
HomingG28, G29, G80Homing and leveling (purple)
RetractionG10, G11Firmware retraction (salmon)
Comments; this is a commentInline comments (dim green)
UnknownUnrecognized commandsUnderlined (amber)
Values10.5, -3.2, 255Numeric literals (light green)
Line numbersN100N-prefix line numbering (gray)

A typical highlighted line looks like this:

G1 X120.500 Y80.200 Z0.300 E1.5432 F1200 ; perimeter move

Where G1 is blue, X120.500 Y80.200 Z0.300 is teal, E1.5432 is green, F1200 is orange, and ; perimeter move is dim green.

Autocomplete

Type a G or M to see suggestions for 30+ recognized commands. Each suggestion includes:

G  -->  G0   Rapid Move         X Y Z F
        G1   Linear Move        X Y Z E F
        G28  Home               X Y Z
        G29  Bed Leveling
        M104 Set Hotend Temp    S
        M109 Wait Hotend Temp   S R
        ...

Hover documentation

Hover over any recognized command to see a tooltip with:

For example, hovering over M109 shows:

M109 — Wait Hotend Temp Set nozzle temperature and wait until reached. Parameters: S(temp) R(temp)

Find and replace

The editor includes Monaco's full find-and-replace panel:

This is useful for tasks like finding all M104 temperature commands or replacing a feedrate across the file.

Section-colored minimap

The minimap on the right edge of the editor displays colored bands that correspond to structural section types. Each section type gets a distinct translucent color overlay:

This gives you a birds-eye view of file structure without scrolling. The overview ruler (the thin bar to the right of the scrollbar) uses the same colors, so you can jump to a specific section type at a glance.

The colors automatically match the Line Type color mode in the 3D viewer and the dots in the Outline Panel.

Inline diagnostics

The editor shows squiggly underlines for potential G-code issues detected by the analysis engine. Warnings appear in real-time as you edit:

SeverityAppearanceExamples
ErrorRed underlineMotion before homing, Z collision risk
WarningYellow underlineCold extrusion, flow limit exceeded, feedrate zero
InfoBlue underlineFan enabled before 2nd layer

Hover over a warning to see the full message and a suggested fix. The toolbar shows a badge with the total warning count.

Diagnostics include: missing homing (G28), cold extrusion, volumetric flow exceeding printer limits, Z collision risk, ineffective retractions, temperature not reached, extrusion mode mismatch, feedrate at zero, out-of-bounds moves, and early fan activation.

Structural folding

The editor automatically creates foldable regions based on the structural analysis:

Click the fold arrows in the gutter to collapse or expand sections. This makes navigating large files (100k+ lines) fast.

Bidirectional selection

The editor and 3D viewer stay in sync:

Editor to 3D: Select one or more lines in the editor. The corresponding toolpath segments light up in the 3D viewer, and the metrics panel shows stats for just the selection.

3D to editor: Click a toolpath segment in the viewer. The editor scrolls to the corresponding G-code line and highlights it.

This two-way link uses the same selectedGcodeLines pattern as the G-code Inspector panel, so it works consistently across the app.

Read-only mode

Toggle read-only mode from the toolbar to prevent accidental edits. When read-only is active:

This is useful when reviewing slicer output or analyzing a file you don't want to modify.

Keyboard shortcuts

ShortcutAction
Ctrl+FFind
Ctrl+HFind and replace
Ctrl+GGo to line
Ctrl+ZUndo
Ctrl+Shift+ZRedo
Ctrl+/Toggle comment
Ctrl+Shift+[Fold region
Ctrl+Shift+]Unfold region

All standard Monaco keyboard shortcuts are available.