TG Motion
version 421 - 4033/904 cnc 121
Real-time system for controlling servo drives and I/O modules
|
Macros | |
#define | CNC_CALC_LOAD_ALL 0 |
load plug-in to both DLL and TGMmotion (real-time) | |
#define | CNC_CALC_LOAD_DLL_ONLY 1 |
load plug-in to DLL core (engine) only (see also DLL_INIT_STRUCT::Local_Core_Mode and LOCAL_CORE_MODE_DLL) | |
#define | CNC_CALC_LOAD_TGM_ONLY 2 |
load plug-in to TGMmotion engine only (LOCAL_CORE_MODE_TGM) | |
Functions | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_Init (DLL_INIT_STRUCT *pInitValues) |
Init the CNC module. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_LoadFromIni (int32_t intIdx, TGM_LPCTSTR iniFile, int32_t *pnMaxCores) |
Loads DLL chain from INI file. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_DestroyCNC (int32_t intIdx) |
Finishes work with DLLs and frees all the alloctaed memry. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_SetGCodeParameters (int32_t intIdx, const GCODE_PARAMETERS *params) |
Sets parameters (properties) of G-code. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_GetGCodeParameters (int32_t intIdx, GCODE_PARAMETERS *params) |
Obtains values set with ToolChainCore_SetGCodeParameters, or read from .INI file during startup. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_StatusCNC (int32_t intIdx) |
Actual CNC module state. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_GetPos (int32_t intIdx, int32_t regime, SIMPLE_GM_PARAMS_WIN32 *pos, GM_PARAMS_ENHANCED *enhParams) |
Returns current position of machine axes together with additonal informations. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_CompileFromFile (int32_t intIdx, TGM_LPCTSTR fileName) |
Compiles G-code from file. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_CompileFromMemory (int32_t intIdx, TGM_LPCTSTR fileName, TGM_LPCSTR mainCode) |
Compiles G-code from string in memory. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_IsBusy (int32_t intIdx) |
Checks if the machine is executing G-code. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_StartCNCEx (int32_t intIdx, int32_t regime, TGM_LPCSTR strAddGCode) |
Start or continue G-code. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_ResetCNC (int32_t intIdx, int32_t regime, const uint32_t nCoords, const double *coords) |
Sets the initial position for G-code. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_StopCNCEx (int32_t intIdx, TGM_LPCSTR strAddCode) |
Stops motion or connecting (break). More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_ConnectCNCEx_Plane (int32_t intIdx, int32_t nType, const uint32_t nCoords, const double *coords, TGM_LPCSTR strAddCode, uint32_t bitCodedAxesForCalc, uint32_t bitCodedAxesForConnect, int32_t trajectoryStateAfterConnect) |
Move to the nearest point of trajectory of G-code with possibility of M function insertion after the connection movement. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_GoToPosition (int32_t intIdx, const uint32_t nCoords, const double *coords) |
Manual control. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_GoToPositionEx (int32_t intIdx, const SIMPLE_GM_PARAMS_WIN32 *pDest) |
Extended manual control. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_MFunc (int32_t intIdx, const SIMPLE_GM_PARAMS_WIN32 &fun, int32_t bDirectToPLC) |
Send M function directly to system. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_FileToIdx (int32_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... | |
TOOLCHAIN_DLL_EXPORT TGM_LPCTSTR TOOLCHAIN_CALLTYPE | ToolChainCore_IdxToFile (int32_t intIdx, int32_t fileIdx) |
Returns the complete filename of file with relevant number (index). More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_SetRelFeed (int32_t intIdx, double relFeed) |
Sets the feed override (relative speed). More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_SetCallBack (int32_t intIdx, int32_t fceNo, intptr_t dwUserData, FuncPrototype *funcPtr) |
Sets callback function. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_GetLastError (int32_t intIdx, CALLBACK_INFO *pLastErrorInfo) |
Returns the last error, if any. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_SetBreakpoint (int32_t intIdx, uint32_t editorLine, int32_t fileIdx) |
Set breakpoint in the G-code. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_GetGCodeSizeInfo (int32_t intIdx, GCODE_INFO *pInfo) |
Identifies size (dimension) of G-code. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_GetStructuresSize (int32_t intIdx, uint32_t nItems, uint32_t *items) |
Returns bytes sizes of internal structures. More... | |
TOOLCHAIN_DLL_EXPORT TGM_LPCTSTR TOOLCHAIN_CALLTYPE | ToolChainCore_GetVersionString (int32_t intIdx) |
Returns the DLLs version number and the date and time of compilation. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_GetMachineParameters (int32_t intIdx, MACHINE_PARAMETERS *pParameters) |
Returns actual values of MACHINE_PARAMETERS. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_SetMachineParameters (int32_t intIdx, const MACHINE_PARAMETERS *pParameters) |
Sets new values of MACHINE_PARAMETERS. More... | |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE | ToolChainCore_LoadCNCCalcPlugIn (TGM_LPCTSTR fileName, uint32_t loadFlags, int64_t userValue) |
Load CNC Calc plugin (see CNC Calc plug-in exported functions) More... | |
The following functions are exported from SF_TCh.dll or libSF_TCh.so dynamic libraries.
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_Init | ( | DLL_INIT_STRUCT * | pInitValues | ) |
Init the CNC module.
This should be the first called function of the CNC module. If not used, reasonable defaults are used (all paths set to actual directory and core mode set to TGMotion).
Error code | Description |
---|---|
-1 | any of the members in pInitValues is nullptr |
0 | success |
pInitValues | pointer to DLL_INIT_STRUCT with initialization parameters |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_LoadFromIni | ( | int32_t | intIdx, |
TGM_LPCTSTR | iniFile, | ||
int32_t * | pnMaxCores | ||
) |
Loads DLL chain from INI file.
Error code | Description |
---|---|
TOOL_CHAIN_SUCCESS | success |
TOOL_CHAIN_XEXEC | failure |
intIdx | Core index (0-2 on PC, 0 on TGMmini) |
iniFile | Full path of the .INI file |
pnMaxCores | Pointer to variable which recieves number of available cores in the system, can be nullptr |
Call this function at the application startup
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_DestroyCNC | ( | int32_t | intIdx | ) |
Finishes work with DLLs and frees all the alloctaed memry.
Should be called only before the main .EXE file exits. Must be called for all cores, returned by ToolChainCore_LoadFromIni.
intIdx | Core index (0-2 on PC, 0 on TGMmini) |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_SetGCodeParameters | ( | int32_t | intIdx, |
const GCODE_PARAMETERS * | params | ||
) |
Sets parameters (properties) of G-code.
Calling is possible also during G-code interruption ToolChainCore_StopCNCEx, but only some fields of GCODE_PARAMETERS can be changed (mostly the feeds). First call ToolChainCore_GetGCodeParameters, then change only the structure fields and then set the changed parameters by ToolChainCore_SetGCodeParameters.
Error code | Description |
---|---|
-1 | invalid parameter params or parameters cannot be chnaged at this moment (machine is in motion) |
0 | success |
intIdx | Core index (0-2 on PC, 0 on TGMmini) |
params | Pointer to GCODE_PARAMETERS structure with desired parameters |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_GetGCodeParameters | ( | int32_t | intIdx, |
GCODE_PARAMETERS * | params | ||
) |
Obtains values set with ToolChainCore_SetGCodeParameters, or read from .INI file during startup.
Error code | Description |
---|---|
-1 | invalid parameter params or machine is in motion |
0 | success |
intIdx | Core index (0-2 on PC, 0 on TGMmini) |
params | Pointer to GCODE_PARAMETERS structure, which will be filled with set values |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_StatusCNC | ( | int32_t | intIdx | ) |
Actual CNC module state.
Status | Description |
---|---|
0 | Undefined status after starting .EXE or G-code is not loaded or an error occurred during G-code loading. |
-2 | remote device not connected (TGM_MINI, TGM_REMOTE) |
-3 | sending compiled G-code to TGM_MINI or TGM_REMOTE, percent progress in GCodeIndex |
1 | Compilation in progress |
-1 | Compilation completed (OK or NOK) - if OK call ToolChainCore_ResetCNC then ToolChainCore_StartCNCEx |
10 | Simulation in progress |
-10 | Simulation completed (OK or NOK) - if OK call ToolChainCore_ResetCNC then ToolChainCore_StartCNCEx |
-11 | Simulation interrupted by ToolChainCore_StopCNCEx (on trajectory) |
20 | Test in progress |
-20 | Test completed (OK or NOK) |
-21 | Test interrupted by ToolChainCore_StopCNCEx (on trajectory) |
-30 | Start of trajectory (after calling ToolChainCore_ResetCNC or at the end of backward move) |
-31 | Stop on trajectory (interruption with ToolChainCore_StopCNCEx or after connecting or emptying the backing buffer) |
-32 | End of trajectory |
-33 | Stop on trajectory - waits on M0 function in the G-code |
30 | Forward run on trajectory |
31 | Forward run on trajectory without M functions |
32 | Backward run on trajectory |
33 | Forward run on trajectory without initial M functions (up to the first G function) |
40 | Calculation of connecting to trajectory |
41 | Connecting to trajectory |
50 | Manual movement |
-50 | Stands outside trajectory |
60 | Internal calculations are in progress |
70 | Sending of starting M functions in progress (ToolChainCore_StartCNCEx) |
80 | Sending of ending M functions in progress (ToolChainCore_StopCNCEx) |
90 | Sending connecting M funcs |
The return value is int32_t for compatibility with other programming languages. The CNC status is also returned by ToolChainCore_GetPos in the GM_PARAMS_ENHANCED structure, so there is no need to call this function if the ToolChainCore_GetPos is used.
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_GetPos | ( | int32_t | intIdx, |
int32_t | regime, | ||
SIMPLE_GM_PARAMS_WIN32 * | pos, | ||
GM_PARAMS_ENHANCED * | enhParams | ||
) |
Returns current position of machine axes together with additonal informations.
Error code | Description |
---|---|
-1 | parameter pos is nullptr |
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0 on TGMmini) |
0 | success |
intIdx | Core index (0-2 on PC, 0 on TGMmini) | ||||||||
regime | Regime from which we want to obtain values:
| ||||||||
pos | Pointer to SIMPLE_GM_PARAMS_WIN32 structure which will be filled with actual values. | ||||||||
enhParams | Pointer to GM_PARAMS_ENHANCED structure which will be filled with actual values. |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_CompileFromFile | ( | int32_t | intIdx, |
TGM_LPCTSTR | fileName | ||
) |
Compiles G-code from file.
Error code | Description |
---|---|
-1 | bad parametr fileName or compilation is in progress |
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0 on TGMmini) |
0 | success |
intIdx | Core index (0-2 on PC, 0 on TGMmini) |
fileName | Name of the G-code file (with full path) |
Compilation is done in a separate thread. Function ToolChainCore_StatusCNC can be used to detect whether compilation is finished. After that ToolChainCore_GetLastError must be called to test whether an error occurred. Only after that the sequence of ToolChainCore_ResetCNC and ToolChainCore_StartCNCEx can be called.
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_CompileFromMemory | ( | int32_t | intIdx, |
TGM_LPCTSTR | fileName, | ||
TGM_LPCSTR | mainCode | ||
) |
Compiles G-code from string in memory.
Error code | Description |
---|---|
-1 | bad parametr fileName or compilation is in progress |
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0 on TGMmini) |
0 | success |
intIdx | Core index (0-2 on PC, 0 on TGMmini) |
fileName | Optional name of the G-code file. Must not be nullptr. |
mainCode | G-code text in the form of ANSI string (UTF8). |
Compilation is done in a separate thread. Function ToolChainCore_StatusCNC can be used to detect whether compilation is finished. After that the ToolChainCore_GetLastError must be called to test whether an error occurred. Only after that the sequence of ToolChainCore_ResetCNC and ToolChainCore_StartCNCEx can be called.
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_IsBusy | ( | int32_t | intIdx | ) |
Checks if the machine is executing G-code.
intIdx | Core index (0-2 on PC, 0 on TGMmini) |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_StartCNCEx | ( | int32_t | intIdx, |
int32_t | regime, | ||
TGM_LPCSTR | strAddGCode | ||
) |
Start or continue G-code.
If the G-code is already started (in modes 30,31,32,33) and stopped with ToolChainCore_StopCNCEx, it can continue in modes 30, 31, 32. When modes 10 and 20 are interrupted, proceeding is only possible in the same mode. Before the first start or after completion of the whole trajectory ToolChainCore_ResetCNC must be called.
Error code | Description |
---|---|
-1 | Compilation is running or relevant mode cannot be launched (e.g. because the machine is in motion). |
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0 on TGMmini) |
0 | success |
intIdx | Core index (0-2 on PC, 0 on TGMmini) | ||||||||||||||
regime | Start regime:
| ||||||||||||||
strAddGCode | Pointer to the G-code text (ANSI string) that will be sent BEFORE the main G-code. All G-functions are ignored in this G-code, only M functions will be sent. Can be nullptr. |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_ResetCNC | ( | int32_t | intIdx, |
int32_t | regime, | ||
const uint32_t | nCoords, | ||
const double * | coords | ||
) |
Sets the initial position for G-code.
Error code | Description |
---|---|
-1 | one or more invalid parameters |
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0 on TGMmini) |
0 | success |
If there is any activity in progress, it is ended, i.e. compilation is interrupted, G-code is stopped and ended.
intIdx | Core index (0-2 on PC, 0 on TGMmini) |
regime | ---------— | -----------------— 1 | Only sets initial position for G-code, no setting of coordinates 10 | Setting of coordinates for simulation 20 | Setting of coordinates for testing Other values | Setting of coordinates for machine |
nCoords | Number of coordinates in coords array to be set. Unused axes will remain at its actual values. Could be zero and coords set to nullptr, then actual values of all the axes are used. |
coords | Coordinates 0 - X, 1 - Y, 2 - Z, 3 - C, 4 - B, 5 - U, 6 - V, 7 - W, 8 - A, 9 - O |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_StopCNCEx | ( | int32_t | intIdx, |
TGM_LPCSTR | strAddCode | ||
) |
Stops motion or connecting (break).
After stopping it sends the defined G-code (only M function), unless backward move (32) or running without M functions (31) is in process. The sending can only be cancelled only by function ToolChainCore_ResetCNC. After that the process can go on, i.e. ToolChainCore_StartCNCEx or finish by ToolChainCore_ResetCNC functions or connect to a trajectory by ToolChainCore_ConnectCNCEx_Plane.
Error code | Description |
---|---|
-1 | Machine not in motion, the function has no sense |
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0 on TGMmini) |
0 | success |
intIdx | Core index (0-2 on PC, 0 on TGMmini) |
strAddCode | Pointer to the text of G-code (ANSI string) that will be sent after machine stops. Only M functions are sent, G-functions are ignored. Can be nullptr, then no additional M funcions are sent. |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_ConnectCNCEx_Plane | ( | int32_t | intIdx, |
int32_t | nType, | ||
const uint32_t | nCoords, | ||
const double * | coords, | ||
TGM_LPCSTR | strAddCode, | ||
uint32_t | bitCodedAxesForCalc, | ||
uint32_t | bitCodedAxesForConnect, | ||
int32_t | trajectoryStateAfterConnect | ||
) |
Move to the nearest point of trajectory of G-code with possibility of M function insertion after the connection movement.
Error code | Description |
---|---|
-1 | Invalid parameter coords or calling is impossible in the given status, e.g. compilation is running or machine is moving |
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0 on TGMmini) |
0 | success |
intIdx | Core index (0-2 on PC, 0 on TGMmini) |
nType | connection type (see also enum connect_type)
|
nCoords | number of coordinates in the coords array (may even be 0 - for the connection type 0 or 10, after that the current machine position will be used) |
coords | array of coordinates. Meaning of the values vary with the type of connection. See enum connect_type. |
strAddCode | pointer to the G-code text (ANSI string) that will be sent BEFORE the main G-code. All G-functions are ignored in this G-code, only M functions will be sent. |
bitCodedAxesForCalc | bit coded value for connection distance calculation, maximum of three axes is allowed, if more, the first three set will be used.
|
bitCodedAxesForConnect | Determines which axes are moved to the connection point after the calculations.
|
trajectoryStateAfterConnect | if zero, the state will be set automatically (either on trajectory or out of trajectory), otherwise determines the CNC status after connect. Use with care, if the status is wrong after connection, the system may not start movement. The value of 0 is recommended. |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_GoToPosition | ( | int32_t | intIdx, |
const uint32_t | nCoords, | ||
const double * | coords | ||
) |
Manual control.
Moves axes to desired position. Movement parameters (speed + acceleration) are defined using ToolChainCore_SetGCodeParameters
Error code | Description |
---|---|
-1 | Error - machine is in motion |
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0 on TGMmini) |
0 | success |
intIdx | core index (0-2 on PC, 0 on TGMmini) |
nCoords | number of coordinates in the coords array |
coords | wanted coordinates 0 - X, 1 - Y, 2 - Z, 3 - C, 4 - B, 5 - U, 6 - V, 7 - W, 8 - A, 9 - O |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_GoToPositionEx | ( | int32_t | intIdx, |
const SIMPLE_GM_PARAMS_WIN32 * | pDest | ||
) |
Extended manual control.
Moves axes to desired position by linear or arc movement.
Error code | Description |
---|---|
-1 | Error - machine is in motion |
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0 on TGMmini) |
0 | success |
intIdx | core index (0-2 on PC, 0 on TGMmini) |
pDest | specifies end position, type of trajectory and optional feed. The following fields of the SIMPLE_GM_PARAMS_WIN32 structure are used:
|
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_MFunc | ( | int32_t | intIdx, |
const SIMPLE_GM_PARAMS_WIN32 & | fun, | ||
int32_t | bDirectToPLC | ||
) |
Send M function directly to system.
Invoke PLC's M function. The interpolator must be in a stop state. Application must wait for M function finish by reading INTERPOLATOR::M_Func variable.
Error code | Description |
---|---|
-1 | Error - machine is in motion or previous M function is pending |
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0 on TGMmini) |
0 | success |
intIdx | core index (0-2 on PC, 0 on TGMmini) |
fun | Function number to be used. Only SIMPLE_GM_PARAMS_WIN32::m_func field is used (M function number). |
bDirectToPLC | reserved, now internally set to 1 (i.e. the M fucntion is always directly signalized to PLC) |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_FileToIdx | ( | int32_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.
When using CNC module in real-time TGMotion, maximal number is 16. The inverse function is ToolChainCore_IdxToFile. Length of filename must be less than 252 characters.
fileName | returned value |
---|---|
"__unknown__" | -1 |
"__end__" | -2 |
"__stop__" | -3 |
"__exec__" | -4 |
intIdx | core index (0-2 on PC, 0 on TGMmini) |
fileName | complete path to file. UNICODE on PC, ANSI on TGMmini |
TOOLCHAIN_DLL_EXPORT TGM_LPCTSTR TOOLCHAIN_CALLTYPE ToolChainCore_IdxToFile | ( | int32_t | intIdx, |
int32_t | fileIdx | ||
) |
Returns the complete filename of file with relevant number (index).
fileIdx | returned string |
---|---|
-1 | "__unknown__" |
-2 | "__end__" |
-3 | "__stop__" |
-4 | "__exec__" |
intIdx | core index (0-2 on PC, 0 on TGMmini) |
fileIdx | File name index (e.g. from SIMPLE_GM_PARAMS_WIN32 structure) |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_SetRelFeed | ( | int32_t | intIdx, |
double | relFeed | ||
) |
Sets the feed override (relative speed).
Error code | Description |
---|---|
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0 on TGMmini) |
0 | success |
intIdx | core index (0-2 on PC, 0 on TGMmini) |
relFeed | Relative feed value in range 0.001 - 2.0. (i.e. 0.1 % - 200 %). Invalid values are rounded to above boundaries. |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_SetCallBack | ( | int32_t | intIdx, |
int32_t | fceNo, | ||
intptr_t | dwUserData, | ||
FuncPrototype * | funcPtr | ||
) |
Sets callback function.
Callbacks are way of reverse communication from CNC module back to application. Some callbacks are available only in LOCAL_CORE_MODE_DLL (see DLL_INIT_STRUCT). The list of all availabel callback function is here.
Error code | Description |
---|---|
-1 | invalid fceNo value |
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0 on TGMmini) |
0 | callback function set |
intIdx | core index (0-2 on PC, 0 on TGMmini) |
fceNo | callback function number |
dwUserData | any user value which will be passed to the callback function |
funcPtr | pointer to function (casted to general function prototype) |
fceNo
greater than 1000 (APP_MaxFuncNumber) the ToolChainCore_SetCallBack function only can be called after ToolChainCore_LoadFromIni. TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_GetLastError | ( | int32_t | intIdx, |
CALLBACK_INFO * | pLastErrorInfo | ||
) |
Returns the last error, if any.
There is also possibility to register callback function DispAndLocateErrorFunc for immediate notify of an error.
Error code | Description |
---|---|
-1 | invalid parameter lastErrorInfo |
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0 on TGMmini) |
0 | success (there was no error, compilation or runtime - members of pLastErrorInfo structure are not set) |
1 | xexec error (runtime error) |
2 | xbreak error (interruption by user) |
intIdx | core index (0-2 on PC, 0 on TGMmini) |
pLastErrorInfo | Pointer to structure CALLBACK_INFO with returned error information (for return values 1 or 2) |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_SetBreakpoint | ( | int32_t | intIdx, |
uint32_t | editorLine, | ||
int32_t | fileIdx | ||
) |
Set breakpoint in the G-code.
The run stops just BEFORE the G-code part on the gived editor line
Error code | Description |
---|---|
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0 on TGMmini) |
0 | success |
intIdx | core index (0-2 on PC, 0 on TGMmini) |
editorLine | Line number, execution stops before this line |
fileIdx | File index, can be get by ToolChainCore_FileToIdx |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_GetGCodeSizeInfo | ( | int32_t | intIdx, |
GCODE_INFO * | pInfo | ||
) |
Identifies size (dimension) of G-code.
Error code | Description |
---|---|
-1 | invalid parameter pInfo |
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0 on TGMmini) |
0 | OK |
intIdx | core index (0-2 on PC, 0 on TGMmini) |
pInfo | pointer to GCODE_INFO, which will be filled with the size values |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_GetStructuresSize | ( | int32_t | intIdx, |
uint32_t | nItems, | ||
uint32_t * | items | ||
) |
Returns bytes sizes of internal structures.
Relevant to checking of DLL versions and the main application.
intIdx | core index (0-2 on PC, 0 on TGMmini) | ||||||||||||||||||
nItems | number of items in items array, in the range 1 - 7. | ||||||||||||||||||
items | pointer to array filled with following values:
|
TOOLCHAIN_DLL_EXPORT TGM_LPCTSTR TOOLCHAIN_CALLTYPE ToolChainCore_GetVersionString | ( | int32_t | intIdx | ) |
Returns the DLLs version number and the date and time of compilation.
intIdx | core index (0-2 on PC, 0 on TGMmini) - ignored in this function |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_GetMachineParameters | ( | int32_t | intIdx, |
MACHINE_PARAMETERS * | pParameters | ||
) |
Returns actual values of MACHINE_PARAMETERS.
Error code | Description |
---|---|
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0 on TGMmini) |
-1 | timeout |
0 | success |
intIdx | core index (0-2 on PC, 0 on TGMmini) |
pParameters | pointer to MACHINE_PARAMETERS structure, will be filled with actual values |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_SetMachineParameters | ( | int32_t | intIdx, |
const MACHINE_PARAMETERS * | pParameters | ||
) |
Sets new values of MACHINE_PARAMETERS.
Error code | Description |
---|---|
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0 on TGMmini) |
-1 | timeout |
0 | success |
intIdx | core index (0-2 on PC, 0 on TGMmini) |
pParameters | pointer to MACHINE_PARAMETERS structure with new values |
TOOLCHAIN_DLL_EXPORT int32_t TOOLCHAIN_CALLTYPE ToolChainCore_LoadCNCCalcPlugIn | ( | TGM_LPCTSTR | fileName, |
uint32_t | loadFlags, | ||
int64_t | userValue | ||
) |
Load CNC Calc plugin (see CNC Calc plug-in exported functions)
After successful call of this function, the CNC status is set to cnc_status::statusINVALID and the G-code must be loaded again.
fileName | Complete path of the plug-in file (.DLL or .so). If empty null-terminated string, unloads the plug-in. | ||||||||
loadFlags | Additional load flags:
| ||||||||
userValue | This value will be copied to CNC_CALC_INIT_DATA::userValue. Application can store here any value, pointer, etc. During call of CNC_Calc_Load function, the CNC Calc plugin can store this value and use it for any purpose. |
Error code | Description |
---|---|
-1 | Any error. See note below. |
1 | Success |