Table of Contents

NcFileCommand Panel (Program File)

The key model is NcFileCommand.

The command carries exactly two values: NcFile, the path of the program to play, and NcKind, the runner that plays it. The program text stays a file on disk — the project stores the path and nothing else, which is what separates this command from NC Code, whose text is serialized into the project itself.

NcFile is normally a path relative to the project folder — that is what the browse dialog yields — and an absolute path on the server is accepted just as well. No base directory is stored with the command: at play time RunNcFile hands the stored path together with the project's own base directory to the local project service, and that is where a relative path acquires its root; the convention behind it is the Load Pattern.

The panel renders on the command's own node under the Mission root of the Execution page's Control Tree. The editor pane holds the editor and, while the command's tree checkbox is off, a one-line disabled hint above it — nothing structural: the command's move up / move down / duplicate / delete buttons and its drag handle sit on its tree row, and the Add Command + sits on the row of the list that holds it. This command has no editable Title field — unlike NC Code, Script and List — so its tree row label is composed from the path alone: Program File [path], the path being the detail the label brackets.

Note

The GUI labels this command “Program File”: it plays NC, CL (CLSF) and CSV files — the runner is picked by NcKind, and Auto reads it off the extension (DetectByPath: .cl, .cls and .clsf play as CL, .csv as CSV, and every other extension as brand NC).

Layout

  • NcFileCommand Panel
    • Head Line
      • Program File Path Field
        • The model is NcFile.
        • Its hint names both accepted forms: an absolute path on the server, or a path relative to the project folder.
        • Every keystroke saves the path. Leaving the field or pressing Enter additionally refreshes the file-info banner.
        • The field flexes to fill the row beside the Browse button at any panel width.
      • Browse Button
    • Play As Select
      • The model is NcKind.
      • Four choices: Auto (by extension), Brand NC, CL (CLSF) and CSV. The hint restates what Auto detects, so the runner can be pinned when the extension would route the file elsewhere.
    • File Info Banner
      • Appears once the path field is non-empty. Every fact in it is read on the server.
      • Found: a green banner stating the file size, its modified stamp and its line count, with a Preview button in the banner's action slot.
      • Missing: an orange banner saying the file is not found on the server, and no Preview button.
    • Preview Dialog
      • Read-only. The server returns the file's first 100 lines and the dialog shows them in a monospace block that scrolls within 60% of the viewport height, inside a card capped at 80%. An empty file previews as "(empty)".

Browsing for a Program

Browse opens the shared server-side file explorer dialog. File reads happen on the server; the browser never uploads file bytes.

The Load Pattern's general web convention offers the Admin, Project and Resource roots. This picker narrows to one: it opens on the project directory and allows no other root, so a pick always yields a project-relative path. A file outside the project is reached by typing its absolute path into the path field, which the server accepts.

The dialog carries four filter groups rather than one catch-all:

  • NC Files — .nc, .anc, .tap, .eia, .mpf, .spf, .cnc, .ptp, .h. The open set: brand controller extensions, of which these are the common ones rather than all of them.
  • CL Files — .cl, .cls, .clsf.
  • CSV Files — .csv.
  • All Files — an empty extension list, which is the empty filter the Load Pattern asks every browser to preserve. It is the backstop for a brand extension the NC group does not name.

CL and CSV are split out because they are closed extension sets: those are exactly the extensions Auto routes to the CL and CSV runners, and everything else falls through to brand NC.

Multi-Pick Fan-Out

The dialog is multi-select, and this is the one command editor that grows the mission. The first picked file lands on this command. Each further pick becomes a new Program File command, inserted into the list this command sits in at the index directly after it, in pick order — one insert per pick, each at the next index, and the same list, so a command inside a nested list fans out inside that nested list. The panel then reports the insert range — the first new index and the count — and the command's slave panel scopes it to the owning list and names this command as the selection. The Control Tree host takes that insert on its structure-changed path, which shares two things with its own row ops — it holds the busy gate for the rebuild (a change arriving while another op is in flight is not rebuilt) and carries the index-based ids (the expansion set and the Add focus) over the new siblings — and not the third: the open panel's dirty gate, which every row op runs first, is not part of this path. It then rebuilds the owning list's branch around the new rows and leaves the selection on this command, whose own index is unchanged.

Where the Program Text Is Edited

The command stores a path, and the panel does not edit the file. It assigns the path, picks the runner, reports what the server knows about the file, and previews its first 100 lines read-only. Nothing in the browser writes NC bytes back; the two file endpoints this panel calls are both reads.

Source Code Path

See HiNC App Anatomy for git repository links.

Web Application

HiNC-2025-webservice (Quasar CLI SPA):

  • wwwroot-src/src/components/mission/NcFileCommandPanel.vue — this panel: the path field and Browse, the “Play As” kind select, the file-info banner and its Preview button, the read-only preview dialog, the four filter groups, and the multi-pick fan-out.
  • wwwroot-src/src/components/widgets/FileExplorerDialog.vue — the shared server-side browser Browse opens: the pickable / multi / filters / initial-root / allowed-roots props, and the pick event whose emitted strings pair a root name with a relative path — that relative half is what the command stores.
  • wwwroot-src/src/components/widgets/fileFilter.ts — the filter shape the four groups are built from; an empty extension list means all files.
  • wwwroot-src/src/components/controlTree/missionItemTypes.ts — maps the ncfile kind to this panel. A kind absent from that map is served by the generic field editor instead.
  • wwwroot-src/src/components/controlTree/MissionCommandSlavePanel.vue — the command node's slave panel: mounts this editor on the entry path, and re-scopes the fan-out's structure change to the owning list, with the insert range and this command as the selection.
  • wwwroot-src/src/components/controlTree/ControlTreePanel.vue — the tree rows: the drag handle and the move / duplicate / delete buttons on the command's row, and the Add Command + on the row of its list.
  • wwwroot-src/src/components/controlTree/useControlTreeHost.ts — takes the fan-out's insert on its structure-changed path: the busy gate held for the rebuild, the index-based ids carried over the new siblings (the two guarantees shared with the row ops; the dirty gate is not one of them), the rebuild scoped to the owning list, and the selection the payload names.
  • wwwroot-src/src/api/mission.ts — loadNcFile, setNcFilePath, setNcFileNcKind, getNcFileInfo and previewNcFile, plus the kind union and the file-info shape; addEntry, which the fan-out calls with the insert index and which answers the new entry's path.
  • wwwroot-src/src/i18n/en/mission.ts — the panel's wording: the path hint, the Play As hint, the four filter labels, the banner's found and not-found lines, and the preview titles.
  • Missions/MissionController.cs — four endpoints serve this command: a PUT for the path, a PUT for the NC kind, and the two server-side reads behind the banner and the preview (both POSTs, both resolving a relative path against the project folder). The fan-out's extra picks go through the list-entry POST, which lands the new entry at the requested insert index — clamped to the list, the tail when none is given — and answers its index and dotted path. The command-snapshot builder emits the file path and the NC kind for this kind of command.

HiAPI Engine

  • HiNc/SessionCommands/NcFileCommand.cs — the model: NcFile, NcKind defaulting to Auto, the “Program File” display name and its Program-category catalog registration, the XML round-trip that writes the path verbatim, the Program File [path] row label, and Run handing path and kind to the session shell.
  • HiMech/MachiningProcs/NcKind.cs — the kind enum (Auto / BrandNc / Cl / Csv) and the detect-by-path helper, the authority for what Auto does.
  • HiNc/MachiningProcs/SessionShell.cs — RunNcFile passes the stored path together with the project's base directory to the local project service.

See Also