TG Motion  version 502 - 4034/906 cnc 126
tgm_cnc.h File Reference

Main include file for CNC module of TG Motion. More...

#include "tgm.h"
#include "tgm_cnc_internal_constants.h"
#include "tgm_debug_assert.h"
#include "tgm_cnc_windows.h"
#include <math.h>

Classes

struct  cnc::SIMPLE_INFO
 Auxiliary G-code functions use this structure. More...
 
struct  cnc::P10DOUBLE
 This structure defines 10 coordinates of float64_t type (8 bytes) More...
 
struct  cnc::P10BOOL
 Structure similar to P10DOUBLE, using integers. More...
 
struct  cnc::ACTUAL_GM_VALUES
 Actual parameters. More...
 
struct  cnc::SIMPLE_GM_PARAMS_WIN32
 Describes one G-code part. More...
 
struct  cnc::CALLBACK_INFO
 Structure for transmitting information for the function ToolChainCore_GetLastError and for the callback functions AddOutputLogFunc, SetStatusBarTextFunc, MathWarningFunc. More...
 
struct  cnc::GCODE_FEED
 Definition of default feeds. More...
 
struct  cnc::AXIS_LIMITS
 Limits for one axis. More...
 
struct  cnc::GCODE_CORRECTION
 Definition of corrections. More...
 
struct  cnc::ARC_FEED_TABLE
 Table of speeds, relative arc speeds in relation to radius. More...
 
struct  cnc::INTERNAL_MFUNC_INSERT_TABLE
 Values of inserted M functions. More...
 
struct  cnc::GCODE_PARAMETERS
 Structure for setting G-code properties. More...
 
struct  cnc::GCODE_SIZE
 Initial position, end position and size. More...
 
struct  cnc::GCODE_INFO
 G-code size. More...
 
struct  cnc::DLL_INIT_STRUCT
 Initialization structure. Used by ToolChainCore_Init. More...
 
struct  cnc::MACHINE_PARAMETERS
 Machine parameters. More...
 
struct  cnc::MACHINE_STATUS
 Machine status. More...
 
struct  cnc::TGM_FUNCTION_INTERNAL
 base structure for activating a CNC function More...
 
struct  cnc::TGM_FUNCTION
 automatically sets the size of the structure to 8192 bytes More...
 
struct  cnc::TGM_CNC_CORE_MEMORY_INTERNAL
 shared CNC memory for one CNC core More...
 
struct  cnc::TGM_CNC_CORE_MEMORY
 automatically sets the size of the structure to 16384 bytes More...
 
struct  cnc::TGM_CNC_MEMORY_HEADER
 header of the shared TGM_CNCEX memory More...
 
struct  cnc::TGM_CNC_MEMORY
 describes the shared TGM_CNCEX memory More...
 
struct  CNC_CALC_INIT_DATA
 Initialization structure. More...
 
struct  CNC_CALC_RETURN_VALUE
 Holds changed G-code parts. More...
 

Namespaces

 cnc
 all CNC functions are encapsulated to cnc namespace
 

Typedefs

typedef int32_t cnc::FuncPrototype(intptr_t dwUserData)
 Generic callback function prototype.
 
typedef int32_t cnc::AddOutputLogFunc(intptr_t dwUserData, uint32_t tab, TGM_LPCTSTR info, CALLBACK_INFO *callBackInfo)
 Writes text to output log. More...
 
typedef int32_t cnc::SetStatusBarTextFunc(intptr_t dwUserData, uint32_t pane, TGM_LPCTSTR strText, CALLBACK_INFO *callBackInfo)
 Display informational text in the status line of the application. More...
 
typedef int32_t cnc::IsDebugModeFunc(intptr_t dwUserData)
 Ask if debug regime is enabled. More...
 
typedef int32_t cnc::IsVerboseModeFunc(intptr_t dwUserData)
 Ask if verbose regime is enabled. More...
 
typedef TGM_LPCTSTR cnc::GetLibPathFunc(intptr_t dwUserData)
 Returns path to external G functions stored as G-code on the disk. More...
 
typedef TGM_LPCTSTR cnc::GetToolPathFunc(intptr_t dwUserData)
 Returns path to files describing tools geometry. Only for lathe. More...
 
typedef TGM_LPCTSTR cnc::GetSystemPathFunc(intptr_t dwUserData)
 Returns path to system files. Not yet used by CNC module. More...
 
typedef int64_t cnc::GetFileTimeStampFunc(intptr_t dwUserData, int32_t fileIdx)
 returns time stamp of a given file (usually time in ms since epoch) More...
 
typedef int32_t cnc::DoYieldFunc(intptr_t dwUserData, int32_t messageOnly)
 Switch control to other thread. LOCAL_CORE_MODE_DLL only. More...
 
typedef void cnc::ReadIniStringFunc(intptr_t dwUserData, TGM_LPCTSTR section, TGM_LPCTSTR key, TGM_LPCTSTR defValue, TGM_LPTSTR buffer, uint32_t bufferSizeInCharacters)
 Read string from .INI file. More...
 
typedef float64_t cnc::ReadIniDoubleFunc(intptr_t dwUserData, TGM_LPCTSTR section, TGM_LPCTSTR key, float64_t defValue)
 Read float64_t value from .INI file. More...
 
typedef int32_t cnc::ReadIniIntFunc(intptr_t dwUserData, TGM_LPCTSTR section, TGM_LPCTSTR key, int32_t defValue)
 Read integer value from .INI file. More...
 
typedef int32_t cnc::IsBreakpointFunc(intptr_t dwUserData, uint32_t editorLine, int32_t fileIdx)
 Determines if there is a breakpoint on given G-code file line. More...
 
typedef int32_t cnc::DispAndLocateErrorFunc(intptr_t dwUserData, uint32_t editorLine, int32_t fileIdx, TGM_LPCTSTR errString, CALLBACK_INFO *callBackInfo)
 This function is called in case of an error. More...
 
typedef void cnc::DispRunInfoFunc(intptr_t dwUserData, const SIMPLE_GM_PARAMS_WIN32 *pCmd)
 
typedef int32_t cnc::AddOutputLogWithMsgBoxFunc(intptr_t dwUserData, uint32_t tab, uint32_t buttons, TGM_LPCTSTR info, CALLBACK_INFO *callBackInfo)
 Writes text to output log and optionally displays it in message box dialog panel (OS dependent) More...
 
typedef int32_t cnc::SetStatusBarProgressFunc(intptr_t dwUserData, uint32_t progress)
 Display progress bar. More...
 
typedef int32_t cnc::DriverInitializeFunc(intptr_t dwUserData, float64_t *params, uint32_t nParams, cnc_status nRunMode)
 Called always before G-code execution. More...
 
typedef int32_t cnc::DriverGFunc(intptr_t dwUserData, const SIMPLE_GM_PARAMS_WIN32 *v)
 Called to simulate G function. More...
 
typedef int32_t cnc::DriverMFunc(intptr_t dwUserData, const SIMPLE_GM_PARAMS_WIN32 *v)
 Called to simulate M function. More...
 
typedef int32_t cnc::ConnectPointCalcStartFunc(intptr_t dwUserData, const uint32_t nType, const uint32_t nCoords, const float64_t *coords, const uint32_t bitCodedAxesForCalc)
 Initiate user connection calculation. More...
 
typedef int32_t cnc::ConnectPointCalcFunc(intptr_t dwUserData, const SIMPLE_GM_PARAMS_WIN32 *part, float64_t *calcSquareDistanceFromCoords, P10DOUBLE *calcConnectPoint)
 Calculate distance from initial tool point to a give G-code part. More...
 
typedef int32_t cnc::ConnectPointCalcEndFunc(intptr_t dwUserData, SIMPLE_GM_PARAMS_WIN32 *partToBeConnectedTo, P10DOUBLE *connectPosToBeMovedTo)
 End of connection calculation. More...
 
typedef int32_t cnc::DriverEnd(intptr_t dwUserData)
 Called when the G-code simulation finishes. More...
 
typedef int32_t cnc::MathWarningFunc(intptr_t dwUserData, CALLBACK_INFO *pCallbackInfo)
 Called in case of warning issued during tool diameter compensation calculation. More...
 
typedef int32_t CNC_CALC_LOAD(const CNC_CALC_INIT_DATA *pInitData)
 typedef for CNC_Calc_Load
 
typedef int32_t CNC_CALC_UNLOAD()
 typedef for CNC_Calc_Unload
 
typedef uint32_t CNC_CALC_GET_STRUCTURES_SIZE(uint32_t structureIdx)
 typedef for CNC_Calc_Get_Structures_Size
 
typedef int32_t CNC_CALC_GET_COMPATIBILITY_IDS(uint32_t *pID_COMPATIBILITY, uint32_t *pID_MEMORY_COMPATIBILITY, uint32_t *pID_CNC_COMPATIBILITY)
 typedef for CNC_Calc_Get_Compatibility_IDs
 
typedef int32_t CNC_CALC_START(uint32_t intIdx, int32_t regime, const cnc::SIMPLE_GM_PARAMS_WIN32 *pInitPos, CNC_CALC_RETURN_VALUE *pChangedParts)
 typedef for CNC_Calc_Start
 
typedef int32_t CNC_CALC_GFUNC(uint32_t intIdx, const cnc::SIMPLE_GM_PARAMS_WIN32 *pGFunc, CNC_CALC_RETURN_VALUE *pChangedParts)
 typedef for CNC_Calc_GFunc
 
typedef int32_t CNC_CALC_MFUNC(uint32_t intIdx, const cnc::SIMPLE_GM_PARAMS_WIN32 *pMFunc, CNC_CALC_RETURN_VALUE *pChangedParts)
 typedef for CNC_Calc_MFunc
 
typedef int32_t CNC_CALC_FINISH(uint32_t intIdx, const cnc::SIMPLE_GM_PARAMS_WIN32 *pFinishMFunc, CNC_CALC_RETURN_VALUE *pChangedParts)
 typedef for CNC_Calc_Finish
 

Enumerations

enum class  cnc::cnc_status : int32_t {
  cnc::OFFLINE_M02 = -2 ,
  cnc::INVALID_00 = 0 ,
  cnc::COMPILING_01 = 1 ,
  cnc::COMPILE_FINISHED_M01 = -1 ,
  cnc::SIMULATING_10 = 10 ,
  cnc::SIMULATION_END_M10 = -10 ,
  cnc::SIMULATION_BREAK_M11 = -11 ,
  cnc::TEST_20 = 20 ,
  cnc::TEST_END_M20 = -20 ,
  cnc::TEST_BREAK_M21 = -21 ,
  cnc::TRAJECTORY_START_M30 = -30 ,
  cnc::TRAJECTORY_BREAK_M31 = -31 ,
  cnc::TRAJECTORY_END_M32 = -32 ,
  cnc::TRAJECTORY_BREAK_M0_M33 = -33 ,
  cnc::FORWARD_30 = 30 ,
  cnc::FORWARD_NO_MFUNC_31 = 31 ,
  cnc::BACKWARD_32 = 32 ,
  cnc::FORWARD_SKIP_FIRST_M_33 = 33 ,
  cnc::CONNECTING_40 = 40 ,
  cnc::CONNECT_MOVE_41 = 41 ,
  cnc::HAND_MOVE_50 = 50 ,
  cnc::OUT_OF_TRAJECTORY_M50 = -50 ,
  cnc::CALCULATING_60 = 60 ,
  cnc::START_M_FUNCS_70 = 70 ,
  cnc::STOP_M_FUNCS_80 = 80 ,
  cnc::CONNECT_INS_M_FUNCS_90 = 90 ,
  cnc::NONSENSE = -1234
}
 StatusCNC return codes. More...
 
enum class  cnc::connect_type : uint32_t {
  cnc::BY_COORD = 0 ,
  cnc::BY_LINE_START = 1 ,
  cnc::BY_LINE_END = 2 ,
  cnc::BY_COORD_GO = 10 ,
  cnc::BY_LINE_START_GO = 11 ,
  cnc::BY_LINE_END_GO = 12 ,
  cnc::BY_M_FUNC_COUNT = 20 ,
  cnc::BY_M_FUNC_COUNT_REL = 21 ,
  cnc::BY_GCODE_INDEX = 30 ,
  cnc::BY_GCODE_INDEX_ACTUAL_COORD = 31 ,
  cnc::BY_GCODE_INDEX_END = 32 ,
  cnc::BY_COORD_GO_BUFFERED = 40 ,
  cnc::BY_LINE_START_GO_BUFFERED = 41 ,
  cnc::BY_LINE_END_GO_BUFFERED = 42 ,
  cnc::BY_GCODE_INDEX_ACTUAL_COORD_GO_BUFFERED = 44 ,
  cnc::BY_COORD_ON_TRAJECTORY_WITH_GCODE_INDEX_GO_BUFFERED = 46
}
 Connection modes (ToolChainCore_ConnectCNCEx_Plane) More...
 
enum class  cnc::status_after_connect : uint32_t {
  cnc::KEEP_00 = 0 ,
  cnc::FORCE_OUT_OF_TRAJECTORY_02 = 2
}
 Specifies wanted status after successful connect for ToolChainCore_ConnectCNCEx_Plane. More...
 
enum class  cnc::axis_idx : int32_t {
  cnc::AXIS_NONE = -1 ,
  cnc::AXIS_X = 0 ,
  cnc::AXIS_Y = 1 ,
  cnc::AXIS_Z = 2 ,
  cnc::AXIS_C = 3 ,
  cnc::AXIS_B = 4 ,
  cnc::AXIS_U = 5 ,
  cnc::AXIS_V = 6 ,
  cnc::AXIS_W = 7 ,
  cnc::AXIS_A = 8 ,
  cnc::AXIS_O = 9 ,
  cnc::AXIS_S = 100 ,
  cnc::AXIS_T = 101 ,
  cnc::AXIS_IO = 102 ,
  cnc::AXIS_S2 = 103 ,
  cnc::AXIS_XY = 200
}
 Axes numbers, together with special axis types. Assignment of the axes to array indexes is fixed, i.e. the first axis (index 0) is always X axis, etc... Special axes are used internally and have no relationship to array indexes. More...
 
enum class  cnc::reset_status_cnc : uint32_t {
  cnc::TO_INVALID_00 = 0 ,
  cnc::TO_OUT_OF_TYRAJECTORY_01 = 1
}
 Values for ToolChainCore_ResetStatusCNC function. More...
 
enum class  cnc::cnc_func : uint32_t {
  NONE_00 = 0U ,
  STOP_01 = 1U ,
  START_02 = 2U ,
  CONNECT_03 = 3U ,
  GOTO_04 = 4U ,
  SET_GCODE_PARAMETERS_05 = 5U ,
  COMPILE_06 = 6U
}
 CNC function to be activated from shared memory.
 

Functions

template<uint8_t c>
constexpr size_t cnc::ADDR_IDX ()
 simplify G-code address indexing
 
int32_t ToolChainCore_Init (const cnc::DLL_INIT_STRUCT *pInitValues)
 Init the CNC module. More...
 
int32_t ToolChainCore_LoadFromIni (uint32_t intIdx, TGM_LPCTSTR iniFile, uint32_t *pnMaxCores)
 Loads DLL chain from INI file. More...
 
int32_t ToolChainCore_DestroyCNC (uint32_t intIdx)
 Finishes work with DLLs and frees all the allocated memory. More...
 
int32_t ToolChainCore_SetGCodeParameters (uint32_t intIdx, const cnc::GCODE_PARAMETERS *params)
 Sets parameters (properties) of G-code. More...
 
int32_t ToolChainCore_GetGCodeParameters (uint32_t intIdx, cnc::GCODE_PARAMETERS *params)
 Obtains values set with ToolChainCore_SetGCodeParameters, or read from .INI file during startup. More...
 
cnc::cnc_status ToolChainCore_StatusCNC (uint32_t intIdx)
 Actual CNC module state. More...
 
int32_t ToolChainCore_GetPosEx (uint32_t intIdx, int32_t reserved, cnc::ACTUAL_GM_VALUES *pos)
 Returns current position of machine axes together with additional informations. More...
 
int32_t ToolChainCore_CompileFromFile (uint32_t intIdx, TGM_LPCTSTR fileName)
 Compiles G-code from file. More...
 
int32_t ToolChainCore_CompileFromMemory (uint32_t intIdx, TGM_LPCTSTR fileName, TGM_LPCSTR mainCode)
 Compiles G-code from string in memory. More...
 
int32_t ToolChainCore_IsBusy (uint32_t intIdx)
 Checks if the machine is executing G-code. More...
 
int32_t ToolChainCore_StartCNCEx (uint32_t intIdx, cnc::cnc_status regime, TGM_LPCSTR strAddGCode)
 Start or continue G-code. More...
 
int32_t ToolChainCore_ResetCNC (uint32_t intIdx, int32_t regime, const uint32_t nCoords, const float64_t *coords)
 Sets the initial position for G-code. More...
 
int32_t ToolChainCore_StopCNCEx (uint32_t intIdx, TGM_LPCSTR strAddCode)
 Stops motion or connecting (break). More...
 
int32_t ToolChainCore_ConnectCNCEx_Plane (uint32_t intIdx, cnc::connect_type nType, const uint32_t nCoords, const float64_t *coords, TGM_LPCSTR strAddCode, uint32_t bitCodedAxesForCalc, uint32_t bitCodedAxesForConnect, cnc::status_after_connect trajectoryStateAfterConnectRequest)
 Move to the nearest point of trajectory of G-code with possibility of M function insertion after the connection movement. More...
 
int32_t ToolChainCore_GoToPosition (uint32_t intIdx, const uint32_t nCoords, const float64_t *coords)
 Manual control. More...
 
int32_t ToolChainCore_GoToPositionEx (uint32_t intIdx, const cnc::SIMPLE_GM_PARAMS_WIN32 *pDest)
 Extended manual control. More...
 
int32_t ToolChainCore_MFunc (uint32_t intIdx, const cnc::SIMPLE_GM_PARAMS_WIN32 &fun, int32_t bDirectToPLC)
 Send M function directly to system. More...
 
int32_t ToolChainCore_FileToIdx (uint32_t intIdx, TGM_LPCTSTR fileName)
 Returns index number of the file with a given name. If the file name is new, it returns a new number. More...
 
TGM_LPCTSTR ToolChainCore_IdxToFile (uint32_t intIdx, int32_t fileIdx)
 Returns the complete filename of file with relevant number (index). More...
 
int32_t ToolChainCore_SetRelFeed (uint32_t intIdx, float64_t relFeed)
 Sets the feed override (relative speed). More...
 
int32_t ToolChainCore_SetCallBack (uint32_t intIdx, uint32_t fceNo, intptr_t dwUserData, cnc::FuncPrototype *funcPtr)
 Sets callback function. More...
 
int32_t ToolChainCore_GetLastError (uint32_t intIdx, cnc::CALLBACK_INFO *pLastErrorInfo)
 Returns the last error, if any. More...
 
int32_t ToolChainCore_SetBreakpoint (uint32_t intIdx, uint32_t editorLine, int32_t fileIdx)
 Set breakpoint in the G-code. More...
 
int32_t ToolChainCore_GetGCodeSizeInfo (uint32_t intIdx, cnc::GCODE_INFO *pInfo)
 Identifies size (dimension) of G-code. More...
 
int32_t ToolChainCore_GetStructuresSize (uint32_t intIdx, uint32_t nItems, uint32_t *items)
 Returns bytes sizes of internal structures. More...
 
TGM_LPCTSTR ToolChainCore_GetVersionString (uint32_t intIdx)
 Returns the DLLs version number and the date and time of compilation. More...
 
int32_t ToolChainCore_GetMachineParameters (uint32_t intIdx, cnc::MACHINE_PARAMETERS *pParameters)
 Returns actual values of MACHINE_PARAMETERS. More...
 
int32_t ToolChainCore_SetMachineParameters (uint32_t intIdx, const cnc::MACHINE_PARAMETERS *pParameters)
 Sets new values of MACHINE_PARAMETERS. More...
 
int32_t ToolChainCore_LoadCNCCalcPlugIn (TGM_LPCTSTR fileName, uint32_t loadFlags, int64_t userValue)
 Load CNC Calc plugin (see CNC Calc plug-in exported functions) More...
 
void ToolChain_FlushLogFile ()
 Flush (force to write to disk) the log file.
 
void ToolChain_LogANSI (TGM_LPCSTR info)
 Append the string to the log file. More...
 
int32_t ToolChainCore_SetUserParams (uint32_t intIdx, const float64_t *userParams, uint32_t userParamsCount)
 Set parameters P00 - P99 for use in G-code. More...
 
int32_t ToolChainCore_GCodePrefixPostfix (uint32_t intIdx, TGM_LPCSTR strPrefix, TGM_LPCSTR strPostfix)
 
float64_t ToolChainCore_GetGCodeRunTime (uint32_t intIdx, int32_t fileIdx)
 
int32_t ToolChainCore_SetGCodeRunTime (uint32_t intIdx, int32_t fileIdx, float64_t timeInS)
 Set runtime of the G code. More...
 
int32_t ToolChainCore_ResetStatusCNC (uint32_t intIdx, cnc::reset_status_cnc mode)
 Enables to clear the memory or set the status to out of trajectory. More...
 
int32_t ToolChainCore_SetLogValue (uint32_t logValue) noexcept
 Set new log value directly to CNC module. More...
 
uint32_t ToolChainCore_GetLogValue () noexcept
 Get actual log value set by INI file or by ToolChainCore_SetLogValue() More...
 
CNC_CALC_DLL_EXPORT int32_t CNC_Calc_Load (const CNC_CALC_INIT_DATA *pInitData)
 Plug-in DLL initialization. More...
 
CNC_CALC_DLL_EXPORT int32_t CNC_Calc_Unload ()
 Plug-in DLL cleanup. More...
 
CNC_CALC_DLL_EXPORT uint32_t CNC_Calc_Get_Structures_Size (uint32_t structureIdx)
 Check structure sizes - test for compatibility. More...
 
CNC_CALC_DLL_EXPORT int32_t CNC_Calc_Get_Compatibility_IDs (uint32_t *pID_COMPATIBILITY, uint32_t *pID_MEMORY_COMPATIBILITY, uint32_t *pID_CNC_COMPATIBILITY)
 Returns compatibility numbers at the time of plug-in build. More...
 
CNC_CALC_DLL_EXPORT int32_t CNC_Calc_Start (uint32_t intIdx, int32_t regime, const cnc::SIMPLE_GM_PARAMS_WIN32 *pInitPos, CNC_CALC_RETURN_VALUE *pChangedParts)
 Called before the G-code execution. More...
 
CNC_CALC_DLL_EXPORT int32_t CNC_Calc_GFunc (uint32_t intIdx, const cnc::SIMPLE_GM_PARAMS_WIN32 *pGFunc, CNC_CALC_RETURN_VALUE *pChangedParts)
 Called for any G function inside G-code. More...
 
CNC_CALC_DLL_EXPORT int32_t CNC_Calc_MFunc (uint32_t intIdx, const cnc::SIMPLE_GM_PARAMS_WIN32 *pMFunc, CNC_CALC_RETURN_VALUE *pChangedParts)
 Called for any M function inside G-code. More...
 
CNC_CALC_DLL_EXPORT int32_t CNC_Calc_Finish (uint32_t intIdx, const cnc::SIMPLE_GM_PARAMS_WIN32 *pFinishMFunc, CNC_CALC_RETURN_VALUE *pChangedParts)
 Called as the last function of the G-code. More...
 

Variables

constexpr uint32_t cnc::COMM_DLL_VERSION { 511U }
 CNC and communication library (TGMmini_5.dll) version.
 
constexpr float64_t cnc::INVALID_VALUE { 1e38 }
 this "nonsense" value is used for not used G-code addresses.
 
constexpr float32_t cnc::INVALID_VALUE_F { 1e38F }
 this "nonsense" value is used for not used G-code addresses (float32_t version)
 
constexpr uint32_t cnc::MAX_FUNC_ADDRESSES { TGM5_NAMESPACE :: MFUNC_NUMBER_PAR }
 number of letters in alphabet, i.e. all the G-code addresses
 
constexpr int32_t cnc::TOOL_CHAIN_BAD_INTR_INDEX { -2 }
 ToolChainCore_XXX functions return codes. More...
 
constexpr int32_t cnc::TOOL_CHAIN_ERROR { -1 }
 unknown error (pointer is null, invalid parameter value, etc...)
 
constexpr int32_t cnc::TOOL_CHAIN_SUCCESS { 0 }
 OK value.
 
constexpr int32_t cnc::TOOL_CHAIN_XEXEC { 1 }
 error during execution
 
constexpr int32_t cnc::TOOL_CHAIN_XBREAK { 2 }
 execution has been interrupted
 
constexpr uint32_t cnc::ACTUAL_N_AXES { TGM5_NAMESPACE :: MAX_INTERPOLATOR_AXES }
 number of axes used in CNC module (currently 10)
 
constexpr uint32_t cnc::RESET_CNC_NO_G92 { 1U }
 Additional regimes for ToolChainCore_ResetCNC function. More...
 
constexpr uint32_t cnc::NUMBER_OF_VARIABLES { 100U }
 Max number of user Pxx parameters.
 
constexpr uint32_t cnc::SUB_PARS { 50U }
 Number of system parameters (P100 - P149)
 
constexpr uint32_t cnc::MAX_DECLARED_PARAMS { NUMBER_OF_VARIABLES + SUB_PARS }
 Total number of parameters.
 
constexpr uint32_t cnc::MAXLABELLENGTH { 40U }
 Max label length in the G-code (in characters)
 
constexpr int32_t cnc::FILE_IDX_UNKNOWN { -1 }
 special file indexes More...
 
constexpr int32_t cnc::FILE_IDX_END { -2 }
 end of G-code
 
constexpr int32_t cnc::FILE_IDX_STOP { -3 }
 reserved
 
constexpr int32_t cnc::FILE_IDX_EXEC { -4 }
 reserved
 
constexpr int32_t cnc::FILE_IDX_INSERT_M_FUNCS { -5 }
 Start or Stop CNC additional M functions.
 
constexpr int32_t cnc::FILE_IDX_INSERT_G_FUNCS { -6 }
 Move to connection point.
 
constexpr int32_t cnc::FILE_IDX_RUNTIME_ERROR { -7 }
 reserved
 
constexpr int32_t cnc::FILE_IDX_MOVE { -8 }
 GoTo position.
 
constexpr uint32_t cnc::LOG_DEBUG_SWITCH { 0x00000001U }
 
constexpr uint32_t cnc::LOG_VERBOSE_SWITCH { 0x00000002U }
 Produces more informational output to log and debug files.
 
constexpr uint32_t cnc::LOG_WORKER { 0x00000004U }
 Enables logging of SF_XYZWorker_5 library messages.
 
constexpr uint32_t cnc::LOG_TOOLCHAIN { 0x00000008U }
 Enables logging of SF_TCh_5 library messages.
 
constexpr uint32_t cnc::LOG_DRIVER { 0x00000010U }
 Enables logging of SF_RTDrv_5 library messages.
 
constexpr uint32_t cnc::LOG_COMPILER { 0x00000020U }
 Enables logging of SF_DComp_5 library messages.
 
constexpr uint32_t cnc::LOG_EXEC { 0x00000040U }
 Enables logging of SF_DExec_5 library messages.
 
constexpr uint32_t cnc::LOG_MATH { 0x00000080U }
 Enables logging of SF_XYZMath_5 library messages.
 
constexpr uint32_t cnc::LOG_SEND_TO_DBGVIEW { 0x10000000U }
 
constexpr uint32_t cnc::LOG_SEND_TO_FILE { 0x20000000U }
 
constexpr uint32_t cnc::LOG_SEND_TO_TGM { 0x40000000U }
 
constexpr uint32_t cnc::MAX_M_FUNC_IN_G { 4U }
 
constexpr uint32_t cnc::PLANE_XY { 17 }
 CNC planes. More...
 
constexpr uint32_t cnc::PLANE_XZ { 18 }
 G18.
 
constexpr uint32_t cnc::PLANE_YZ { 19 }
 G19.
 
constexpr uint32_t cnc::PLANE_ZX { 20 }
 G-18 - lathe only.
 
constexpr uint32_t cnc::PLANE_XYZ { 21 }
 21 - general plane oriented in XYZ 3D space
 
constexpr uint32_t cnc::CORR_STRATEGY_G41_ALREADY_CORRECTED { 0U }
 G41, G42 means already corrected coordinate; G40 says that only the end of the following motion will be left uncorrected.
 
constexpr uint32_t cnc::CORR_STRATEGY_G41_STARTS_CORRECTION { 1U }
 G41, G42 only corrects the end of the following motion; G40 says the end of the previous motion will not be corrected.
 
constexpr uint32_t cnc::CORR_STRATEGY_MASK { 0xFFU }
 bits not used for correction strategy
 
constexpr uint32_t cnc::CORR_STRATEGY_OLD_VERSION { 0x80000000U }
 
constexpr uint32_t cnc::CORR_STRATEGY_G00_WITHOUT_CORR { 0x40000000U }
 If this bit is set, G00 is always without correction.
 
constexpr uint32_t cnc::CORR_STRATEGY_FORCE_TO_CONTINUE { 0x20000000U }
 
constexpr uint32_t cnc::CORR_STRATEGY_CHECK_ORIGINAL_GCODE { 0x02000000U }
 checks continuity of the G-code with the given tolerance (see GCODE_PARAMETERS::tolerance).
 
constexpr uint32_t cnc::CORR_STRATEGY_REMOVE_LAST_ARC { 0x01000000 }
 removes the last arc of a closed conture (in the case that the arc is the exit of the conture) if the equidistants do not cross
 
constexpr uint32_t cnc::CORR_STRATEGY_REMOVE_FIRST_ARC { 0x00800000U }
 removes the first arc of a closed conture (in the case that the arc is the approach of the conture) if the equidistants do not cross
 
constexpr uint32_t cnc::CORR_STRATEGY_NO_ADD_R { 0x00400000U }
 
constexpr uint32_t cnc::CORR_STRATEGY_REMOVE_SMALL_ARCS { 0x00200000U }
 
constexpr uint32_t cnc::CORR_STRATEGY_ALLOW_REVERSE_LINES { 0x00100000U }
 Allow more exact calculation of the tool compensation by reverse search with the buffer. Slows down the calculation.
 
constexpr uint32_t cnc::CORR_STRATEGY_REMOVE_CROSSES { 0x00080000U }
 After the calculation, if there are crossed parts (which are not crossed in the original G-code), these parts are removed.
 
constexpr uint32_t cnc::CORR_STRATEGY_CONNECT_WRONG_BY_G1 { 0x00040000U }
 After correction calculation, if there are unconnected parts, connect them by inserted G1.
 
constexpr uint32_t cnc::CORR_STRATEGY_CONNECT_WRONG_BY_MOVE { 0x00020000U }
 
constexpr uint32_t cnc::CORR_STRATEGY_ALLOW_FIRST_LAST_CROSS { 0x00010000U }
 Allow crossing of the first and last part of the closed conture. In that case, parts inside are not removed.
 
constexpr uint32_t cnc::CORR_STRATEGY_SEARCH_MASK { 0x00000700U }
 mask bits for search deep number
 
constexpr uint32_t cnc::CORR_STRATEGY_SEARCH_DEEP_10 { 0x00000100U }
 Search at least 10 parts for possible crosses.
 
constexpr uint32_t cnc::CORR_STRATEGY_SEARCH_DEEP_50 { 0x00000200U }
 Search at least 50 parts for possible crosses.
 
constexpr uint32_t cnc::CORR_STRATEGY_SEARCH_DEEP_100 { 0x00000300U }
 Search at least 100 parts for possible crosses.
 
constexpr uint32_t cnc::CORR_STRATEGY_SEARCH_DEEP_500 { 0x00000400U }
 Search at least 500 parts for possible crosses.
 
constexpr uint32_t cnc::CORR_STRATEGY_SEARCH_DEEP_1000 { 0x00000500U }
 Search at least 1000 parts for possible crosses.
 
constexpr uint32_t cnc::CORR_STRATEGY_SEARCH_DEEP_2000 { 0x00000600U }
 Search at least 2000 parts for possible crosses.
 
constexpr uint32_t cnc::CORR_STRATEGY_SEARCH_DEEP_ALL { 0x00000700U }
 Search all parts for possible crosses.
 
constexpr uint32_t cnc::CORR_STRATEGY_DEFAULT_DEEP { 1000U }
 Default deep search number. Search at least 1000 G-code parts for possible crosses.
 
constexpr uint32_t cnc::CORR_STRATEGY_MIN_DEEP { 10U }
 Minimal search number.
 
constexpr uint32_t cnc::F_BY_GCODE { 0U }
 Feed is fully defined in G-code.
 
constexpr uint32_t cnc::F_BY_PARAMETERS { 1U }
 All feeds are set by values in motion array.
 
constexpr uint32_t cnc::F_BY_PARAMETERS_FP_BY_GCODE { 2U }
 All feeds are set by values in motion array but can be overridden by FP address.
 
constexpr uint32_t cnc::DEF_GCODE_FEED_G00 { 0U }
 indexes to feed table (GCODE_PARAMETERS::motion) More...
 
constexpr uint32_t cnc::DEF_GCODE_FEED_G01 { 1U }
 linear interpolation G1
 
constexpr uint32_t cnc::DEF_GCODE_FEED_REVERSE { 2U }
 backward movement (cnc_status::BACKWARD_32)
 
constexpr uint32_t cnc::DEF_GCODE_FEED_CONNECT { 3U }
 connect to trajectory
 
constexpr uint32_t cnc::DEF_GCODE_FEED_WITHOUT_M { 4U }
 movement without M functions
 
constexpr uint32_t cnc::DEF_GCODE_FEED_GOTO_POSITION { 5U }
 goto position
 
constexpr uint32_t cnc::DEF_GCODE_FEED_NORMAL_STOP { 6U }
 stop (only deceleration is used)
 
constexpr uint32_t cnc::DEF_GCODE_FEED_EMERGENCY_STOP { 7U }
 emergency stop (only deceleration is used)
 
constexpr uint32_t cnc::DISABLE_OPCODE_CALL { 0x00000001U }
 
constexpr uint32_t cnc::DISABLE_ASSIGN_CALL { 0x00000002U }
 
constexpr uint32_t cnc::DISABLE_REFRESH_ALL_PARAMS_CALL { 0x00000004U }
 
constexpr uint32_t cnc::GCODE_ALLOWED_CIRC_CENTER_ACCURACY { 0U }
 index to GCODE_PARAMETERS::tolerance array
 
constexpr uint32_t cnc::GCODE_CROSSING_ACCURACY { 1U }
 index to GCODE_PARAMETERS::tolerance array
 
constexpr uint32_t cnc::GCODE_ANGULAR_PRECISION { 2U }
 index to GCODE_PARAMETERS::tolerance array
 
constexpr uint32_t cnc::GCODE_ANGULAR_DISTANCE_PRECISION { 3U }
 index to GCODE_PARAMETERS::tolerance array
 
constexpr uint32_t cnc::GCODE_MINIMAL_ALLOWED_ARC_R { 4U }
 index to GCODE_PARAMETERS::tolerance array
 
constexpr uint32_t cnc::GCODE_NO_ADD_R_MULTIPLIER { 5U }
 index to GCODE_PARAMETERS::tolerance array
 
constexpr uint32_t cnc::GCODE_SOURCE_PRECISION { 6U }
 index to GCODE_PARAMETERS::tolerance array
 
constexpr uint32_t cnc::GCODE_MINIMAL_ALLOWED_LINE_LENGTH { 7U }
 index to GCODE_PARAMETERS::tolerance array
 
constexpr uint32_t cnc::INTERPOLATOR_CONFIG0_USE_REL_SPEED_BY_TIME { 0x0000'0001 }
 
constexpr uint32_t cnc::INTERPOLATOR_CONFIG0_CONT_M_FUNC_IN_PLACE { 0x0000'0002 }
 
constexpr uint32_t cnc::INTERPOLATOR_CONFIG0_DO_NOT_STOP_BETWEEN_G00_G01 { 0x0001'0000 }
 
constexpr uint32_t cnc::INTERPOLATOR_CONFIG0_USE_FAST_FEED_IN_ALL_REGIMES { 0x0002'0000 }
 
constexpr uint32_t cnc::GCODE_SIZE_ORIGINAL_IDX { 0U }
 original G-code
 
constexpr uint32_t cnc::GCODE_SIZE_CORRECTED_IDX { 1U }
 compensated G-code
 
constexpr uint32_t cnc::GCODE_SIZE_ROTATED_IDX { 2U }
 original rotated G-code
 
constexpr uint32_t cnc::GCODE_SIZE_ROTATED_CORRECTED_IDX { 3U }
 compensated rotated G-code
 
constexpr uint32_t cnc::DEVICE_ERROR_OUT_TAB { 0U }
 add log message to specific log window if possible
 
constexpr uint32_t cnc::CNC_OUT_TAB { 1U }
 add log message to specific log window if possible
 
constexpr uint32_t cnc::M29_OUT_TAB { 2U }
 add log message to specific log window if possible
 
constexpr uint32_t cnc::STATUS_LINE_ONLY { 3U }
 add log message to specific log window if possible
 
constexpr uint32_t cnc::ACTIVATE_TAB { 0x100U }
 activate the selected tab
 
constexpr uint32_t cnc::PREFIX_TIME { 0x200U }
 prefix the message with time
 
constexpr uint32_t cnc::APP_AddOutputLogFunc { 1U }
 callback index number
 
constexpr uint32_t cnc::APP_SetStatusBarTextFunc { 2U }
 callback index number
 
constexpr uint32_t cnc::APP_IsDebugModeFunc { 3U }
 callback index number
 
constexpr uint32_t cnc::APP_IsVerboseModeFunc { 4U }
 callback index number
 
constexpr uint32_t cnc::APP_GetLibPathFunc { 5U }
 callback index number
 
constexpr uint32_t cnc::APP_GetToolPathFunc { 6U }
 callback index number
 
constexpr uint32_t cnc::APP_GetSystemPathFunc { 7U }
 callback index number
 
constexpr uint32_t cnc::APP_GetFileTimeStampFunc { 10U }
 callback index number
 
constexpr uint32_t cnc::APP_DoYieldFunc { 11U }
 callback index number
 
constexpr uint32_t cnc::APP_ReadIniStringFunc { 12U }
 callback index number
 
constexpr uint32_t cnc::APP_ReadIniDoubleFunc { 13U }
 callback index number
 
constexpr uint32_t cnc::APP_ReadIniIntFunc { 14U }
 callback index number
 
constexpr uint32_t cnc::APP_IsBreakpointFunc { 17U }
 callback index number
 
constexpr uint32_t cnc::APP_DispAndLocateErrorFunc { 18U }
 callback index number
 
constexpr uint32_t cnc::APP_DispRunInfo { 19U }
 
constexpr uint32_t cnc::APP_SetStatusBarProgressFunc { 32U }
 callback index number
 
constexpr uint32_t cnc::APP_MaxFuncNumber { 1000U }
 last function in APP group
 
constexpr uint32_t cnc::DRV_InitializeFunc { 1001U }
 callback index number
 
constexpr uint32_t cnc::DRV_GFunc { 1002U }
 callback index number
 
constexpr uint32_t cnc::DRV_MFunc { 1003U }
 callback index number
 
constexpr uint32_t cnc::ConnectPointCalcStartFuncNumber { 1004U }
 callback index number
 
constexpr uint32_t cnc::ConnectPointCalcFunc_UseReturnValues { 1U }
 Return value of ConnectPointCalcFunc or ConnectPointCalcEndFunc values are used.
 
constexpr uint32_t cnc::ConnectPointCalcFuncNumber { 1005U }
 callback index number
 
constexpr uint32_t cnc::ConnectPointCalcEndFuncNumber { 1006U }
 callback index number
 
constexpr uint32_t cnc::DRV_End { 1007U }
 callback index number
 
constexpr int32_t CNC_CALC_MFUNC_OFFSET { 10000 }
 
constexpr uint32_t CNC_CALC_DISABLE_AUTOMATIC_GCODEINDEX_UPDATE_BIT { 0x01U }
 if used, TGMotion does not automatically update GCodeIndex value of the inserted parts
 
constexpr uint32_t CNC_CALC_MAX_STATIC_RETURNED_PARTS { 8U }
 
constexpr int32_t CNC_CALC_RETURN_ERROR { -1 }
 
constexpr int32_t CNC_CALC_RETURN_IGNORE { 0 }
 
constexpr int32_t CNC_CALC_RETURN_USE { 1 }
 
constexpr int32_t CNC_CALC_RETURN_OK { 1 }
 
constexpr int32_t CNC_CALC_RETURN_FEED_ONLY { 2 }
 
constexpr uint32_t CNC_CALC_IDX_INIT_DATA_STRUCT { 0U }
 parameter for CNC_Calc_Get_Structures_Size
 
constexpr uint32_t CNC_CALC_IDX_SIMPLE_GM_PARAMS_BASE_STRUCT { 1U }
 parameter for CNC_Calc_Get_Structures_Size
 
constexpr uint32_t CNC_CALC_IDX_RETURN_VALUE_STRUCT { 2U }
 parameter for CNC_Calc_Get_Structures_Size
 
constexpr int32_t G_FUNC_SETTINGS { 900 }
 Special G-code function number. See Special settings function G900.
 
constexpr uint32_t G_FUNC_SETTINGS_PUSH { 1U }
 See Special settings function G900.
 
constexpr uint32_t G_FUNC_SETTINGS_POP { 2U }
 See Special settings function G900.
 
constexpr uint32_t G_FUNC_SETTINGS_SET_AXIS_LIMITS { 7U }
 See Special settings function G900.
 
constexpr uint32_t G_FUNC_SETTINGS_SET_MUTUAL_ANGLES { 9U }
 See Special settings function G900.
 
constexpr uint32_t G_FUNC_SETTINGS_ENA_MUTUAL_ANGLES { 10U }
 See Special settings function G900.
 
constexpr uint32_t G_FUNC_SETTINGS_ENA_FEED_CALC { 11U }
 See Special settings function G900.
 
constexpr uint32_t G_FUNC_SETTINGS_SET_ANGLE_MODE { 12U }
 See Special settings function G900.
 
constexpr uint32_t G_FUNC_SETTINGS_IGNORE_ARC_FEED_TBL { 13U }
 See Special settings function G900.
 
constexpr uint32_t G_FUNC_SETTINGS_FEED_G00 { 20U }
 See Special settings function G900.
 
constexpr uint32_t G_FUNC_SETTINGS_FEED_FORWARD { 30U }
 See Special settings function G900.
 
constexpr uint32_t G_FUNC_SETTINGS_FEED_FORWARD_NO_M { 31U }
 See Special settings function G900.
 
constexpr uint32_t G_FUNC_SETTINGS_FEED_BACKWARD { 32U }
 See Special settings function G900.
 
constexpr uint32_t G_FUNC_SETTINGS_FEED_CONNECT { 40U }
 See Special settings function G900.
 
constexpr uint32_t G_FUNC_SETTINGS_FEED_GOTO { 50U }
 See Special settings function G900.
 
constexpr uint32_t G_FUNC_SETTINGS_FEED_NORMAL_STOP { 60U }
 See Special settings function G900.
 
constexpr uint32_t G_FUNC_SETTINGS_FEED_EMERGENCY_STOP { 70U }
 See Special settings function G900.
 

Detailed Description

Main include file for CNC module of TG Motion.

Author
Jan Vasina

Release notes

  • 09.04.2018 Initial release
  • 25.06.2018 Added G900 function description
  • 03.10.2018 CNC plug-ins, new callback function for connecting
  • 16.10.2019 Rewritten according to AUTOSAR rules