Class PolarInterpolationSyntax
- Namespace
- Hi.NcParsers.LogicSyntaxs
- Assembly
- HiMech.dll
Maintains the modal Polar Coordinate Interpolation valve section (PolarInterpolationState) for Fanuc G12.1/G13.1.
On a G12.1 block: consumes the flag, reads the block's own X/C words as
the anchor (InitRxcz; the X word is a
diameter and is halved), converts the previous program position
(program X/Z + machine C angle) onto the polar hypothetical plane via
GetProgramPolarRxczByOrdinaryProgramXcz(Vec3d), and
writes both the state section and the entry
ProgramPolarRxcz position.
Mirrors HardNc HardNcLine case 12_100.
On a G13.1 block: consumes the flag and stops carrying the state — the
block itself is already Cartesian, matching HardNc case 13_100.
On other blocks: re-materializes the previous block's state section
(single-step lookback carry, the PositioningSyntax pattern),
and warns FanucPolar--IncompatibleGCode for G-codes outside the
Fanuc polar-mode whitelist (mirrors HardNc
IsGCodePolarModeCompatible).
public class PolarInterpolationSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
- Inheritance
-
PolarInterpolationSyntax
- Implements
- Inherited Members
- Extension Methods
Examples
Bare G12.1 entry — anchor words absent so
InitRxcz is zero; the entry position is the previous stored
program position (program X/Z with the previous machine C angle) mapped
onto the hypothetical plane:
#Previous:
{ "ProgramXyz": { "X": 58, "Y": 0, "Z": 25 }, "MachineCoordinateState": { "X": 58, "Y": 0, "Z": 25, "C": 0 } }
#BeforeBuild:
{ "Parsing": { "Flags": ["G12.1"] } }
#AfterBuild:
{
"PolarInterpolationState": { "Dir": "XC", "InitRxcz": { "X": 0, "Y": 0, "Z": 0 } },
"ProgramPolarRxcz": { "X": 58, "Y": 0, "Z": 25 }
}
G12.1 X10 C0 — the block's own words anchor InitRxcz
(X diameter 10 → radius 5) and the entry position is stored relative to
that anchor:
#Previous:
{ "ProgramXyz": { "X": 58, "Y": 0, "Z": 25 }, "MachineCoordinateState": { "X": 58, "Y": 0, "Z": 25, "C": 0 } }
#BeforeBuild:
{ "Parsing": { "X": 10, "C": 0, "Flags": ["G12.1"] } }
#AfterBuild:
{
"PolarInterpolationState": { "Dir": "XC", "InitRxcz": { "X": 5, "Y": 0, "Z": 0 } },
"ProgramPolarRxcz": { "X": 53, "Y": 0, "Z": 25 }
}
Carry — no G12.1/G13.1 edge on the block, previous block is in polar mode, so the state section is re-materialized; other parsing content is untouched (G01 is polar-compatible, no diagnostic): #Previous:
{ "PolarInterpolationState": { "Dir": "XC", "InitRxcz": { "X": 0, "Y": 0, "Z": 0 } } }
#BeforeBuild:
{ "Parsing": { "Flags": ["G01"] } }
#AfterBuild:
{
"Parsing": { "Flags": ["G01"] },
"PolarInterpolationState": { "Dir": "XC", "InitRxcz": { "X": 0, "Y": 0, "Z": 0 } }
}
G13.1 — the flag is consumed and the state is not carried; the
block is already Cartesian:
#Previous:
{ "PolarInterpolationState": { "Dir": "XC", "InitRxcz": { "X": 0, "Y": 0, "Z": 0 } } }
#BeforeBuild:
{ "Parsing": { "Flags": ["G13.1"] } }
#AfterBuild:
{}
G12.1 repeated while polar mode is already active — HardNc keeps
the old anchor (the modal flag does not change), so the state is
carried unchanged and the block's axis words are left for
ProgramRxczSyntax to treat as plain polar motion:
#Previous:
{ "PolarInterpolationState": { "Dir": "XC", "InitRxcz": { "X": 0, "Y": 0, "Z": 0 } } }
#BeforeBuild:
{ "Parsing": { "X": 20, "Flags": ["G12.1"] } }
#AfterBuild:
{
"Parsing": { "X": 20 },
"PolarInterpolationState": { "Dir": "XC", "InitRxcz": { "X": 0, "Y": 0, "Z": 0 } }
}
Constructors
PolarInterpolationSyntax()
Initializes a new instance with default settings.
public PolarInterpolationSyntax()
PolarInterpolationSyntax(XElement)
Initializes a new instance by deserializing from the given XML element.
public PolarInterpolationSyntax(XElement src)
Parameters
srcXElementSource XML element.
Fields
IncompatibleDiagId
Diagnostic id for G-codes that Fanuc disallows during polar
coordinate interpolation (per the Fanuc manual whitelist). Emitted by
PolarGCodeCheckSyntax, which runs at the FRONT of the
Logic bundle so mode/plane/offset codes (G17-G19, G20/G21, G49, ...)
are still visible in Parsing.Flags when the scan runs; see its
doc for the residual parameterized-code blind spot.
public const string IncompatibleDiagId = "FanucPolar--IncompatibleGCode"
Field Value
Properties
Name
Syntax kind name (typically the concrete type name).
public string Name { get; }
Property Value
Pair
The polar axis pair this machine runs G12.1 with — DirXC (default), DirYA or DirZB. Machine configuration (Fanuc selects the pair by parameters, not by NC words), carried per project through this syntax's XML. Written into the state section's Dir for every downstream reader.
public string Pair { get; set; }
Property Value
XName
XML element name used to register this syntax with XFactory.
public static string XName { get; }
Property Value
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
syntaxPieceNodeLazyLinkedListNode<SyntaxPiece>ncDependencyListList<INcDependency>ncDiagnosticProgressNcDiagnosticProgress
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
baseDirectorystringThe base directory for resolving relative paths
relFilestringThe relative file path for the XML source
exhibitionOnlyboolif 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
factoryXFactory