Table of Contents

Class McAbcCyclicPathSyntax

Namespace
Hi.NcParsers.LogicSyntaxs
Assembly
HiMech.dll

Resolve modular rotary axes to the shortest cyclic path relative to the previous node. Uses IsModularRotary(string) to determine which axes within MachineCoordinateState need cyclic resolution. Falls back to hardcoded A/B/C if no IMachineAxisConfig is available. Must be placed after ProgramXyzSyntax in NcSyntaxList.

Two stages, mirroring McXyzSyntax:

  1. Root MachineCoordinateState — anchored at the previous block's modal rotary state.
  2. CompoundMotion.ItemsKey[*] — sequential walk through items, anchoring item 0 at the previous block's modal state and item i > 0 at item i-1's post-cycle value (per-axis chain). Items without a rotary MachineCoordinateState are skipped.
The items pass enables rotary motion (e.g. G28 ABC intermediate / home stages) to surface as motion IAct segments rather than a single root-MC stamp.
public class McAbcCyclicPathSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
Inheritance
McAbcCyclicPathSyntax
Implements
Inherited Members
Extension Methods

Examples

Cases below run with no IMachineAxisConfig on the dep list, so the syntax uses the A/B/C fallback (a configuration warning is emitted but does not affect the JSON). The syntax is the tail-pass rotary-wrap centraliser — upstream rotary writers (McAbcSyntax, G28, G53.1, ...) store raw degrees and let this pass resolve to the shortest cyclic path.

Current B is within ±180° of the previous B — no wrap needed; the value is rewritten in place but equals the input:

#Previous:
{ "MachineCoordinateState": { "B": 0 } }
#BeforeBuild:
{ "MachineCoordinateState": { "B": 10 } }
#AfterBuild:
{ "MachineCoordinateState": { "B": 10 } }
Current B is 270° but previous B is 0° — the shortest path is the other way around, so the value is rewritten as -90° (mathematically equivalent, geometrically the same orientation, but signalling the shorter rotation to a downstream motion consumer). 270/0 round-trips through ToRadCycleToDeg with no rounding noise (1.5π → -0.5π → -90 exactly); other angle pairs (e.g. 350° → -10°) emit a trailing ULP-scale drift instead: #Previous:
{ "MachineCoordinateState": { "B": 0 } }
#BeforeBuild:
{ "MachineCoordinateState": { "B": 270 } }
#AfterBuild:
{ "MachineCoordinateState": { "B": -90 } }
First block of the stream (no #Previous:) — no anchor to resolve against, so the syntax early-returns and the raw value is preserved verbatim: #BeforeBuild:
{ "MachineCoordinateState": { "B": 350 } }
#AfterBuild:
{ "MachineCoordinateState": { "B": 350 } }

CompoundMotion.Items walk — two items chain: item 0 cycles against the previous block's modal B = 0° (270° → -90°), and item 1 cycles against item 0's post-cycle -90° (170° → -190°, since the shorter path from -90° to 170° wraps backward through -180°). If item 1 had used the previous-block anchor instead of the chained anchor, 170° would have stayed at 170° (already in the ±180° window around 0°), so the test discriminates between chain and no-chain:

#Previous:
{ "MachineCoordinateState": { "B": 0 } }
#BeforeBuild:
{
  "CompoundMotion": {
    "Items": [
      { "MachineCoordinateState": { "B": 270 } },
      { "MachineCoordinateState": { "B": 170 } }
    ]
  }
}
#AfterBuild:
{
  "CompoundMotion": {
    "Items": [
      { "MachineCoordinateState": { "B": -90 } },
      { "MachineCoordinateState": { "B": -190 } }
    ]
  }
}

Constructors

McAbcCyclicPathSyntax()

Initializes a new instance with default settings.

public McAbcCyclicPathSyntax()

McAbcCyclicPathSyntax(XElement)

Initializes a new instance by deserializing from the given XML element.

public McAbcCyclicPathSyntax(XElement src)

Parameters

src XElement

Source XML element.

Properties

Name

Syntax kind name (typically the concrete type name).

public string Name { get; }

Property Value

string

XName

XML element name used to register this syntax with XFactory.

public static string XName { get; }

Property Value

string

Methods

Build(LazyLinkedListNode<SyntaxPiece>, List<INcDependency>, NcDiagnosticProgress)

Build syntax arrangement into the syntaxPieceNode in-place.

public void Build(LazyLinkedListNode<SyntaxPiece> syntaxPieceNode, List<INcDependency> ncDependencyList, NcDiagnosticProgress ncDiagnosticProgress)

Parameters

syntaxPieceNode LazyLinkedListNode<SyntaxPiece>
ncDependencyList List<INcDependency>
ncDiagnosticProgress NcDiagnosticProgress

MakeXmlSource(string, string, bool)

Creates an XML representation of the object. This method may also generate additional resources such as related files.

public XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)

Parameters

baseDirectory string

The base directory for resolving relative paths

relFile string

The relative file path for the XML source

exhibitionOnly bool

if true, the extended file creation is suppressed.

Returns

XElement

An XML element representing the object's state

Remarks

For the demand of easy moving source folder (especially project folder) without configuration file path corruption, the relative file path is applied. The baseDirectory is typically the folder at the nearest configuration file folder. Since the folder can be moving with the configuration file.

Reg(XFactory)

Registers this type's deserializer with the given XFactory (or Default when factory is null). Idempotent.

public static void Reg(XFactory factory = null)

Parameters

factory XFactory