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 hands the session shell a copy of the command's option (NcOptOption.Duplicate()), 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 scripts' Opt* setters and the NC-embedded scripts of the lines that follow edit the session's copy; the command — the one the project saves — keeps the authored values, and an edit of the command through the panel's endpoints is in effect from the command's next run.

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 nodes under the command follow the optimizer's own gating: a switch owns the settings that act only while it is on, so they sit beneath it.

  • The NC Optimization Config node itself carries only the output spelling, the Omit Leading Zero in Output checkbox.
  • Its one child, Enable Optimization, holds the extended distances, the rapid feed and the feedrate assignment ratio. They act with feedrate optimization off as well: a line with no cutting within the extended distances still goes to the rapid feed.
  • Under it, Enable Feedrate Optimization owns Feedrate, Floor at Source Feedrate, Motion Dynamics and Force & Safety; Enable Interpolation and Compensation sit beside it.

Four of these nodes are switches, and each switch is the node's own tree checkbox rather than a field on a panel: Enable Optimization, Enable Feedrate Optimization, Floor at Source Feedrate and Enable Interpolation. A switch that is off dims its node and every node nested under it, because those settings do nothing while it is off; the panels stay editable either way. The other section nodes carry no checkbox. The command node's own checkbox, like every command's, only decides whether the mission runs the command — a disabled command is skipped during play, dims its whole subtree and stays fully editable.

While the physics preference is off, the whole command is left out of the tree, sections included, and out of the Add Command dialog: the optimizer drives the feed from the simulated cutting force, so none of its settings produce a result without the physics pass. It stays an entry of its list all the same, still run where it sits, and the row operations around it count it (see Mission Root Panel).

Two options of the model have no field on purpose: EnableDepthSplition, because the engine does not apply the cutting depth it solves, and MaxJerk_mmds3, which the optimizer never reads. Each has an endpoint and a key in the command snapshot all the same.

Layout

  • NC Optimization Config Node

    • Omit Leading Zero in Output CheckBox
      • The model is OmitLeadingZero.
      • Its tooltip carries the example: 0.348 is written as .348.
  • Enable Optimization Node

  • Enable Feedrate Optimization Node (under Enable Optimization)

    • Tree CheckBox
    • The panel is a caption only; the values are on the four nodes below.
  • Feedrate Node (under Enable Feedrate Optimization)

  • Floor at Source Feedrate Node (under Enable Feedrate Optimization)

    • Tree CheckBox
    • Lower Limit, Share of Source Feedrate Numeric Field (%)
      • The model is SourceFeedrateFloorRatio, a ratio from 0 to 1 shown as a percentage and written back divided by 100.
      • The caption above it states the trade: below 100 % the force and safety targets can still slow a peak-load step down to the share, which spares the tool; at 100 % the optimizer only speeds steps up, so the run cannot take longer but no step is relieved.
  • Motion Dynamics Node (under Enable Feedrate Optimization)

  • Force & Safety Node (under Enable Feedrate Optimization)

  • Enable Interpolation Node (under Enable Optimization)

  • Compensation Node (under Enable Optimization)

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 four switch ticks save through the tree instead of the panel. A tick is one PUT for its flag, and the mission holds its busy gate while that request is in flight, so a row operation cannot land first and move another command onto the ticked path; a tick made while a row operation is running is ignored and snaps back. A failed tick raises a toast and snaps back, without re-reading the command.

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. The source-feedrate share travels as the engine's ratio, 0 to 1, not as the percentage the field shows. The tree reads the same snapshot when it is built, to set the four switch ticks.

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. The source-feedrate share is also bounded at 100 %. The bounds live in the field only: the endpoint takes any number, and the engine applies the ratio as given — a ratio above 1 floors above the source feed, and one that does not give a positive, finite floor sets none.

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
Enable Optimization, Enable Feedrate Optimization, Enable Interpolation all on
Omit Leading Zero in Output off
Floor at Source Feedrate / its share off / 80 %
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 10 mm/s²
Preferred Force Infinity
Yielding / Thermal Yield Safety Factor 0
Spindle Torque / Power Safety Factor 1.5
The three compensation switches all off

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, and none renders the command node's output spelling; a setter map routes each field to its API call, the share field converts between the engine's ratio and a percentage, and a failed write re-reads the command and notifies.
  • wwwroot-src/src/components/controlTree/missionItemTypes.ts — registers the ncoptoption kind's bespoke editor and its NC Optimization Config display name, declares the nested section tree, lists the four switches in the section-enable reader and writer so their nodes carry a checkbox, and leaves the whole command out of the tree while the physics preference is off.
  • wwwroot-src/src/components/controlTree/MissionCommandSlavePanel.vue — the command node's panel: the disabled-command hint above this kind's editor.
  • wwwroot-src/src/components/controlTree/useControlTreeHost.ts — saves the command and section ticks under the mission busy gate, and dims every node under a switch or a command that is off.
  • 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, the captions under the four switches, the Omit Leading Zero tooltip and the “Accepts Infinity.” hint.
  • wwwroot-src/src/i18n/en/tree.ts — the kind name and the section names the tree shows.
  • Missions/NcOptOptionEndpoints.cs — a partial of the same MissionController: one PUT per option property, the two the panel does not show included, 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 hands a copy of them to 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.
  • HiMech/NcOpt/StepFeedSolver.cs — where the source-feedrate floor enters each step's feed boundaries, and where the NcOpt-Feed--SourceFloorOverTarget warning is raised.

See Also