Table of Contents

NC Optimization Option Panel (NC Optimization Config)

The key model is NcOptOptionCommand; the options it carries are a NcOptOption.

The command exists so the optimizer's settings are a step in the mission rather than a global preference. Run assigns the command's option object onto the session shell — the whole body is sessionShell.NcOptOption = NcOptOption — so the settings take effect at the point the entry sits in the list. Everything played below it optimizes under them, and a second NC Optimization Config further down the list re-points them mid-mission.

The command carries no title. Its row and its tree label always read NC Optimization Config: GetCommandTitle returns that fixed name and takes nothing from the user.

Where It Renders

The web client has one editor component for this command and mounts it once per tree node, each mount scoped to one group of options:

  • The NC Optimization Config node itself carries the four enable checkboxes, below the move / duplicate / delete control bar every command node shows.
  • The node grows five section children — Distances, Feedrate, Motion Dynamics, Force & Safety, Compensation — and each mounts the same component scoped to its own section.

Unlike the General Config and Post-Execution sections, none of these five section nodes carries an enable checkbox: this kind declares no section enable flags, so the tree hides the tick on them. The command node's own checkbox is the only switch, and it only decides whether the mission runs the command — a disabled command is skipped during play and stays fully editable.

Layout

The three compensation switches are bit accessors over the model's compensation mask — forward is bit 0, side bit 1, depth bit 2 — so all three travel as one integer in the project file.

Saving

Every edit writes at once. There is no Save button and no dirty state: a checkbox saves on click, a numeric field saves when it loses focus or on Enter, and each write is one PUT for that one property. The value is applied locally first; if the request fails, the panel re-reads the whole command and raises a toast, so the field snaps back to what the server holds.

The read side is a single command snapshot rather than one GET per property: the panel loads the command and takes its ncOptOption object. Two keys in that object drop the engine's Max prefix — the spindle torque and spindle power safety factors travel as spindleTorqueSafetyFactor and spindlePowerSafetyFactor.

Infinity and Bounds

Infinity is a legal value for Preferred Force and Max Feed Per Tooth, and those two are exactly the properties whose endpoints take a string body: the client sends the literal Infinity (or -Infinity), and the reader parses the same spelling back. Every other property's endpoint takes a typed bool or double.

Every numeric field except Preferred Force is bounded at 0 — a smaller number is refused in the field with “Must be ≥ 0” and never reaches the server.

Tip

The engine's XML form parses these values through XmlConvert.ToDouble, which is why an infinite feed per tooth or preferred force survives a project save and reload.

Defaults

A freshly added command carries the option model's own initial values, so the panel opens on them:

Option Default
The four enable switches all on
Extended Pre / Post Distance 2 mm
Min / Max Feedrate 1 / 20000 mm/min
Rapid Feed 20000 mm/min
Min / Max Feed Per Tooth 0 mm / Infinity
Feedrate Assignment Ratio 0.01
Max Acceleration / Max Jerk 10 mm/s² / 100 mm/s³
Preferred Force Infinity
Yielding / Thermal Yield Safety Factor 0
Spindle Torque / Power Safety Factor 1.5
The three compensation switches all off

The web client edits five more, and that is the whole difference between the two editors: Min Feed Per Tooth, Max Feed Per Tooth and Feedrate Assignment Ratio in the Feedrate section, and Yielding Safety Factor and Thermal Yield Safety Factor in Force & Safety.

Source Code Path

See HiNC App Anatomy for git repository links.

Web Application

HiNC-2025-webservice (Quasar CLI SPA):

  • wwwroot-src/src/components/mission/NcOptOptionCommandPanel.vue — this panel. A section prop picks the one group it renders, a setter map routes each field to its API call, and a failed write re-reads the command and notifies.
  • wwwroot-src/src/components/controlTree/missionItemTypes.ts — registers the ncoptoption kind's bespoke editor, declares its five section children, gives it the tune icon and the NC Optimization Config display name, and leaves it out of the section-enable readers and writers so its section nodes carry no checkbox.
  • wwwroot-src/src/components/controlTree/MissionCommandSlavePanel.vue — the control bar above the command node's checkboxes.
  • wwwroot-src/src/components/controlTree/MissionSectionPanel.vue — mounts this panel once per section node, scoped to that node's section.
  • wwwroot-src/src/api/mission.ts — the option shape the panel edits, the reader that takes the ncOptOption snapshot and parses Infinity, and one setter per property over commands/{path}/ncoptoption/{endpoint}.
  • wwwroot-src/src/components/widgets/NumericInput.vue — the field every non-boolean option uses: it commits on blur or Enter, spells infinity as Infinity, and enforces the minimum the panel passes.
  • wwwroot-src/src/i18n/en/mission.ts — the option labels and the “Accepts Infinity.” hint.
  • wwwroot-src/src/i18n/en/tree.ts — the kind name and the five section names the tree shows.
  • Missions/NcOptOptionEndpoints.cs — a partial of the same MissionController: one PUT per editable property, two of them string-bodied so Infinity round-trips. Each creates the option object when the command has none, and answers a command-type mismatch when the path holds another kind.
  • Missions/MissionController.cs — builds the command snapshot the panel reads, re-keying the two spindle safety factors onto their wire names, and owns the entry lifecycle — add, delete, move, duplicate, reparent — that puts this command in the list.

HiAPI Engine

  • HiNc/SessionCommands/NcOptOptionCommand.cs — the mission entry: the NC Optimization Config display name, its Optimization catalog registration, the single option property, the fixed command title, the XML round-trip that nests the options in the project file, and the Run that assigns them onto the session shell.
  • HiMech/NcOpt/NcOptOption.cs — the option model: the engine-side names MaxSpindleTorqueSafetyFactor and MaxSpindlePowerSafetyFactor, the compensation booleans as bit accessors over one mask, and the mm/min feedrates as conversions over mm/s storage.

See Also