Table of Contents

Class NcFlagUtil

Namespace
Hi.Numerical
Assembly
HiUniNc.dll

Utility class for working with NC flags and their lifecycle modes.

public static class NcFlagUtil
Inheritance
NcFlagUtil
Inherited Members

Methods

GetCompensationHeight(BitArray, int, MillingToolOffsetTable, CncBrand, IMessageKit)

Gets the tool height compensation value based on the NC flags and CNC brand.

public static double GetCompensationHeight(this BitArray ncFlagBitArray, int H, MillingToolOffsetTable millingToolOffsetTable, CncBrand cncBrand, IMessageKit messageHost)

Parameters

ncFlagBitArray BitArray

NC flag bit array

H int

Height offset index

millingToolOffsetTable MillingToolOffsetTable

Tool offset table

cncBrand CncBrand

CNC brand

messageHost IMessageKit

Message host for warnings

Returns

double

Height compensation value

GetCompensationRadius(BitArray, int, MillingToolOffsetTable, CncBrand, IMessageKit)

Gets the tool radius compensation value from the flag bit array and tool offset table.

public static double GetCompensationRadius(this BitArray ncFlagBitArray, int D, MillingToolOffsetTable millingToolOffsetTable, CncBrand cncBrand, IMessageKit messageHost)

Parameters

ncFlagBitArray BitArray

The bit array of NC flags.

D int

The tool diameter offset number.

millingToolOffsetTable MillingToolOffsetTable

The milling tool offset table.

cncBrand CncBrand

The CNC controller brand.

messageHost IMessageKit

The message host for reporting warnings or errors.

Returns

double

The compensation radius value.

GetCoordinateOffset(bool, int, int, HeidenhainCycleDef7Arg, NcEnv)

Gets the coordinate offset based on the CNC controller and coordinate settings.

public static Vec3d GetCoordinateOffset(bool hasSiemensG500, int isoCoordinateId, int heidenhainCycleDef247Q339, HeidenhainCycleDef7Arg heidenhainCycleDef7Arg, NcEnv ncEnv)

Parameters

hasSiemensG500 bool

Whether Siemens G500 is active.

isoCoordinateId int

The ISO coordinate ID.

heidenhainCycleDef247Q339 int

The Heidenhain cycle def 247 Q339 value.

heidenhainCycleDef7Arg HeidenhainCycleDef7Arg

The Heidenhain cycle def 7 arguments.

ncEnv NcEnv

The NC environment.

Returns

Vec3d

The coordinate offset vector.

GetFlags(NcLifeCycleMode)

Gets all NC flags for a specific lifecycle mode.

public static NcFlag[] GetFlags(this NcLifeCycleMode ncLifeCycleMode)

Parameters

ncLifeCycleMode NcLifeCycleMode

The lifecycle mode to get flags for.

Returns

NcFlag[]

An array of NC flags for the specified lifecycle mode.

GetHeidenhainCoordinateOffset(int, HeidenhainCycleDef7Arg, NcEnv)

Gets the coordinate offset for Heidenhain controllers.

public static Vec3d GetHeidenhainCoordinateOffset(int heidenhainCycleDef247Q339, HeidenhainCycleDef7Arg heidenhainCycleDef7Arg, NcEnv ncEnv)

Parameters

heidenhainCycleDef247Q339 int

The preset number for CYCL DEF 247.

heidenhainCycleDef7Arg HeidenhainCycleDef7Arg

The argument for CYCL DEF 7.

ncEnv NcEnv

The NC environment.

Returns

Vec3d

The calculated coordinate offset.

GetModalNcFlag<T>(BitArray)

Gets the modal NC flag of the specified type from the bit array.

public static T GetModalNcFlag<T>(this BitArray ncFlagBitArray) where T : Enum

Parameters

ncFlagBitArray BitArray

The bit array of NC flags.

Returns

T

The modal NC flag of the specified type.

Type Parameters

T

The enum type of the modal flag.

GetNcFlag<T>(BitArray)

Gets the NC flag of the specified type from the bit array.

public static T GetNcFlag<T>(this BitArray ncFlagBitArray)

Parameters

ncFlagBitArray BitArray

The bit array of NC flags.

Returns

T

The NC flag of the specified type.

Type Parameters

T

The enum type of the NC flag.

GetNcFlags(BitArray)

Gets all active NC flags from the bit array.

public static IEnumerable<NcFlag> GetNcFlags(this BitArray ncFlagBitArray)

Parameters

ncFlagBitArray BitArray

The bit array of NC flags.

Returns

IEnumerable<NcFlag>

An enumerable collection of active NC flags.

GetNcFromSyntex<TVec>(NcGroup03, TVec, TVec)

Converts syntactic coordinates to NC coordinates based on the positioning mode.

public static TVec GetNcFromSyntex<TVec>(this NcGroup03 group03Flag, TVec syntexPosition, TVec preProgramPosition) where TVec : IVec<double>, new()

Parameters

group03Flag NcGroup03

The positioning mode flag

syntexPosition TVec

Syntactic position from the input

preProgramPosition TVec

Previous program position

Returns

TVec

Converted NC coordinates

Type Parameters

TVec

Vector type implementing IVec interface

GetNcFromSyntex<TVec>(NcGroup03, TVec, TVec, int, Func<int, TVec, double>, Action<int, TVec, double>)

Converts syntactic position to NC position based on the positioning mode (absolute or incremental).

public static TVec GetNcFromSyntex<TVec>(this NcGroup03 group03Flag, TVec syntexPosition, TVec preProgramPosition, int vecSize, Func<int, TVec, double> getter, Action<int, TVec, double> setter) where TVec : new()

Parameters

group03Flag NcGroup03

The positioning mode flag

syntexPosition TVec

Syntactic position from the input

preProgramPosition TVec

Previous program position

vecSize int

Size of the vector

getter Func<int, TVec, double>

Function to get value at specified index

setter Action<int, TVec, double>

Function to set value at specified index

Returns

TVec

Converted NC coordinates

Type Parameters

TVec

Vector type

Exceptions

InternalException

Thrown when group03Flag is not managed

GetNcGroupType(NcFlag)

Gets the NC group type for the specified NC flag.

public static Type GetNcGroupType(NcFlag ncFlag)

Parameters

ncFlag NcFlag

The NC flag to get the group type for.

Returns

Type

The NC group type or null if not found.

GetNcLifeCycleMode(NcFlag)

Gets the lifecycle mode of the specified NC flag.

public static NcLifeCycleMode GetNcLifeCycleMode(this NcFlag flag)

Parameters

flag NcFlag

The NC flag to check.

Returns

NcLifeCycleMode

The lifecycle mode of the flag.

GetNcName(NcFlag)

Gets the display name of an NC flag.

public static string GetNcName(this NcFlag flag)

Parameters

flag NcFlag

The NC flag to get the name of.

Returns

string

The display name of the NC flag.

GetNcXyzFromSyntex(NcGroup03, Vec3d, Vec3d)

Converts syntactic XYZ coordinates to NC XYZ coordinates based on the positioning mode.

public static Vec3d GetNcXyzFromSyntex(this NcGroup03 group03Flag, Vec3d syntexXyz, Vec3d preNcXyz)

Parameters

group03Flag NcGroup03

The Group03 flag specifying the positioning mode.

syntexXyz Vec3d

The syntactic XYZ coordinates to convert.

preNcXyz Vec3d

The previous NC XYZ coordinates, used for incremental positioning.

Returns

Vec3d

The converted NC XYZ coordinates.

GetNcXyzabcFromSyntex(NcGroup03, DVec3d, DVec3d)

Gets NC XYZABC coordinates from syntactic coordinates based on the positioning mode.

public static DVec3d GetNcXyzabcFromSyntex(this NcGroup03 group03Flag, DVec3d syntexXyzabc, DVec3d preNcXyzabc)

Parameters

group03Flag NcGroup03

The positioning mode flag (G90 or G91).

syntexXyzabc DVec3d

The syntactic XYZABC coordinates.

preNcXyzabc DVec3d

The previous NC XYZABC coordinates.

Returns

DVec3d

The calculated NC XYZABC coordinates.

GetPlaneDir(NcGroup02)

Gets the direction index of the selected plane.

public static int GetPlaneDir(this NcGroup02 ncFlag)

Parameters

ncFlag NcGroup02

The NC plane selection flag (G17, G18, or G19).

Returns

int

The direction index (0=X, 1=Y, 2=Z).

GetPlaneNormal(NcGroup02)

Gets the normal vector of the selected plane.

public static Vec3d GetPlaneNormal(this NcGroup02 ncFlag)

Parameters

ncFlag NcGroup02

The NC plane selection flag (G17, G18, or G19).

Returns

Vec3d

The normal vector of the plane.

GetTiltMat4d(BitArray, ITiltPlaneNcArg, NcGroup02, ICoordinateConverter, out bool?)

public static Mat4d GetTiltMat4d(this BitArray ncFlagBitArray, ITiltPlaneNcArg ncArgGroup16, NcGroup02 ncGroup02flagForG68, ICoordinateConverter coordinateConverterForG68p2, out bool? isG68p2Successed)

Parameters

ncFlagBitArray BitArray
ncArgGroup16 ITiltPlaneNcArg
ncGroup02flagForG68 NcGroup02
coordinateConverterForG68p2 ICoordinateConverter
isG68p2Successed bool?

Returns

Mat4d

GetValue(NcGroup03, double, double)

public static double GetValue(this NcGroup03 group03Flag, double v, double preV)

Parameters

group03Flag NcGroup03
v double

value

preV double

previous value

Returns

double

HasModalFlag<T>(BitArray, out T)

Checks if the bit array has a modal flag of the specified type and retrieves it.

public static bool HasModalFlag<T>(this BitArray ncFlagBitArray, out T dst) where T : Enum

Parameters

ncFlagBitArray BitArray

The bit array of NC flags.

dst T

When this method returns, contains the modal flag if found; otherwise, the default value.

Returns

bool

True if a modal flag was found; otherwise, false.

Type Parameters

T

The enum type of the modal flag.

IsAbsolutePositioning(BitArray)

Checks if the positioning mode is absolute (G90) rather than incremental (G91).

public static bool IsAbsolutePositioning(this BitArray ncFlagBitArray)

Parameters

ncFlagBitArray BitArray

The bit array of NC flags.

Returns

bool

True if absolute positioning is active; otherwise, false.

IsFlagActivated(BitArray, NcFlag)

Determines whether a specific NC flag is activated in the flag bit array.

public static bool IsFlagActivated(this BitArray ncFlagBitArray, NcFlag ncFlag)

Parameters

ncFlagBitArray BitArray

The bit array of NC flags.

ncFlag NcFlag

The NC flag to check.

Returns

bool

True if the flag is activated; otherwise, false.

IsHeightCompensationEnabled(BitArray)

Determines whether height compensation is enabled.

public static bool IsHeightCompensationEnabled(this BitArray ncFlagBitArray)

Parameters

ncFlagBitArray BitArray

The bit array of NC flags.

Returns

bool

True if height compensation is enabled; otherwise, false.

IsOnArcCommand(BitArray)

Determines whether an arc command is active.

public static bool IsOnArcCommand(this BitArray ncFlagBitArray)

Parameters

ncFlagBitArray BitArray

The bit array of NC flags.

Returns

bool

True if an arc command is active; otherwise, false.

IsRadiusCompensationEnabled(BitArray)

Determines whether radius compensation is enabled.

public static bool IsRadiusCompensationEnabled(this BitArray ncFlagBitArray)

Parameters

ncFlagBitArray BitArray

The bit array of NC flags.

Returns

bool

True if radius compensation is enabled; otherwise, false.

IsRadiusOrHeightCompensationEnabled(BitArray)

Determines whether radius or height compensation is enabled.

public static bool IsRadiusOrHeightCompensationEnabled(this BitArray ncFlagBitArray)

Parameters

ncFlagBitArray BitArray

The bit array of NC flags.

Returns

bool

True if radius or height compensation is enabled; otherwise, false.

IsToolCenterPointManagementEnabled(NcGroup08)

obosoleted. use BitArray version instead. Is the flag enabled RTCP (Rotational Tool Center Point) (=Tool Center Point Management, TCPM). Check for NcGroup08.

public static bool IsToolCenterPointManagementEnabled(this NcGroup08 flag)

Parameters

flag NcGroup08

Returns

bool

IsToolCenterPointManagementEnabled(BitArray)

Is the flag enabled RTCP (Rotational Tool Center Point) (=Tool Center Point Management, TCPM).

public static bool IsToolCenterPointManagementEnabled(this BitArray ncFlagBitArray)

Parameters

ncFlagBitArray BitArray

Returns

bool

IsToolChanging(BitArray)

Determines if a tool change operation is active in the NC flag bit array.

public static bool IsToolChanging(this BitArray ncFlagBitArray)

Parameters

ncFlagBitArray BitArray

The bit array of NC flags.

Returns

bool

True if a tool change is active; otherwise, false.

IsToolNormalTiltable(BitArray)

Determines whether the tool normal is tiltable based on the flag bit array.

public static bool IsToolNormalTiltable(this BitArray ncFlagBitArray)

Parameters

ncFlagBitArray BitArray

The bit array of NC flags.

Returns

bool

True if the tool normal is tiltable; otherwise, false.

ModalExclusiveAssign(BitArray, NcFlag)

Modal exclusive assign in the belonging NC Group.

public static BitArray ModalExclusiveAssign(this BitArray ncFlagBitArray, NcFlag assigningNcFlag)

Parameters

ncFlagBitArray BitArray
assigningNcFlag NcFlag

Returns

BitArray

ModalExclusiveAssign<T>(BitArray, T)

Modal exclusive assign in the belonging NC Group.

public static BitArray ModalExclusiveAssign<T>(this BitArray ncFlagBitArray, T assigningNcGroupFlag) where T : struct, Enum

Parameters

ncFlagBitArray BitArray
assigningNcGroupFlag T

Returns

BitArray

Type Parameters

T

ResetOneShotFlag(BitArray)

Resets all one-shot flags in the specified bit array.

public static BitArray ResetOneShotFlag(this BitArray ncFlagBitArray)

Parameters

ncFlagBitArray BitArray

The bit array of NC flags.

Returns

BitArray

The modified bit array with one-shot flags reset.

ToNcFlagString(BitArray)

Converts the active NC flags in the bit array to a string representation.

public static string ToNcFlagString(this BitArray ncFlagBitArray)

Parameters

ncFlagBitArray BitArray

The bit array of NC flags.

Returns

string

A string representation of the active NC flags.