Namespace Hi.NcParsers.Keywords
Classes
- BlockSkip
Optional block skip marker extracted from the head of an NC block. ISO 6983 / Fanuc calls this feature Block Delete (BDT switch); Siemens / Syntec / Mazak use the same
/prefix with matching behaviour.The section is only present on blocks that carry a
/prefix. Whether the block's NC commands are actually skipped at runtime depends on IBlockSkipConfig:- Config absent or the Layer bit OFF → the
/prefix is consumed, Body is left null, and the rest of the line parses as a regular NC block (comments still take effect). - Config present and the Layer bit ON → the rest
of the line is moved into Body and cleared from
UnparsedText, so downstream parsing syntaxes see nothing and no NC action is emitted. Comment syntaxes run before this one so comments (and any embedded CsScript) still take effect.
- Config absent or the Layer bit OFF → the
- CannedCycle
Section key holder + concrete implementation for ICannedCycleDef.
- Comment
Comment extracted from an NC block. Symbol identifies the comment style; Text holds the content without the symbol. Downstream syntaxes (e.g., CsScript) may further trim Text after extracting embedded markers.
- CompoundMotion
Section key holder + concrete implementation for ICompoundMotionDef.
- Coolant
Section key holder + concrete implementation for ICoolantDef.
- CoordinateOffset
Work coordinate offset state written by IsoCoordinateOffsetSyntax. Property names are used as JSON keys via
nameof.Managed commands (ISO): G54, G55, G56, G57, G58, G59, G59.1–G59.9. Siemens: G54–G57 + G505–G599 (extended), G500 to cancel. Heidenhain: CYCL DEF 247 (Datum Preset) / CYCL DEF 7 (Datum Shift).
- CsScript
Section-key holder for inline C# scripts attached to an NC block. Carries BeginScript (run before the block's acts) and EndScript (run after). Resolved by CsScriptBeginSemantic and CsScriptEndSemantic.
- FanucPathSmoothing
Section data holder for IFanucPathSmoothingDef.
- Feedrate
Section key holder + concrete implementation for IFeedrateDef.
- IndexNote
JSON-section data shape pairing a single-character address symbol (e.g.
‘O’,‘N’) with its numeric index, used to annotate program/sequence numbers on an NC block.
- IsoLocalCoordinateOffset
ISO/Fanuc-family local coordinate offset state (G52) written by IsoLocalCoordinateOffsetSyntax. Property names are used as JSON keys via
nameof.G52 X Y Z installs a local coordinate-system shift that stacks on top of the active G54-G59 work offset. The cancel mechanism is to write
G52 X0 Y0 Z0(or hit M30 / reset) — there is no separate G code for "cancel". The offset vector is therefore always modal: zero is a valid modal value, not a "disabled" state, so the section is recorded on every block.Brand-specific kin: Siemens
TRANS/ATRANS(which can also carry rotation/scale/mirror) and HeidenhainTRANS DATUMare handled by their own syntaxes and write to their own sections — they do not share this key, because their data shapes are richer.
- MachineCoordinateState
Section key holder for IMachineCoordinateStateDef.
- MotionEvent
Section key holder + concrete implementation for IMotionEventDef.
- MotionState
Section key holder + concrete implementation for IMotionStateDef.
- PathSmoothing
Section key holder for IPathSmoothingDef.
- PlaneSelect
Section key holder for IPlaneSelectDef.
- Positioning
Section key holder + concrete implementation for IPositioningDef.
- ProgramBoundary
Program start/end delimiter line (e.g.,
%in Fanuc/Mazak/Syntec,%_N_xxx_MPFin Siemens). Not a comment — the controller uses it as a tape/file boundary marker.
- ProgramEnd
Section key holder for IProgramEndDef.
- ProgramStop
Section key holder + concrete implementation for IProgramStopDef.
- RadiusCompensation
Section key holder + concrete implementation for IRadiusCompensationDef.
- SpindleControl
Section key holder + concrete implementation for ISpindleControlDef.
- SpindleOrientation
Section key holder + concrete implementation for ISpindleOrientationDef.
- SpindleSpeed
Section key holder + concrete implementation for ISpindleSpeedDef.
- TiltTransform
Concrete class for ITiltTransformDef section serialization.
- ToolHeightCompensation
Section key holder for IToolHeightCompensationDef.
Interfaces
- IArcMotionDef
Arc motion data written by CircularMotionSyntax. Stored under the Hi.Motion JSON section alongside IMotionEventDef properties.
- ICannedCycleDef
Canned cycle modal state (Group 09). Captures which cycle is currently active, its return mode (G98/G99), and the resolved absolute parameter set used for modal lookback.
Written by CannedCycleResolveSyntax on every block that belongs to the canned-cycle group: cycle code present (G81/G82/G83/G73/G84/G74/G85/G86/G89/G76/G87), modal repeat (cycle still active, only coordinates given), or explicit cancel (G80).
Term =
"G80"is the explicit-cancel sentinel used by FindPreviousActiveCycle(LazyLinkedListNode<SyntaxPiece>, string[]) to terminate modal lookback without ambiguity; regular blocks (e.g.G00 X.. Y..) simply omit the section entirely.
- ICompoundMotionDef
Compound motion section definition for commands that produce multiple sub-operations (G28, G53.1, G81, G82, etc.). Contains a ItemsKey array resolved by Hi.NcParsers.Semantics.CompoundMotionSemanticUtil.
Item types (discriminated by key presence):
- Hi.Motion — rapid/feed linear motion (IMotionEventDef + IMachineCoordinateStateDef)
- Dwell — pause (Time in seconds)
- SpindleControl — spindle direction change (Direction)
- SpindleOrientation — oriented spindle stop (OSS) (Angle_deg)
- ICoolantDef
Coolant state (M07 mist / M08 flood / M09 off). Written by CoolantSyntax. Modal — persists until changed.
IsOn is the on/off convenience flag (true for M07 and M08, false for M09). Mode carries the abstract kind (Flood / Mist / Off) for consumers that need to distinguish flood vs mist.
- IDwellDef
Dwell/pause section definition for use inside Sequence items. Resolved by Hi.NcParsers.Semantics.CompoundMotionSemanticUtil into ActDelay.
- IFanucPathSmoothingDef
Fanuc-specific path smoothing state written by FanucPathSmoothingSyntax.
Extends IPathSmoothingDef with the Fanuc G05.1 R argument (precision / smoothness level number, R1..R10 mapping to controller-internal tuning macro variables). Q is binary in current Fanuc firmware (Q0 disable / Q1 enable), so IsEnabled covers it directly — no raw Q field is stored.
JSON section key remains
nameof(PathSmoothing)so generic readers (cache dumps, modal carry, UI) can cast to IPathSmoothingDef across all controller brands; brand-specific readers cast to IFanucPathSmoothingDef for the extra fields.
- IFeedrateDef
Feedrate state written by FeedrateSyntax. Property names are used as JSON keys via
nameof.ISO standard: F command + G94 (per minute) / G95 (per revolution). Supported by all major CNC brands.
- IFlagsDef
JSON section schema describing the modal/non-modal flags that take effect on an NC block. Each entry in Flags is a brand-specific keyword recognized by the soft-NC runtime.
- IMachineCoordinateStateDef
Modal machine-coordinate state — absolute six-axis machine position after the block has executed. Written on every block by motion-related LogicSyntaxs (McAbcSyntax, McAbcXyzFallbackSyntax, McXyzSyntax, MachineCoordSelectSyntax, G53p1RotaryPositionSyntax, ReferenceReturnSyntax); seeded on the init block by HomeMcInitializer; carried across non-motion blocks by ModalCarrySyntax.
Only configured axes appear as keys (X/Y/Z/A/B/C). Non-existent axes (e.g., A/B/C on a 3-axis machine) are omitted rather than written as NaN sentinels.
- IMotionEventDef
One-shot motion event — present only on blocks that actually issue a motion command. Used by motion semantics (McLinearMotionSemantic, McArcMotionSemantic, ClLinearMotionSemantic) as the trigger to emit motion IAct. NOT carried forward across blocks. Property names are used as JSON keys via
nameof.
- IMotionStateDef
Modal motion state — Group 01 G-code mode (G00 / G01 / G02 / G03 ...). Written on every block by LinearMotionSyntax / CircularMotionSyntax; carried across non-motion blocks by ModalCarrySyntax. Property names are used as JSON keys via
nameof.Unlike sibling modal sections (Unit, PlaneSelect, Positioning) which carry both a brand-specific
Termand a brand-neutral conventional field, MotionState intentionally keeps only Term: the brand-neutral semantic ("what kind of motion happened") lives on the sibling one-shot MotionEvent (Form = McLinear / McArc / ClLinear / ClArc). State here is purely the modal latch of the last Group-01 G-code so downstreamFindPrevious*can resume motion-mode bookkeeping.
- IParsingDef
JSON section schema carrying the raw, brand-specific parsing trace for an NC block. The Parsing node holds intermediate parser output used by downstream syntaxes and diagnostics.
- IPathSmoothingDef
Path smoothing state. The base interface is brand-agnostic; controller brands extend it with their own argument fields (e.g. IFanucPathSmoothingDef for Fanuc G05.1 R precision-level). Fanuc-flavour writes are produced by FanucPathSmoothingSyntax.
ISO/Fanuc G05.1 Q1 (enable) / G05.1 Q0 (disable): high-precision contour control / AICC / Nano Smoothing. Controller-internal interpolation black box — simulation records the state but does not alter the tool path.
- IPlaneSelectDef
Active plane selection state written by PlaneSelectSyntax. Property names are used as JSON keys via
nameof.ISO: G17/G18/G19. Heidenhain: implicit from L/CC syntax. Term carries the brand-specific G-code; Plane stores the conventional, brand-neutral axis-pair name (XY/ZX/YZ).
- IPositioningDef
Modal positioning state — ISO Group 03 (G90 absolute / G91 incremental). Written by PositioningSyntax, consumed by IncrementalResolveSyntax, canned cycle syntaxes, and MachineCoordSelectSyntax. Property names are used as JSON keys via
nameof.Term is the brand-specific G-code (Fanuc/ISO G90/G91); Mode is the conventional, brand-neutral name (Absolute / Incremental).
- IProgramEndDef
Program end marker (M02/M30). Written by ProgramEndSyntax. Other syntaxes (e.g. IsoLocalCoordinateOffsetSyntax) read this section to reset modal state instead of detecting M30 directly.
- IProgramStopDef
Program-stop marker (M00 unconditional / M01 optional). Written by ProgramStopSyntax on each block that carries an M00/M01 flag. Non-modal: the section appears only on the exact block where the stop code is present.
Distinct from IProgramEndDef (M02/M30, end of program).
M00 halts execution unconditionally; the operator must press Cycle Start to resume. M01 is an optional stop gated by the operator's "Optional Stop" panel switch — ignored when the switch is off. This parsing-layer section records the NC intent; runtime / semantic layers decide whether to actually pause.
- IProgramXyzDef
JSON section schema carrying the program-coordinate position commanded on the current block. Written by ProgramXyzSyntax before the ProgramToMcTransform chain composes it into machine coordinates.
- IRadiusCompensationDef
Radius compensation state written by RadiusCompensationSyntax. Property names are used as JSON keys via
nameof.Managed commands (ISO): G41 (left), G42 (right), G40 (cancel). Heidenhain Klartext maps RL → G41, RR → G42, R0 → G40. When active, the tool path is offset perpendicular to the programmed path by Radius_mm; Side determines left vs right. The root
ProgramXyzretains the user-programmed position;MachineCoordinateis overwritten to reflect the compensated path.
- ISpindleControlDef
Spindle control item for use inside ItemsKey arrays. Resolved by Hi.NcParsers.Semantics.CompoundMotionSemanticUtil into ActSpindleDirection.
- ISpindleOrientationDef
Oriented spindle stop item for use inside ItemsKey arrays. Commands the spindle to stop at a specific angular position (OSS). Resolved by Hi.NcParsers.Semantics.CompoundMotionSemanticUtil into ActSpindleOrientation.
- ISpindleSpeedDef
Spindle speed and direction state written by SpindleSpeedSyntax. Property names are used as JSON keys via
nameof.ISO: S command for speed, M03/M04/M05 for direction. Heidenhain: M3/M4/M5. Siemens: M3/M4/M5 or SPOS. Direction is stored as the conventional SpindleDirection enum name (CW/CCW/STOP), not as brand-specific M-codes.
- ITiltTransformDef
Tilt transform state written by tilt transform syntaxes. Property names are used as JSON keys via
nameof.Managed commands (ISO/Fanuc): G68 (2D rotation), G68.2 (tilted work plane), G69 (cancel). Siemens equivalent: CYCLE800, ROT/AROT (handled by separate syntax). Heidenhain equivalent: PLANE SPATIAL / PLANE RESET (handled by separate syntax).
- IToolHeightCompensationDef
Tool height compensation state written by ToolHeightOffsetSyntax. Property names are used as JSON keys via
nameof. The JSON section can be deserialized to an instance implementing this interface.Managed commands (ISO/Fanuc): G43, G44, G49. Fanuc extension: G43.4 (TCPM — parsed only in Fanuc syntax list). Siemens equivalent: TRAFOOF/TRAORI (handled by separate syntax). Heidenhain equivalent: TOOL CALL / M128/M129 (handled by separate syntax).
- ITransformationDef
Chain of named ProgramXyz → MachineCoordinate transformation entries. Stored as a JsonArray of entries, each with
“Source”,“Kind”, and“Mat4d”keys. Each contributing INcSyntax adds or replaces its own entry by source name. GetComposedTransform(JsonObject) composes entries in order:McXyz = ProgramXyz * T[0] * T[1] * ... * T[n].Kindcontour-validity classification. Each entry is either:"Static"— the Mat4d is valid for any point along the contour. Tilt, coord-offset, and the kinematic pivot in non-RTCP / rotary-stable blocks are all Static."Dynamic"— the Mat4d is a block-endpoint snapshot of a rotary-state-dependent transform (RTCP rotary-dynamic). Composition still yields a correct endpoint MC, but the matrix is not contour-valid: intermediate CL-point positions cannot be derived by applying it to an interpolated ProgramXyz. The semantic layer (ClLinearMotionSemantic) handles per-step IK separately.
- IUnitDef
Unit-system state (ISO Group 06: G20 inch / G21 metric). Written by UnitModeSyntax. Modal.
HiNC's NC pipeline works exclusively in millimetres. G21 is therefore a no-op confirmation of the default; G20 is reported as an Unsupported Error and callers are expected to pre-convert the NC program to metric before loading.
- IUnparsedTextDef
JSON section schema carrying the residual block text that was not consumed by any registered syntax. Used for diagnostics and round-trip preservation.