Table of Contents

Class NcLine

Namespace
Hi.Numerical
Assembly
HiUniNc.dll

Represents a line in the NC program with its associated data and operations.

public class NcLine : ISourceCommand, IFileLine, IFileLineIndex, IGetIndexedFileLine, IGetFileLineIndex, IGetSourceCommand
Inheritance
NcLine
Implements
Inherited Members
Extension Methods

Constructors

NcLine(NcEnv, IndexedFileLine, NcLine, out NcNoteCache, IMessageKit)

Ctor from the reference NcLine.

public NcLine(NcEnv ncEnv, IndexedFileLine fileLine, NcLine preNcLine, out NcNoteCache ncLineCache, IMessageKit messageHost)

Parameters

ncEnv NcEnv

NC environment

fileLine IndexedFileLine

file line

preNcLine NcLine

reference NcLine that this NcLine copy from. If previous NcLine is not null, apply previous NcLine.

ncLineCache NcNoteCache

Output NC note cache

messageHost IMessageKit

Message host for warnings

NcLine(NcEnv, IMessageKit)

Ctor for initial state.

public NcLine(NcEnv ncEnv, IMessageKit messageHost)

Parameters

ncEnv NcEnv
messageHost IMessageKit

Properties

ArcNcArg

NC arguments for arc commands.

public ArcNcArg ArcNcArg { get; set; }

Property Value

ArcNcArg

CoordinateInterpolationMode

Gets the current coordinate interpolation mode (Cartesian or Polar).

public CoordinateInterpolationMode CoordinateInterpolationMode { get; }

Property Value

CoordinateInterpolationMode

F

F. Feedrate on NC code. Note that this may not be the working feedrate. Some NC codes like G00 and G28 doesnt use F code.

public double F { get; set; }

Property Value

double

Remarks

According to Fanuc manual, the default F is zero.

Feedrate_mmdmin

Feedrate on NC code in mm/min. See F.

public double Feedrate_mmdmin { get; set; }

Property Value

double

Feedrate_mmds

Feedrate on NC code in mm/sec. See F.

public double Feedrate_mmds { get; set; }

Property Value

double

FileIndex

File Index. Start on 0.

public int FileIndex { get; }

Property Value

int

FileNo

[Present("File Number", "FileNo", PhysicsUnit.None, "G")]
public int FileNo { get; }

Property Value

int

FilePath

File path.

[Present("File", "File", PhysicsUnit.None, "G")]
public string FilePath { get; }

Property Value

string

FlagsText

Gets a string representation of the active NC flags for this line.

public string FlagsText { get; }

Property Value

string

G28Arg

Arguments for G28 commands.

public G28Arg G28Arg { get; set; }

Property Value

G28Arg

G52_Xyz

Local coordinate system translation.

public Vec3d G52_Xyz { get; set; }

Property Value

Vec3d

G54SeriesCoordinateNum1000

Faunc Group14 value. Note that Heidenhain Datum shift is set by DatumTableId.

public int G54SeriesCoordinateNum1000 { get; set; }

Property Value

int

Group07NcArg

Arguments for Group07 NC commands (tool radius compensation).

public Group07NcArg Group07NcArg { get; set; }

Property Value

Group07NcArg

Group07_D

Radius compensation ID. Note that in Siemens controller, each tool ID has several D entry.

public int Group07_D { get; set; }

Property Value

int

Group08_H

Height compensation ID. For Siemens Traori, the value is Tool ID. For Heidenhain, the value is Tool ID.

public int Group08_H { get; set; }

Property Value

int

Group09NcArg

NC Argument of NC Group09.

public Group09NcArg Group09NcArg { get; set; }

Property Value

Group09NcArg

HeidenhainBlockCacheArg

Heidenhain block cache arguments for various Heidenhain commands.

public IHeidenhainBlockCacheArg HeidenhainBlockCacheArg { get; set; }

Property Value

IHeidenhainBlockCacheArg

HeidenhainCycleDef247Q339

DATUM SETTING DATUM Number.

public int HeidenhainCycleDef247Q339 { get; set; }

Property Value

int

HeidenhainCycleDef7Arg

Arguments for Heidenhain Cycle Definition 7 (datum shift).

public HeidenhainCycleDef7Arg HeidenhainCycleDef7Arg { get; set; }

Property Value

HeidenhainCycleDef7Arg

HeidenhainM140MB

HeidenhainM140(Retract the tool) MB value. MB is the retraction height. double.positiveInf is [MB MAX]. One shot command.

public double HeidenhainM140MB { get; set; }

Property Value

double

HeidenhainQMacroMap

Dictionary mapping Q macro numbers to their string values for Heidenhain controllers.

public Dictionary<int, string> HeidenhainQMacroMap { get; set; }

Property Value

Dictionary<int, string>

HeidenhainToolAxisDir

Direction of the tool axis for Heidenhain controllers.

public int HeidenhainToolAxisDir { get; set; }

Property Value

int

IndexedFileLine

The file line information associated with this NC line.

public IndexedFileLine IndexedFileLine { get; }

Property Value

IndexedFileLine

IsAbsolutePositioning

Gets a value indicating whether absolute positioning (G90) is active.

public bool IsAbsolutePositioning { get; }

Property Value

bool

IsHeightCompensationEnabled

Gets a value indicating whether height compensation is enabled.

public bool IsHeightCompensationEnabled { get; }

Property Value

bool

IsOnArcCommand

Gets a value indicating whether an arc command (G02 or G03) is active.

public bool IsOnArcCommand { get; }

Property Value

bool

IsPathPrepared

Gets a value indicating whether the path is prepared (no radius compensation).

public bool IsPathPrepared { get; }

Property Value

bool

IsRadiusCompensationEnabled

Gets a value indicating whether radius compensation is enabled.

public bool IsRadiusCompensationEnabled { get; }

Property Value

bool

IsToolCenterPointManagementEnabled

Gets a value indicating whether tool center point management is enabled.

public bool IsToolCenterPointManagementEnabled { get; }

Property Value

bool

Line

The line.

[Present("Line", "Line", PhysicsUnit.None, "G")]
public string Line { get; }

Property Value

string

LineIndex

Line Index. Start on 0.

public int LineIndex { get; }

Property Value

int

LineNo

[Present("Line Number", "LineNo", PhysicsUnit.None, "G")]
public int LineNo { get; }

Property Value

int

McAbc_deg

public Vec3d McAbc_deg { get; set; }

Property Value

Vec3d

McAbc_rad

Machine coordinates in ABC format (radians).

public Vec3d McAbc_rad { get; }

Property Value

Vec3d

McXyz

Gets or sets the machine coordinate XYZ values.

public Vec3d McXyz { get; }

Property Value

Vec3d

McXyzabc

Machine coordinate ( with side radius compensation if existed). Point is XYZ. the unit is mm. Normal is ABC. the unit is radian.

public DVec3d McXyzabc { get; }

Property Value

DVec3d

NcFlagBitArray

Internal Used.

public BitArray NcFlagBitArray { get; }

Property Value

BitArray

PausingNcArg

public PausingNcArg PausingNcArg { get; set; }

Property Value

PausingNcArg

Remarks

Since this is base on OneShot Flag, so here has no copy ctor.

PolarEntry

Data structure for polar coordinates entry.

public PolarEntry PolarEntry { get; set; }

Property Value

PolarEntry

PreparationT

Tool ID for preparation.

public int PreparationT { get; set; }

Property Value

int

ProgramOrthogonalPlaneNormal

The orthogonal plane transform after tilting plane transform. Include G17, G18, G19 and plane of called G12p1.

public Vec3d ProgramOrthogonalPlaneNormal { get; }

Property Value

Vec3d

ProgramPos

ProgramPos can be cartesian XYZ or polar XCZ with radius-based X, depends on CoordinateInterpolationMode.

public Vec3d ProgramPos { get; }

Property Value

Vec3d

ProgramXyz

Cartesian Program Position XYZ, Abs Program Position (as G90 position). NC coordinate position is the position processed by modal flags. NC coordinate position is the position after radius compensation. The NC(Program) coordinate position is comprehensible by User. MC NC conversion may raise floating error. The floating error raise the cutting force issue, especially for bottom cutting force. Hence the NC values have to be memorized.

public Vec3d ProgramXyz { get; }

Property Value

Vec3d

Remarks

NC is the better source property than MC. Ex. a NC line command: X100. The Y and Z value may vary if using MC converting back to NC. The error of Y and Z will keeps accumulating until the next explicit YZ command assignment. The error maybe up to 3e-5 in current case. the bounding box size of the case is not large (TT.20230815). Also note that if using Arc command for a complete circle, the begin NC XYZ and the end NC XYZ have to be equaled. Otherwise, it will become only a very small arc rather than the circle. So be care that do not change the NC XYZ if not needed.

RadiusCompensationBuf

Internal use.

public RadiusCompensationBuf RadiusCompensationBuf { get; set; }

Property Value

RadiusCompensationBuf

S

S. Spindle speed.

public int S { get; set; }

Property Value

int

SpindleSpeed_radds

Spindle speed in radian/s.

public double SpindleSpeed_radds { get; set; }

Property Value

double

SpindleSpeed_rpm

Spindle speed in RPM.

public double SpindleSpeed_rpm { get; set; }

Property Value

double

T

Current equiped Tool ID.

public int T { get; set; }

Property Value

int

TiltPlaneNcArg

Arguments related to tilted plane operations.

public ITiltPlaneNcArg TiltPlaneNcArg { get; set; }

Property Value

ITiltPlaneNcArg

Methods

GetAttacherMat(NcEnv)

Gets the attacher transformation matrix for the current machine coordinates.

public Mat4d GetAttacherMat(NcEnv ncEnv)

Parameters

ncEnv NcEnv

The NC environment.

Returns

Mat4d

The attacher transformation matrix.

GetCompensationHeight(NcEnv, IMessageKit)

Gets the tool height compensation value for this NC line.

public double GetCompensationHeight(NcEnv ncEnv, IMessageKit messageHost)

Parameters

ncEnv NcEnv

NC environment

messageHost IMessageKit

Message host for warnings

Returns

double

Height compensation value

GetCompensationRadius(CncBrand, MillingToolOffsetTable, IMessageKit)

Gets the tool radius compensation value for this NC line.

public double GetCompensationRadius(CncBrand cncBrand, MillingToolOffsetTable millingToolOffsetTable, IMessageKit messageHost)

Parameters

cncBrand CncBrand

CNC brand

millingToolOffsetTable MillingToolOffsetTable

Milling tool offset table

messageHost IMessageKit

Message host for warnings

Returns

double

Radius compensation value

GetFileLineIndex()

public FileLineIndex GetFileLineIndex()

Returns

FileLineIndex

FileLineIndex

GetG5xCoordinateOffset(NcEnv)

Gets the G5x coordinate offset for this NC line.

public Vec3d GetG5xCoordinateOffset(NcEnv ncEnv)

Parameters

ncEnv NcEnv

NC environment

Returns

Vec3d

The G5x coordinate offset vector

GetIndexedFileLine()

Gets the file line associated with this object.

public IndexedFileLine GetIndexedFileLine()

Returns

IndexedFileLine

The file line object.

GetMcByProgramPos(Vec3d, NcEnv, NcNoteCache, IMessageKit, out Vec3d)

Internal Use.

public DVec3d GetMcByProgramPos(Vec3d programPos, NcEnv ncEnv, NcNoteCache ncLineCache, IMessageKit messageHost, out Vec3d programXyz)

Parameters

programPos Vec3d
ncEnv NcEnv
ncLineCache NcNoteCache
messageHost IMessageKit
programXyz Vec3d

Returns

DVec3d

GetProgramXyzabc(NcEnv, DVec3d, out bool?, IMessageKit)

Gets the program XYZABC coordinates from machine coordinates.

public DVec3d GetProgramXyzabc(NcEnv ncEnv, DVec3d mcXyzabc, out bool? isG68p2Successed, IMessageKit messageHost)

Parameters

ncEnv NcEnv

The NC environment.

mcXyzabc DVec3d

The machine coordinates.

isG68p2Successed bool?

Output parameter indicating whether G68.2 coordinate conversion was successful.

messageHost IMessageKit

The message host for logging.

Returns

DVec3d

The program XYZABC coordinates.

GetSourceCommand()

Gets the source command associated with this instance.

public ISourceCommand GetSourceCommand()

Returns

ISourceCommand

The source command object.

GetTiltMat4d(NcEnv, out Mat4d)

Internal Use Only.

public bool? GetTiltMat4d(NcEnv ncEnv, out Mat4d tableToFeatureTransform)

Parameters

ncEnv NcEnv

NC environment.

tableToFeatureTransform Mat4d

Transform from NC to Table without tool compensation and linear coordinate offset (such as G55,G56..).

Returns

bool?

True if G68.2 is successfully applied, false if not, and null if not applicable.

HasSyntexXyz(NcEnv)

Determines whether the line contains syntactic XYZ coordinates.

public bool HasSyntexXyz(NcEnv ncEnv)

Parameters

ncEnv NcEnv

NC environment

Returns

bool

True if syntactic XYZ coordinates are present; otherwise, false.

RebuildByMc(NcEnv, DVec3d, NcNoteCache, IMessageKit)

Internal Use Only. For NC opt.

public void RebuildByMc(NcEnv ncEnv, DVec3d mc, NcNoteCache ncLineCache, IMessageKit messageHost)

Parameters

ncEnv NcEnv

NC environment.

mc DVec3d

MC coordinates.

ncLineCache NcNoteCache

NC line cache.

messageHost IMessageKit

Message host for logging and reporting.

RebuildByProgramXyz(NcEnv, Vec3d, NcNoteCache, IMessageKit)

Internal Use Only. For NC opt.

public void RebuildByProgramXyz(NcEnv ncEnv, Vec3d programXyz, NcNoteCache ncNoteCache, IMessageKit messageHost)

Parameters

ncEnv NcEnv

NC environment.

programXyz Vec3d

Program XYZ coordinates.

ncNoteCache NcNoteCache

NC note cache.

messageHost IMessageKit

Message host for logging and reporting.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.