Table of Contents

Class NcKinematicsDependency

Namespace
Hi.NcParsers.Dependencys.SystemWired
Assembly
HiMech.dll

Provides IMachineKinematics as an INcDependency for SoftNcRunner.PipelineNcDependencyList.

The actual kinematics instance is resolved at runtime via KinematicsProvider. This supports scenarios where the machine tool is loaded or changed after the runner is configured (e.g., XML config loaded first, kinematics assigned later).

Consumed by G53p1RotaryPositionSyntax, IsoG68p2TiltSyntax, and McLinearMotionSemantic via dependencyList.OfType<IMachineKinematics>().

public class NcKinematicsDependency : INcDependency, IMakeXmlSource, IMachineKinematics
Inheritance
NcKinematicsDependency
Implements
Inherited Members
Extension Methods

Constructors

NcKinematicsDependency()

Initializes a new instance with no KinematicsProvider; assign one before the runner queries kinematics.

public NcKinematicsDependency()

NcKinematicsDependency(Func<IMachineKinematics>)

Initializes a new instance with the given KinematicsProvider.

public NcKinematicsDependency(Func<IMachineKinematics> provider)

Parameters

provider Func<IMachineKinematics>

Delegate that resolves the live IMachineKinematics at lookup time.

Properties

KinematicsOrNull

Non-throwing probe: the live kinematics instance, or null when the provider is unwired or resolves to null (e.g. the machining chain is a ClMillingDevice, so no XyzabcSolver exists). Lets a syntax/semantic that supports both CL and MC chains branch on availability instead of catching InvalidOperationException from the IMachineKinematics members.

public IMachineKinematics KinematicsOrNull { get; }

Property Value

IMachineKinematics

KinematicsProvider

Runtime provider for the kinematics instance. Null provider or null return means kinematics is not yet available.

public Func<IMachineKinematics> KinematicsProvider { get; set; }

Property Value

Func<IMachineKinematics>

ProgramZeroToPnOrNull

The program-zero → Pn transform resolved via ProgramZeroToPnProvider, or null when unwired/unavailable; consumers fall back to identity (workpiece frame ≡ Pn frame).

public Mat4d ProgramZeroToPnOrNull { get; }

Property Value

Mat4d

ProgramZeroToPnProvider

Runtime provider for the rigid transform from program-zero (workpiece) coordinates to the kinematic Pn frame, for pipelines whose source positions live in the workpiece frame (the NX CLSF pipeline). NC G-code pipelines leave it unwired — their program→MC mapping is carried per block by work-offset transform sections instead. The host wires it from the equipment topology (MachiningEquipmentUtil.GetProgramToPnMat4d); the provider is resolved per call so a re-aligned workpiece is picked up without rewiring.

public Func<Mat4d> ProgramZeroToPnProvider { get; set; }

Property Value

Func<Mat4d>

XName

XML element name used to register this dependency with XFactory.

public static string XName { get; }

Property Value

string

Methods

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.

McAbcToMat(Vec3d)

Converts machine ABC coordinates to a tilt matrix. the tilt matrix is the transformation matrix from table to attacher.

public Mat4d McAbcToMat(Vec3d mcAbc_rad)

Parameters

mcAbc_rad Vec3d

The machine ABC coordinates in radians

Returns

Mat4d

The tilt matrix

McToMat(DVec3d)

Converts machine coordinates to an attacher matrix.

public Mat4d McToMat(DVec3d mcXyzabc)

Parameters

mcXyzabc DVec3d

The machine coordinates

Returns

Mat4d

The attacher matrix

McToPn(DVec3d)

Machine coordinate to tool attacher Pn (Point and Normal). The Pn is from table buckle to tool attacher.

public DVec3d McToPn(DVec3d mcXyzabc)

Parameters

mcXyzabc DVec3d

machine coordinate. ABC is in radian.

Returns

DVec3d

tool attacher Pn (Point and Normal)

OrientationToMcAbc(Mat4d, out Vec3d)

Converts a tilt matrix to machine ABC coordinates. the tilt matrix is the transformation matrix from table to attacher. the solution only fit the orientation part of the tiltMat.

public bool OrientationToMcAbc(Mat4d tiltMat, out Vec3d mcAbc_rad)

Parameters

tiltMat Mat4d

The tilt matrix to convert

mcAbc_rad Vec3d

Output parameter that will contain the machine ABC coordinates in radians

Returns

bool

Whether the conversion was successful

OrientationToMcAbc(Mat4d, Func<Vec3d, bool>, out Vec3d)

OrientationToMcAbc(Mat4d, out Vec3d) restricted to the rotary positions isMcAbcAdmissible accepts (the machine's rotary travel, typically). A full orientation fixes the rotary positions up to axis periodicity, so a solution the predicate refuses is a posture this machine cannot take: the conversion then fails (false) and leaves the solver state as it was, so that the caller can fall back to OrientationToMcAbc(Vec3d, Func<Vec3d, bool>, out Vec3d), where the free rotation about the tool axis opens the other branch. A null predicate admits everything.

public bool OrientationToMcAbc(Mat4d tiltMat, Func<Vec3d, bool> isMcAbcAdmissible, out Vec3d mcAbc_rad)

Parameters

tiltMat Mat4d

The tilt matrix to convert.

isMcAbcAdmissible Func<Vec3d, bool>

Accepts a machine ABC (radians) or refuses it; null admits everything.

mcAbc_rad Vec3d

Output machine ABC coordinates in radians.

Returns

bool

Whether an admissible conversion was found.

OrientationToMcAbc(Vec3d, out Vec3d)

Converts a target tool axial direction (endpoint orientation) to machine ABC coordinates. Only the axial alignment is constrained; rotation about the tool axis is free.

Use this in place of OrientationToMcAbc(Mat4d, out Vec3d) when the rotation about the tool axis is irrelevant (e.g. G53.1 rotary positioning). The axial-only solve avoids the redundant 6-target full-matrix constraint and is more likely to converge for tilt configurations such as G68.2 I180 J90 K0.

public bool OrientationToMcAbc(Vec3d toolAxialNormal, out Vec3d mcAbc_rad)

Parameters

toolAxialNormal Vec3d

Target tool axial direction in table coordinates (the third row of the tilt matrix; e.g. AxialNormal).

mcAbc_rad Vec3d

Output machine ABC coordinates in radians.

Returns

bool

Whether the conversion was successful.

OrientationToMcAbc(Vec3d, Func<Vec3d, bool>, out Vec3d)

OrientationToMcAbc(Vec3d, out Vec3d) preferring the solution branch isMcAbcAdmissible accepts. The axial-only problem has two branches on a two-rotary-axis machine (on a table-table A/C: (A, C) and (−A, C+180°)); the plain overload returns the branch nearest the solver's seed, which from the rotary pole (A0 C0) is the one the tilt's azimuth happens to favour — half the time the branch a cradle table with an asymmetric tilt travel cannot reach (CHEM20180926 N100: G68.2 I210 J-90 + G53.1 solved to A=+90° on a −120°…+30° A axis). When the nearest branch is refused, an implementation with a real solver searches the other branches and returns the admissible one nearest the seed; when none is admissible it returns the refused solution and true, and the stroke-limit check downstream reports it. A null predicate makes this the plain overload. The default implementation is the plain solve — the predicate is advisory for an implementation without a solver.

public bool OrientationToMcAbc(Vec3d toolAxialNormal, Func<Vec3d, bool> isMcAbcAdmissible, out Vec3d mcAbc_rad)

Parameters

toolAxialNormal Vec3d

Target tool axial direction in table coordinates.

isMcAbcAdmissible Func<Vec3d, bool>

Accepts a machine ABC (radians) or refuses it; null admits everything.

mcAbc_rad Vec3d

Output machine ABC coordinates in radians.

Returns

bool

Whether the conversion was successful (admissible or not).

PnToMc(DVec3d, out DVec3d)

Tool attacher Pn (Point and Normal) to machine coordinate. The Pn is from table buckle to tool attacher.

public bool PnToMc(DVec3d pn, out DVec3d mcXyzabc_rad)

Parameters

pn DVec3d

tool attacher Pn (Point and Normal)

mcXyzabc_rad DVec3d

machine coordinate (ABC in radian)

Returns

bool

whether conversion succeeded

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