UNPKG

@scalenc/nc-format

Version:

Library for handling TRUMPF NC file format.

56 lines 2.51 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isRelativeTransformationInstruction = exports.isAbsoluteTransformationInstruction = exports.isTransformationInstruction = exports.tryOverwriteAbsoluteModeByFunction = exports.Constants = void 0; class Constants { static INCH_TO_MM = 25.4; static MM_PER_MIN_TO_M_PER_S = 1e-3 / 60; static FUNC_ABSOLUTE_POS = 'AC'; static FUNC_RELATIVE_POS = 'IC'; static FUNC_ABSOLUTE_ANG = ['DC', 'ACP', 'ACN']; static CENTER_RADIUS = 'CR'; static VELOCITY_QUICK = 'E'; static VELOCITY = 'F'; static LINEAR_VELOCITY_VARIABLES = [Constants.VELOCITY_QUICK, Constants.VELOCITY]; static TRANSLATE = 'TRANS'; static ADD_TRANSLATE = 'ATRANS'; static ROTATE = 'ROT'; static ADD_ROTATE = 'AROT'; static ABSOLUTE_TRANSFORMATIONS = [Constants.TRANSLATE, Constants.ROTATE]; static RELATIVE_TRANSFORMATIONS = [Constants.ADD_TRANSLATE, Constants.ADD_ROTATE]; static TRANSFORM_ANGLE = 'RPL'; static TRANSFORM_X = 'X'; static TRANSFORM_Y = 'Y'; static TRANSFORM_VARIABLES = [Constants.TRANSFORM_ANGLE, Constants.TRANSFORM_X, Constants.TRANSFORM_Y]; static IF = 'IF'; static ELSE = 'ELSE'; static ENDIF = 'ENDIF'; } exports.Constants = Constants; function tryOverwriteAbsoluteModeByFunction(functionName) { const functionNameUpperCase = functionName.toUpperCase(); if (functionNameUpperCase === Constants.FUNC_ABSOLUTE_POS) { return true; } else if (functionNameUpperCase === Constants.FUNC_RELATIVE_POS) { return false; } else if (Constants.FUNC_ABSOLUTE_ANG.includes(functionNameUpperCase)) { return true; } // Nothing to override. return undefined; } exports.tryOverwriteAbsoluteModeByFunction = tryOverwriteAbsoluteModeByFunction; function isTransformationInstruction(name) { return isAbsoluteTransformationInstruction(name) || isRelativeTransformationInstruction(name); } exports.isTransformationInstruction = isTransformationInstruction; function isAbsoluteTransformationInstruction(name) { return Constants.ABSOLUTE_TRANSFORMATIONS.includes(name.toUpperCase()); } exports.isAbsoluteTransformationInstruction = isAbsoluteTransformationInstruction; function isRelativeTransformationInstruction(name) { return Constants.RELATIVE_TRANSFORMATIONS.includes(name.toUpperCase()); } exports.isRelativeTransformationInstruction = isRelativeTransformationInstruction; //# sourceMappingURL=Constants.js.map