Table of Contents

Class IsoG68RotationSyntax

Namespace
Hi.NcParsers.LogicSyntaxs
Assembly
HiMech.dll

ISO/Fanuc: resolves G68 (2D coordinate rotation) and G69 (cancel). Computes a rotation Mat4d around the active plane normal and composes it into ProgramToMcTransform.

No IMachineKinematics dependency needed — G68 is pure geometric rotation.

Managed commands: G68, G69 (idempotent with IsoG68p2TiltSyntax).

public class IsoG68RotationSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
Inheritance
IsoG68RotationSyntax
Implements
Inherited Members
Extension Methods

Examples

All cases below avoid the cos/sin rotation math by using either G69 cancel (identity), the first-block default (no transform composed), or modal carry of an identity Mat4d. Mat4d arrays are 16 plain doubles in column-major order — see IsoCoordinateOffsetSyntax for the template. A future round can add a non-trivial G68 case by dumping the actual output and pasting the 16 doubles back into the marker.

First block of the stream (no #Previous:, no G68/G69 on the block) — CarryForwardFromPrevious stamps a default TiltTransform.Term = "G69" so downstream lookback always sees a concrete state; no transform chain entry is composed:

#BeforeBuild:
{ }
#AfterBuild:
{ "TiltTransform": { "Term": "G69" } }
G69 flag on the block — TryHandleG69 consumes it, writes the G69 section, and composes the identity Mat4d into the chain so any previously composed tilt rotation is overridden: #BeforeBuild:
{ "Parsing": { "Flags": ["G69"] } }
#AfterBuild:
{
  "TiltTransform": { "Term": "G69" },
  "ProgramToMcTransform": [
    {
      "Source": "TiltTransform",
      "Kind": "Static",
      "Mat4d": [1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1]
    }
  ]
}
Modal carry: no G68/G69 on the current block, but #Previous: carries an active G68 with identity tilt Mat4d in its chain. The current block inherits TiltTransform.Term = "G68" and re-composes the same Mat4d into its own chain; unrelated M03 flag survives because this syntax does not touch Parsing during the carry path: #Previous:
{
  "TiltTransform": { "Term": "G68" },
  "ProgramToMcTransform": [
    {
      "Source": "TiltTransform",
      "Kind": "Static",
      "Mat4d": [1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1]
    }
  ]
}
#BeforeBuild:
{ "Parsing": { "Flags": ["M03"] } }
#AfterBuild:
{
  "Parsing": { "Flags": ["M03"] },
  "TiltTransform": { "Term": "G68" },
  "ProgramToMcTransform": [
    {
      "Source": "TiltTransform",
      "Kind": "Static",
      "Mat4d": [1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1]
    }
  ]
}
Non-trivial G68 rotation: 90° around the Z axis (no I/J/K → plane normal of the default G17 plane) at the origin (no X/Y/Z → all 0). The Mat4d column-major layout is rotation 90° about Z (no translation since pivot is the origin); cos(π/2) is not exactly 0 in IEEE-754 so the diagonal carries the 6.123233995736766E-17 drift produced by Math.Cos(Math.PI / 2) — preserved verbatim per the no-shorthand marker convention: #BeforeBuild:
{ "Parsing": { "G68": { "R": 90 } } }
#AfterBuild:
{
  "TiltTransform": { "Term": "G68" },
  "ProgramToMcTransform": [
    {
      "Source": "TiltTransform",
      "Kind": "Static",
      "Mat4d": [6.123233995736766E-17, 1, 0, 0, -1, 6.123233995736766E-17, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]
    }
  ]
}

Remarks

Input: Parsing.G68 → {X,Y,Z,I,J,K,R} from ParameterizedFlagSyntax. If I/J/K not specified, rotation axis is determined by active plane: G17→Z, G18→Y, G19→X.

Constructors

IsoG68RotationSyntax()

Initializes a new instance with default settings.

public IsoG68RotationSyntax()

IsoG68RotationSyntax(XElement)

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

public IsoG68RotationSyntax(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