NcCodeCommand Panel
The key model is NcCodeCommand.
The command carries two values: NcText, the NC program itself, and Title, the name that program runs under. Both are written into the project file — the command emits a title element and an NC-text element, and the project nests the whole command list into its own XML — so the program travels with the project instead of existing as a file beside it. That is the whole difference from Program File, which stores a path and leaves the program on disk. A mission can therefore carry a short program without producing an artifact of its own.
Title is not decoration. Run passes it to RunNc as the
program name the run log shows, which is why the model defaults it to the command's own name,
NC Code, rather than to an empty string. It is also the detail the mission row brackets: the row
reads NC Code while the title is empty or still that default, and NC Code [title] once it says
something else.
The panel renders on the command's own node in the Mission branch of the Execution page's Control Tree, below the move / duplicate / delete control bar. A single-purpose kind like this one embeds its whole editor on that node rather than growing section child nodes.
Layout
- NcCodeCommand Panel
- Title Field
- The model is Title.
- Labelled "Title (optional)". A newly added command arrives with the model's default name,
NC Code, already in the field; renaming it renames the program in the run log and in the mission row.
- NC Code Editor Area
- The model is NcText.
- A plain monospace text area: an 18-row field with a 360 px floor.
- No line-number gutter and no syntax highlighting. The rich editor in this folder is the Script command's — that command ships CodeMirror with a C# grammar, this one ships a text area.
- Stats and Actions Row (web)
- Line count and character count, both recomputed as the text changes.
- Trim Blank Lines Button — trims every line and drops the ones left empty, then saves at once.
- Clear Button — confirms in a dialog before emptying the NC text.
- Both buttons stay disabled while the code is empty.
- Title Field
Saving
Typing in either field schedules one save 400 ms after the last keystroke, so a burst of typing costs one request instead of one per character. Trim Blank Lines and Clear save immediately rather than through that timer.
The write is a single patch endpoint carrying the NC text and the title. Each field is applied only when the body actually carries it, which is why the client sends the field it changed and a null for the one it did not.
NC text is not validated while it is edited: there is no parse at edit time and no error surface on the panel — the server stores whatever string arrives. Errors surface when the mission plays the text.
Source Code Path
See HiNC App Anatomy for git repository links.
Web Application
HiNC-2025-webservice (Quasar CLI SPA):
wwwroot-src/src/components/mission/NcCodeCommandPanel.vue— this panel: the Title input, the 18-row monospace text area, the 400 ms debounced saves, the live line and character stats, Trim Blank Lines, and Clear behind a confirm dialog.wwwroot-src/src/components/controlTree/missionItemTypes.ts— maps thenccodekind to this panel, and states the rule it belongs to: a single-purpose kind embeds its whole editor on the command node.wwwroot-src/src/api/mission.ts—loadNcCodeandsetNcCode, and the command shape the panel edits (NC code plus title).wwwroot-src/src/i18n/en/mission.ts— the panel's wording: the NC Code label, the character count, Trim Blank Lines, and the line count it shares with the other panels.wwwroot-src/src/i18n/en/dialog.ts— the Clear confirmation's title and message.Missions/MissionController.cs— the single patch PUT for this command, whose NC-code and title fields are each applied when the body carries them, and the command-snapshot arm that returns both back to the panel.
HiAPI Engine
HiNc/SessionCommands/NcCodeCommand.cs— the model:NcText,Titledefaulting to the command's own display name, the Program-category catalog registration, the XML round-trip that puts the NC text into the project file,Runhanding text and title to the session shell, and the row-label rule that shows the bare name while the title is unset or still the default.HiNc/MachiningProcs/SessionShell.cs—RunNctakes the NC text plus an alternative file name, and that name is the title this command supplies for the log.HiNc/MachiningProcs/MachiningProject.cs— nests the command list into the project XML, which is how this command's NC text persists with the project.
See Also
- NcFileCommand Panel — the other Program command: a path to a file instead of text stored in the project
- Script Command Panel — the rich editor this folder does have, and why this command ships a plain text area instead
- Playing a Program — the task these two commands serve
- Mission — the rest of the command panels