Blockwise NC
Edit, check and time NC (G-code) programs in VS Code. Blockwise NC colours programs by what the machine does, runs the usual NC functions on them, draws a 3D backplot beside the editor, estimates the cycle time on your machine and compares two programs the way a programmer reads them.
It runs in desktop VS Code (1.101 or later) and in VS Code for the web.
What it does
Editing
- NC file types. One
G-code language with a file type per program: ISO, Fanuc, Haas, Mazak, Okuma, Siemens and Heidenhain, with turning variants. The type is detected from the program's name and text and shown in the status bar, where you can change it.
- Colouring by motion. Rapid moves, feed moves, tool changes and comments each have their own colour, following the modal state of the program.
- Navigation. Go to a line or a block number, jump to the previous or next tool change, set bookmarks, and mark a range of lines to delete, comment out or block skip.
- Typing aids. Optional uppercase and automatic spaces between NC words as you type.
- Multi Channel. Programs side by side, scrolled together.
NC functions
Renumber blocks (simple and advanced), remove block numbers, insert or remove block skips and spaces, remove trailing spaces and blank lines, insert or remove a string at the start or end of lines, change case, adjust feedrates and spindle speeds, simple math, address adjustments, rotate, mirror and translate, insert, remove or swap tool compensation (G40 / G41 / G42), convert Heidenhain to ISO and back, and Convert NC Code.
Each one works on the whole program or on the lines you select, and is a single undo step.
Backplot
A 3D view of the toolpath beside the editor:
- the tool, the axes, the bounding box and a marker at each tool change;
- playback by program time, with the playhead following the editor's cursor;
- click a move to jump to its line;
- standard views, a view from the tool, measuring between points, and saving the picture as an image;
- the machine with its kinematics, and a jog panel to move its axes.
Cycle time
An estimate of the program's cycle time on its machine, in the status bar. Line Times shows the time at the end of each line, Toolpath Statistics breaks the time down into cutting, rapid and tool changes with distances, ranges and feeds, and Tool List lists every tool with its type, sizes and offsets. Anything the simulator is unsure of appears in the Problems panel.
Machines
The estimate and the backplot use a machine profile: axis limits, rapid rates, acceleration, tool-change time and kinematics. Blockwise NC ships a generic machine, and you can add your own profiles and choose one per program. A value your profile leaves out is taken from the generic machine and marked as assumed, so you can see what an estimate rests on.
Macro library
Calls to programs outside the open file (M98 P…, G65 P…), such as probing and other control macros, are followed into a library of stored macros: the machine's own first, then the global ones. Their moves and time count on the line that calls them, and a call to a program found nowhere is listed in the Problems panel, with a quick fix (the light bulb) that adds the missing macro from a file, for the program's machine or for every machine. You add, replace and remove a machine's macros on the Macros page of Machine Settings, and the global ones in Global Macros (a button in the Machines dialog, or the "Global Macros…" command); each table shows which macros a machine's own ones override, and how much of the library is used, and Open (or a double-click on a row) shows a macro read-only beside the program. "Add Program to Macro Library…" stores the open program, for its machine or for every machine. Hovering a call shows where it goes: a line of the file, the machine's macros or the global ones, or nowhere. Ctrl+click (or F12) on it opens the macro read-only at its line, and Go Back returns to the call. Calls inside an opened macro work the same way, through the library. "Open Macro…" finds a stored macro by its number or name and opens it. A warning raised inside a macro links in the Problems panel to the macro line it comes from. An AI assistant can also manage the macros and list a program's calls.
A G65 call gives the macro its own local variables #1 to #33: the arguments it passes, every other one vacant, and the caller's own back when the macro returns. A variable that was never set reads as vacant, so a macro can test which arguments it was given.
File compare
Compare two programs in VS Code's diff editor, optionally ignoring block numbers, whitespace, case, comments and blank lines.
AI assistants
In desktop VS Code, Blockwise NC serves its functions to AI assistants through a local Model Context Protocol server. An assistant can read and change the programs open in your window, run the NC functions, read the cycle time, statistics and tool list, set up machines and their macros, and look at the backplot.
- GitHub Copilot: choose Agent mode in the Chat view; Blockwise NC's tools are in its tools list.
- Claude Code, Cursor and others: run Blockwise NC: Connect an AI Assistant and pick your assistant.
The server listens on your computer only and answers only requests that carry its access token.
Getting started
- Open an NC program. Files ending in
.nc, .ncf, .cnc, .tap, .eia, .gcode, .ngc, .iso, .ptp, .mpf, .spf or .min open as G-code; for any other file, choose G-code as its language.
- Check the file type and the machine in the status bar. Click either one to change it.
- Press
Ctrl+Alt+B, or use the button at the top of the editor, to open the backplot.
- Find the NC functions in the editor's context menu, in the Command Palette under Blockwise NC, or in the Blockwise NC view in the Activity Bar.
Keyboard shortcuts
These apply while an NC program has the focus.
| Shortcut |
Command |
Ctrl+G |
Go to Line / Block Number… |
Ctrl+Alt+Up / Down |
Previous / Next Tool Change |
Ctrl+Alt+K |
Toggle Bookmark |
Ctrl+Alt+[ / Ctrl+Alt+] |
Previous / Next Bookmark |
Ctrl+Alt+L |
List Bookmarks… |
Ctrl+Alt+B |
Toggle Backplot |
Ctrl+Alt+I |
Toolpath Statistics |
Ctrl+Alt+N |
Renumber Blocks |
Ctrl+Alt+D |
Compare With Open File… |
Settings
| Setting |
Default |
What it does |
blockwise.defaultFileType |
iso-milling |
The NC file type for programs whose type cannot be detected. |
blockwise.editor.uppercaseOnType |
false |
Uppercases letters as you type, outside comments. |
blockwise.editor.autoInsertSpaces |
false |
Inserts a space between NC words as you type, outside comments. |
blockwise.backplot.highlightLine |
true |
Highlights and scrolls to the line the backplot is at while it plays. |
blockwise.backplot.rapidRate |
400 |
The rapid rate, in inches per minute, for the plain estimate shown beside the machine's. |
blockwise.cycleTime.autoEstimateUpToLines |
150000 |
Longer programs are timed when you ask, so typing stays fast. |
blockwise.highlight.fullDocumentUpToLines |
200000 |
Longer programs are coloured where they are shown. |
blockwise.compare.ignoreBlockNumbers and four others |
false |
What File Compare ignores: block numbers, whitespace, case, comments, blank lines. |
blockwise.mcp.enabled |
true |
Runs the server for AI assistants in desktop VS Code. |
blockwise.mcp.port |
47821 |
The port that server listens on, on this computer. |
Feedback
Bug reports and feature requests are welcome in the Blockwise NC issues repository:
You can also run Help: Report Issue… from the Command Palette and choose Blockwise NC; it fills in your VS Code, OS and extension versions.
A report is most useful with the extension version, the NC file type and machine shown in the status bar, and the shortest program that shows the problem. The issues repository is public, so share only programs and drawings you are free to share.