TG Motion
version 421 - 4033/904 cnc 121
Real-time system for controlling servo drives and I/O modules
|
Macros | |
#define | CALLBACK_CALLTYPE TOOLCHAIN_CALLTYPE |
Callbacks uses the same calling convention as exported functions. | |
#define | APP_AddOutputLogFunc 1 |
callback index number | |
#define | APP_SetStatusBarTextFunc 2 |
callback index number | |
#define | APP_IsDebugModeFunc 3 |
callback index number | |
#define | APP_IsVerboseModeFunc 4 |
callback index number | |
#define | APP_GetLibPathFunc 5 |
callback index number | |
#define | APP_GetToolPathFunc 6 |
callback index number | |
#define | APP_GetSystemPathFunc 7 |
callback index number | |
#define | APP_GetFileTimeStampFunc 10 |
callback index number | |
#define | APP_DoYieldFunc 11 |
callback index number | |
#define | APP_ReadIniStringFunc 12 |
callback index number | |
#define | APP_ReadIniDoubleFunc 13 |
callback index number | |
#define | APP_ReadIniIntFunc 14 |
callback index number | |
#define | APP_DispRunInfoAndWaitFunc 15 |
callback index number | |
#define | APP_DispRunInfoFunc 16 |
callback index number | |
#define | APP_IsBreakpointFunc 17 |
callback index number | |
#define | APP_DispAndLocateErrorFunc 18 |
callback index number | |
#define | APP_DispLastInfoFunc 19 |
callback index number | |
#define | APP_IsStepModeFunc 20 |
callback index number | |
#define | APP_IsHandControlFunc 21 |
callback index number | |
#define | APP_SetRegimeFromUserKeyFunc 22 |
callback index number | |
#define | APP_ExecMenuCommandFromUserKeyFunc 23 |
callback index number | |
#define | APP_MaxFuncNumber 1000 |
last function in APP group | |
#define | DRV_InitializeFunc 1001 |
callback index number | |
#define | DRV_GFunc 1002 |
callback index number | |
#define | DRV_MFunc 1003 |
callback index number | |
#define | ConnectPointCalcStartFuncNumber 1004 |
callback index number | |
#define | ConnectPointCalcFunc_UseReturnValues 1 |
Return value of ConnectPointCalcFunc or ConnectPointCalcEndFunc values are used. | |
#define | ConnectPointCalcFuncNumber 1005 |
callback index number | |
#define | ConnectPointCalcEndFuncNumber 1006 |
callback index number | |
#define | DRV_MaxFuncNumber 2000 |
last function number in DRV group | |
#define | MATH_WarningFunc 2001 |
callback index number | |
#define | MATH_MaxFuncNumber 3000 |
last function number in MATH group | |
Typedefs | |
typedef int32_t CALLBACK_CALLTYPE | FuncPrototype(intptr_t dwUserData) |
Generic callback function prototype. | |
typedef int32_t CALLBACK_CALLTYPE | AddOutputLogFunc(intptr_t dwUserData, int32_t tab, TGM_LPCTSTR info, CALLBACK_INFO *callBackInfo) |
Writes text to output log. More... | |
typedef int32_t CALLBACK_CALLTYPE | SetStatusBarTextFunc(intptr_t dwUserData, int32_t pane, TGM_LPCTSTR strText, CALLBACK_INFO *callBackInfo) |
Display informational text in the status line of the application. More... | |
typedef int32_t CALLBACK_CALLTYPE | IsDebugModeFunc(intptr_t dwUserData) |
Ask if debug regime is enabled. More... | |
typedef int32_t CALLBACK_CALLTYPE | IsVerboseModeFunc(intptr_t dwUserData) |
Ask if verbose regime is enabled. More... | |
typedef TGM_LPCTSTR CALLBACK_CALLTYPE | GetLibPathFunc(intptr_t dwUserData) |
Returns path to external G functions stored as G-code on the disk. More... | |
typedef TGM_LPCTSTR CALLBACK_CALLTYPE | GetToolPathFunc(intptr_t dwUserData) |
Returns path to files describing tools geometry. Only for lathe. More... | |
typedef TGM_LPCTSTR CALLBACK_CALLTYPE | GetSystemPathFunc(intptr_t dwUserData) |
Returns path to system files. Not yet used by CNC module. More... | |
typedef int64_t CALLBACK_CALLTYPE | GetFileTimeStampFunc(intptr_t dwUserData, uint32_t fileIdx) |
returns time stamp of a given file (usually time in ms since epoch) More... | |
typedef int32_t CALLBACK_CALLTYPE | DoYieldFunc(intptr_t dwUserData, int32_t messageOnly) |
Switch control to other thread. LOCAL_CORE_MODE_DLL only. More... | |
typedef void CALLBACK_CALLTYPE | 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 double CALLBACK_CALLTYPE | ReadIniDoubleFunc(intptr_t dwUserData, TGM_LPCTSTR section, TGM_LPCTSTR key, double defValue) |
Read double value from .INI file. More... | |
typedef int32_t CALLBACK_CALLTYPE | ReadIniIntFunc(intptr_t dwUserData, TGM_LPCTSTR section, TGM_LPCTSTR key, int32_t defValue) |
Read integer value from .INI file. More... | |
typedef int32_t CALLBACK_CALLTYPE | DispRunInfoAndWaitFunc(intptr_t dwUserData, uint32_t editorLine, int32_t fileIdx, TGM_LPCTSTR statusInfo, int32_t bNoBreakpoints, int32_t bForceToWait, const double *params, const uint32_t maxParams) |
Display info about the actual G-code part. More... | |
typedef int32_t CALLBACK_CALLTYPE | DispRunInfoFunc(intptr_t dwUserData, uint32_t editorLine, int32_t fileIdx, TGM_LPCTSTR statusInfo, const SIMPLE_GM_PARAMS_WIN32 *pCmd) |
Display info about the actual G-code part. More... | |
typedef int32_t CALLBACK_CALLTYPE | 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 CALLBACK_CALLTYPE | 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 int32_t CALLBACK_CALLTYPE | DispLastInfoFunc(intptr_t dwUserData) |
Called when G-code execution finished (OK and NOK) More... | |
typedef int32_t CALLBACK_CALLTYPE | IsStepModeFunc(intptr_t dwUserData) |
Ask if execute G-code step by step (part by part). Not yet used. More... | |
typedef int32_t CALLBACK_CALLTYPE | IsHandControlFunc(intptr_t dwUserData) |
Ask if application is in hand control (service mode). Not yet used. More... | |
typedef int32_t CALLBACK_CALLTYPE | SetRegimeFromUserKeyFunc(intptr_t dwUserData, int32_t key) |
Reserved. More... | |
typedef int32_t CALLBACK_CALLTYPE | ExecMenuCommandFromUserKeyFunc(intptr_t dwUserData, int key) |
Reserved. More... | |
typedef int32_t CALLBACK_CALLTYPE | DriverInitializeFunc(intptr_t dwUserData, double *params, uint32_t nParams, int32_t bTestMode) |
Called always before G-code execution. More... | |
typedef int32_t CALLBACK_CALLTYPE | DriverGFunc(intptr_t dwUserData, const SIMPLE_GM_PARAMS_WIN32 *v) |
Called to simulate G function. More... | |
typedef int32_t CALLBACK_CALLTYPE | DriverMFunc(intptr_t dwUserData, const SIMPLE_GM_PARAMS_WIN32 *v) |
Called to simulate M function. More... | |
typedef int32_t CALLBACK_CALLTYPE | ConnectPointCalcStartFunc(intptr_t dwUserData, const int32_t nType, const uint32_t nCoords, const double *coords, const uint32_t bitCodedAxesForCalc) |
Initiate user connection calculation. More... | |
typedef int32_t CALLBACK_CALLTYPE | ConnectPointCalcFunc(intptr_t dwUserData, const SIMPLE_GM_PARAMS_WIN32 *part, double *calcSquareDistanceFromCoords, P10DOUBLE *calcConnectPoint) |
Calculate distance from initial tool point to a give G-code part. More... | |
typedef int32_t CALLBACK_CALLTYPE | ConnectPointCalcEndFunc(intptr_t dwUserData, SIMPLE_GM_PARAMS_WIN32 *partToBeConnectedTo, P10DOUBLE *connectPosToBeMovedTo) |
End of connection calculation. More... | |
typedef int32_t CALLBACK_CALLTYPE | MathWarningFunc(intptr_t dwUserData, CALLBACK_INFO *pCallbackInfo) |
Called in case of warning issued during tool diameter compensation calculation. More... | |
typedef int32_t CALLBACK_CALLTYPE AddOutputLogFunc(intptr_t dwUserData, int32_t tab, TGM_LPCTSTR info, CALLBACK_INFO *callBackInfo) |
Writes text to output log.
dwUserData | User data given by ToolChainCore_SetCallBack function | ||||||||||||
indicates | severity of the text. Log output may be directed to:
| ||||||||||||
info | Text to be displayed | ||||||||||||
callBackInfo | Pointer to CALLBACK_INFO with additional text informations |
typedef int32_t CALLBACK_CALLTYPE SetStatusBarTextFunc(intptr_t dwUserData, int32_t pane, TGM_LPCTSTR strText, CALLBACK_INFO *callBackInfo) |
Display informational text in the status line of the application.
Called during long operations like compilation, etc.
dwUserData | User data given by ToolChainCore_SetCallBack function |
pane | always 0 |
strText | Text to be displayed in a status line of the application |
callBackInfo | Pointer to CALLBACK_INFO with additional text information |
typedef int32_t CALLBACK_CALLTYPE IsDebugModeFunc(intptr_t dwUserData) |
Ask if debug regime is enabled.
Debug regime displays a lot of information to debug view (or terminal), produces helper files (results of compilation and G-code execution) and slow down the whole CNC module. Can be enabled also by .INI file.
dwUserData | User data given by ToolChainCore_SetCallBack function |
typedef int32_t CALLBACK_CALLTYPE IsVerboseModeFunc(intptr_t dwUserData) |
Ask if verbose regime is enabled.
Verbose regime adds additional information to debug mode, displayed in debug output or terminal. Slows down the CNC module significantly (especially for large G-code files) Can be enabled also by .INI file.
dwUserData | User data given by ToolChainCore_SetCallBack function |
typedef TGM_LPCTSTR CALLBACK_CALLTYPE GetLibPathFunc(intptr_t dwUserData) |
Returns path to external G functions stored as G-code on the disk.
dwUserData | User data given by ToolChainCore_SetCallBack function |
typedef TGM_LPCTSTR CALLBACK_CALLTYPE GetToolPathFunc(intptr_t dwUserData) |
Returns path to files describing tools geometry. Only for lathe.
dwUserData | User data given by ToolChainCore_SetCallBack function |
typedef TGM_LPCTSTR CALLBACK_CALLTYPE GetSystemPathFunc(intptr_t dwUserData) |
Returns path to system files. Not yet used by CNC module.
dwUserData | User data given by ToolChainCore_SetCallBack function |
typedef int64_t CALLBACK_CALLTYPE GetFileTimeStampFunc(intptr_t dwUserData, uint32_t fileIdx) |
returns time stamp of a given file (usually time in ms since epoch)
dwUserData | User data given by ToolChainCore_SetCallBack function |
fileIdx | Index of the file. File name and path must be taken by ToolChainCore_IdxToFile. |
typedef int32_t CALLBACK_CALLTYPE DoYieldFunc(intptr_t dwUserData, int32_t messageOnly) |
Switch control to other thread. LOCAL_CORE_MODE_DLL only.
dwUserData | User data given by ToolChainCore_SetCallBack function |
reserved |
typedef void CALLBACK_CALLTYPE ReadIniStringFunc(intptr_t dwUserData, TGM_LPCTSTR section, TGM_LPCTSTR key, TGM_LPCTSTR defValue, TGM_LPTSTR buffer, uint32_t bufferSizeInCharacters) |
Read string from .INI file.
Follows Windows .INI file syntax.
dwUserData | User data given by ToolChainCore_SetCallBack function |
section | File section (in square brackets) |
key | Key name (text in front of the equal sign) |
defValue | Default text value if key not found |
buffer | buffer where to copy string from .INI file |
bufferSizeInCharacters | Size of the buffer in characters (not bytes) |
typedef double CALLBACK_CALLTYPE ReadIniDoubleFunc(intptr_t dwUserData, TGM_LPCTSTR section, TGM_LPCTSTR key, double defValue) |
Read double value from .INI file.
Follows Windows .INI file syntax.
dwUserData | User data given by ToolChainCore_SetCallBack function |
section | File section (in square brackets) |
key | Key name (text in front of the equal sign) |
defValue | Default value if key not found |
typedef int32_t CALLBACK_CALLTYPE ReadIniIntFunc(intptr_t dwUserData, TGM_LPCTSTR section, TGM_LPCTSTR key, int32_t defValue) |
Read integer value from .INI file.
Follows Windows .INI file syntax.
dwUserData | User data given by ToolChainCore_SetCallBack function |
section | File section (in square brackets) |
key | Key name (text in front of the equal sign) |
defValue | Default value if key not found |
typedef int32_t CALLBACK_CALLTYPE DispRunInfoAndWaitFunc(intptr_t dwUserData, uint32_t editorLine, int32_t fileIdx, TGM_LPCTSTR statusInfo, int32_t bNoBreakpoints, int32_t bForceToWait, const double *params, const uint32_t maxParams) |
Display info about the actual G-code part.
Allows to interrupt execution of the G-code.
dwUserData | User data given by ToolChainCore_SetCallBack function |
editorLine | Actual line number in the G-code |
fileIdx | Actual file index. Filename can be obtained by ToolChainCore_IdxToFile |
statusInfo | Text to be displayed in the status line |
bNoBreakpoints | |
bForceToWait | |
params | Array of all the Pxx parameters |
maxParams | Number of parameters in the params array |
typedef int32_t CALLBACK_CALLTYPE DispRunInfoFunc(intptr_t dwUserData, uint32_t editorLine, int32_t fileIdx, TGM_LPCTSTR statusInfo, const SIMPLE_GM_PARAMS_WIN32 *pCmd) |
Display info about the actual G-code part.
This function should not be blocking. Just display the information and return.
dwUserData | User data given by ToolChainCore_SetCallBack function |
editorLine | Actual line number in the G-code |
fileIdx | Actual file index. Filename can be obtained by ToolChainCore_IdxToFile |
statusInfo | Text to be displayed in the status line |
pCmd | Actual processed G-code function |
typedef int32_t CALLBACK_CALLTYPE IsBreakpointFunc(intptr_t dwUserData, uint32_t editorLine, int32_t fileIdx) |
Determines if there is a breakpoint on given G-code file line.
CNC system has built-in support for exactly one breakpoint. If there is a need for multiple breakpoints, this callback must be implemented.
dwUserData | User data given by ToolChainCore_SetCallBack function |
editorLine | Line to be checked |
fileIdx | File index of the G-code. File name can be get by ToolChainCore_IdxToFile. |
typedef int32_t CALLBACK_CALLTYPE 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.
Set this callback very early during application startup, preferably before ToolChainCore_LoadFromIni function.
dwUserData | User data given by ToolChainCore_SetCallBack function |
editorLine | Line of text with error. Could be 0 for some type of errors. |
fileIdx | Index of the G-code file with the error. Could be negative for some type of errors. |
errString | Error text, always in English. Translations to other languages can be made with the help of information given in callBackInfo parameter |
callBackInfo | Pointer to CALLBACK_INFO with additional error information (error number, error arguments, etc...) |
typedef int32_t CALLBACK_CALLTYPE DispLastInfoFunc(intptr_t dwUserData) |
Called when G-code execution finished (OK and NOK)
dwUserData | User data given by ToolChainCore_SetCallBack function |
typedef int32_t CALLBACK_CALLTYPE IsStepModeFunc(intptr_t dwUserData) |
Ask if execute G-code step by step (part by part). Not yet used.
dwUserData | User data given by ToolChainCore_SetCallBack function |
typedef int32_t CALLBACK_CALLTYPE IsHandControlFunc(intptr_t dwUserData) |
Ask if application is in hand control (service mode). Not yet used.
dwUserData | User data given by ToolChainCore_SetCallBack function |
typedef int32_t CALLBACK_CALLTYPE SetRegimeFromUserKeyFunc(intptr_t dwUserData, int32_t key) |
Reserved.
dwUserData | User data given by ToolChainCore_SetCallBack function |
key | user keyboard key code |
typedef int32_t CALLBACK_CALLTYPE ExecMenuCommandFromUserKeyFunc(intptr_t dwUserData, int key) |
Reserved.
dwUserData | User data given by ToolChainCore_SetCallBack function |
key | user keyboard key code |
typedef int32_t CALLBACK_CALLTYPE DriverInitializeFunc(intptr_t dwUserData, double *params, uint32_t nParams, int32_t bTestMode) |
Called always before G-code execution.
In simulation or test mode (regimes 10 or 20), the driver callbacks are called. With help of these callbacks, complete simulation of G-code can be created in the application. The drive callbacks can be set after the call of ToolChainCore_LoadFromIni function.
dwUserData | User data given by ToolChainCore_SetCallBack function |
pointer | to array of doubles to be filled with desired values |
nParams | Number of items in the array |
bTestMode | If set, actual regime is 20 (statusTEST), otherwise it is 10 (statusSIMULATING) |
typedef int32_t CALLBACK_CALLTYPE DriverGFunc(intptr_t dwUserData, const SIMPLE_GM_PARAMS_WIN32 *v) |
Called to simulate G function.
dwUserData | User data given by ToolChainCore_SetCallBack function |
v | | Pointer to SIMPLE_GM_PARAMS_WIN32 with relevant actual G function information |
typedef int32_t CALLBACK_CALLTYPE DriverMFunc(intptr_t dwUserData, const SIMPLE_GM_PARAMS_WIN32 *v) |
Called to simulate M function.
dwUserData | User data given by ToolChainCore_SetCallBack function |
v | | Pointer to SIMPLE_GM_PARAMS_WIN32 with relevant actual M function information |
typedef int32_t CALLBACK_CALLTYPE ConnectPointCalcStartFunc(intptr_t dwUserData, const int32_t nType, const uint32_t nCoords, const double *coords, const uint32_t bitCodedAxesForCalc) |
Initiate user connection calculation.
This function is called at the start of connection calculation. It transfers the parameters given in the ToolChainCore_ConnectCNCEx_Plane function to the user application space.
nType | Connection type (see also enum connect_type). Only connectBY_COORD (0), connectBY_COORD_GO (10), connectBY_COORD_GO_BUFFERED(40) are used. |
nCoords | Number of valid values in the coords parameter. Input only. |
coords | Coordinates of the point from which is the connection function calculated. It is a copy of coords parameter of the ToolChainCore_ConnectCNCEx_Plane function. Input only. |
bitCodedAxesForCalc | Copy of bitCodedAxesForCalc parameter of the ToolChainCore_ConnectCNCEx_Plane function. |
typedef int32_t CALLBACK_CALLTYPE ConnectPointCalcFunc(intptr_t dwUserData, const SIMPLE_GM_PARAMS_WIN32 *part, double *calcSquareDistanceFromCoords, P10DOUBLE *calcConnectPoint) |
Calculate distance from initial tool point to a give G-code part.
This callback is periodically called for all the move parts of the G-code (G0, G1, G2, G3). The user application can modify the values calculated by the system. This could be useful for machines with axes which form non-cartesian space (e.g. some axes are linear, some are rotational).
dwUserData | User data given by ToolChainCore_SetCallBack function |
part | Actual part to be calculated. Input only. |
calcSquareDistanceFromCoords | The system calculates the squared distance from coords to part and gives it in the calcSquareDistanceFromCoords parameter. The callback function can modify this value and return it back. The value could be > 1e38, in that case the distance is larger than the threshold given in GCODE_PARAMETERS::maxConnectionDistance. |
calcConnectPoint | The system calculates the point on the part which would be the coordinates where the tool shall go to as a result of the connection (in the case the part is used as the connection part). The callback function can modify this parameter and return back different values. Only nCoords are valid. |
Value | Description |
---|---|
0 | Returned values are ignored |
1 | The calculatedDistanceFromCoords and calculatedCrossPoint contain valid values and will be used |
typedef int32_t CALLBACK_CALLTYPE ConnectPointCalcEndFunc(intptr_t dwUserData, SIMPLE_GM_PARAMS_WIN32 *partToBeConnectedTo, P10DOUBLE *connectPosToBeMovedTo) |
End of connection calculation.
The user application can e.g. store all the movement parts passed in the ConnectPointCalcFunc and calculate the final connection point and part during this callback.
dwUserData | User data given by ToolChainCore_SetCallBack function |
partToBeConnectedTo | Choosen part of the G-code where the connection shall proceed. The user application can modify this parameter and set to it any other valid part of the G-code. |
connectPosToBeMovedTo | Position where the tool should go. The point must be on the partToBeConnectedTo . |
Value | Description |
---|---|
0 | Returned values are ignored |
1 | The partToBeConnectedTo and connectPosToBeMovedTo contain valid values and will be used |
typedef int32_t CALLBACK_CALLTYPE MathWarningFunc(intptr_t dwUserData, CALLBACK_INFO *pCallbackInfo) |
Called in case of warning issued during tool diameter compensation calculation.
Depending on G-code, there could be very large number of calls of this function.
dwUserData | User data given by ToolChainCore_SetCallBack function |
callBackInfo | Pointer to CALLBACK_INFO with informations about the warning |