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 in the Mission branch of the Execution page's Control Tree, below the move / duplicate / delete control bar. This command has no title of its own, so the row and tree label read 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, added to the list this command sits in and moved into place directly after it, in pick order — the same list, so a command inside a nested list fans out inside that nested list. The panel then reports a structure change, which rebuilds the owning list's branch around the new rows and leaves the selection on this command.

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/api/mission.tsloadNcFile, setNcFilePath, setNcFileNcKind, getNcFileInfo and previewNcFile, plus the kind union and the file-info shape.
  • 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 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.csRunNcFile passes the stored path together with the project's base directory to the local project service.

See Also