Programming

Write G-code with the controller watching.

Studio's program editor is wired to the twin. Every line gets the time it took, every mistake gets a rule and a line number, and every change can run to the end before it reaches metal.

In Studio 0.2.0 · Ctrl+E opens the editor

The editor stopped at a breakpoint on line 17: seconds per line in the margin, a static-rule hint under line 16, the machine state at the cursor in the status bar.
The editor stopped at a breakpoint on line 17: seconds per line in the margin, a static-rule hint under line 16, the machine state at the cursor in the status bar.
The editor

Everything the controller knows, next to the line.

Built on Scintilla, the editing component of Notepad++ and SciTE, with G-code colouring and a margin that the twin fills in.

Times in the margin

After a run every line shows the seconds it took. The lines add up to the run time exactly, and the removed volume to the total.

Checked as you type

0.4 s after you stop typing, grblHAL's check mode and twelve static rules go through the program. Findings sit in the margin; Ctrl+. applies a suggested fix.

The state at the cursor

The status bar shows what the controller's modal state will be after the line under the cursor: units, plane, distance mode, work offset, feed, spindle, coolant, tool.

Breakpoints and conditional pauses

Stop at a line, or when force, spindle load, following error or chatter margin crosses a limit, at the first cut, a near miss, a rapid into material, a collision or an alarm. Virtual time freezes; the motion is not changed.

Restart from a line

Studio writes the start block for any line: tool, offsets, spindle, coolant and a safe approach. Example 02 restarted at line 460 leaves the same workpiece as an uninterrupted run.

Versions and compare

Every program you load or change is kept as a version with who and why; your own files are never overwritten. Ctrl+D compares two side by side, with their run times.

Static rules

Twelve rules for what the controller accepts but should not.

Check mode finds what grblHAL refuses. These rules find what it runs anyway — and what this build does not support at all.

S01WarningNo safe start block before the first move (units, distance mode, plane, work offset): the program relies on the controller's state.
S02WarningNo M2/M30 at the end: the controller keeps its modes, the spindle and the coolant.
S03InfoA tool change (M6) with the tool below Z0: retract first.
S04ErrorA cutting move before any F: grblHAL refuses it (error:22) or uses the feed left from before.
S05WarningThe spindle started without S, or S outside the spindle's range.
S06InfoF above the axes' top speed in the move's direction: the planner caps it.
S07ErrorA code this grblHAL build does not take: expressions, O-word flow control, subprograms, cutter compensation G41/G42, rotation G68.
S08InfoDense short lines: the planner's queue holds too little path to brake from F, so the feed stays lower.
S09InfoA deep straight plunge: consider a ramp or a helix and a centre-cutting tool.
S10WarningA rapid below Z0, deeper than the program has cut so far: a rapid into material breaks tools.
S11ErrorAn arc the controller refuses (error:33): radius and end point do not agree.
S12WarningThe water-cooled spindle turns during feed moves without its coolant (M8).
Per-line profile

Why is it slower than the program says?

For every line Studio records whether the programmed feed was reached, and if not, what held it back — from grblHAL's own junction and braking arithmetic, not from a guess.

Axis
the feed is above an axis' top speed in that direction
Corner
the junction speed at a corner between two moves
Arc
the centripetal limit on a small radius
Look-ahead
too little planned path to brake from the feed in time
Starved
the sender could not keep the planner's queue full
Parser
the controller was still parsing the next lines
Override
a feed override below 100 %
Hold
a feed hold or a programmed stop
The twelve slowest lines of a pocket program, coloured by what limited them — a picture the twin draws, here for an AI client.
The twelve slowest lines of a pocket program, coloured by what limited them — a picture the twin draws, here for an AI client.
Optimizer

Faster, without asking more of any tool.

The optimizer changes numbers, not the path. Every candidate runs to the end on a fresh twin and is only accepted if nothing got worse.

What it changes

  • Lighter cuts get feeds up to the heaviest cut the same tool already makes
  • Moves in the air go at the axes' top speed; finishing passes and plunges keep theirs
  • A chattering section gets the stability lobes' spindle speed, with the feed per tooth kept
  • Collinear short lines are merged; arcs are fitted only where the sender could not keep up
  • Rapid retracts come down to 1 mm above the highest thing below them

When a result is accepted

  • It runs to the end with no new event: no rapid into material, no cut with the spindle stopped, no collision or near miss
  • Force, chip thickness and spindle load stay within 105 % of the original's heaviest cut
  • The chatter margin does not rise above the original's (or 1)
  • The part is no worse, and the run is shorter
Ctrl+Shift+O: the optimized program arrives as an undoable edit next to the version before it, with both run times.
Ctrl+Shift+O: the optimized program arrives as an undoable edit next to the version before it, with both run times.

On the fifteen example parts

ExampleBeforeAfterChange
ISO test piece18:3717:38-5.3 %
Pocket with islands10:209:33-7.7 %
3D relief17:4316:47-5.2 %
Involute spur gear in brass21:0619:46-6.3 %
Holes and thread milling15:4215:22-2.2 %
Engraving and chamfer in POM2:282:28-0.2 %
Microfluidic mould in brass5:115:02-3.0 %
Trochoidal vs conventional slot5:585:45-3.5 %
T-slot and dovetail5:515:42-2.4 %
Heat sink with thin fins17:2217:11-1.1 %
Geneva drive13:5413:11-5.2 %
Mould cavity with draft12:5811:55-8.1 %
Watch wheel, module 0.320:2819:19-5.6 %
Honeycomb lightening plate18:0917:57-1.1 %
Centrifugal impeller20:4020:27-1.1 %
All fifteen3:26:263:18:02-4.1 %

Machine time in the twin (Linux build, 2026-09-29). Every result was accepted; the peak cutting force rose only on example 05 (7.0 → 7.1 N), the chatter margin moved by at most 0.009, and all 14 parts with a design part still pass 100 %. The model's parameters are nominal until the machine is calibrated, so these are simulated savings.

Generator

Simple features without CAM.

Describe features instead of lines: the generator writes the program for the blank on the table, runs it on a background twin and, where the tool would chatter, writes it again at a stable spindle speed or with a shallower pass.

  • Face, pocket (rectangle with corner radius, or circle), slot, contour inside or outside
  • Drill (G81, G83 peck drilling when deeper than 3 × D), helical bore, single-line text
  • Speeds and feeds from the material (15 materials) and the tool; 3° ramps, climb milling, walls finished to size
A pocket written by the generator: its cutting data in the comments, ready for Ctrl+K (load and check).
A pocket written by the generator: its cutting data in the comments, ready for Ctrl+K (load and check).

Keyboard

The editor is driven from the keyboard; F1–F12 always act on the machine.

Ctrl+Eopen or leave the editor
Ctrl+Kload into the machine and check
Ctrl+Ssave a version
Ctrl+Dcompare with the previous version (again: an older one)
Ctrl+Bbreakpoint on the line; Ctrl+Shift+B: a conditional pause
Ctrl+.apply the suggested fix
Alt+↓ / Alt+↑next / previous finding or difference
Ctrl+Shift+Ooptimize (again: stop)
Ctrl+Shift+Ggenerate a program from features
F5cycle start, or continue after a pause

FAQ

Does the optimizer change my file?

No. The result arrives in the editor as an undoable edit, next to the version before it; both are kept as versions. Your own files are never overwritten.

Can I use the editor with my CAM's output?

Yes. Open any G-code file; the check and the rules tell you which lines this controller would refuse or run differently than intended.

Is the generator a CAM system?

No. It covers the simple features a manual machinist programs by hand. Free-form surfaces and multi-feature parts come from CAM.

Are the time savings real?

They are what the twin computes with nominal machine and cutting parameters. They become measured numbers when the MC-1 prototypes are calibrated against the twin.

Write your next program in the twin.

Load an example, change a line and watch the margin, the rules and the run time answer.