![]() |
TG Motion
version 502 - 4034/906 cnc 126
|
Functions | |
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... | |
The following functions are exported from SF_TCh_5.dll or libSF_TCh_5.so dynamic libraries.
void ToolChain_LogANSI | ( | TGM_LPCSTR | info | ) |
Append the string to the log file.
info | String to be added, always ANSI |
int32_t ToolChainCore_CompileFromFile | ( | uint32_t | intIdx, |
TGM_LPCTSTR | fileName | ||
) |
Compiles G-code from file.
Error code | Description |
---|---|
-1 | bad parameter fileName or compilation is in progress |
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0-1 on TGMmini) |
0 | success |
intIdx | Core index (0-2 on PC, 0-1 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.
int32_t ToolChainCore_CompileFromMemory | ( | uint32_t | intIdx, |
TGM_LPCTSTR | fileName, | ||
TGM_LPCSTR | mainCode | ||
) |
Compiles G-code from string in memory.
Error code | Description |
---|---|
-1 | bad parameter fileName or compilation is in progress |
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0-1 on TGMmini) |
0 | success |
intIdx | Core index (0-2 on PC, 0-1 on TGMmini) |
fileName | Optional name of the G-code file. Must not be nullptr. |
mainCode | G-code text in the form of ANSI string. |
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.
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.
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-1 on TGMmini) |
0 | success |
intIdx | Core index (0-2 on PC, 0-1 on TGMmini) |
nType | connection type (see also enum cnc::connect_type)
|
nCoords | number of coordinates in the coords array (may 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 cnc::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. Can be nullptr or empty string. |
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.
|
trajectoryStateAfterConnectRequest | if zero, the state will be set automatically (either on trajectory or out of trajectory), if set to 2, the status out of trajectory will be reported. Other values are invalid, and the function returns an error without performing any action. |
int32_t ToolChainCore_DestroyCNC | ( | uint32_t | intIdx | ) |
Finishes work with DLLs and frees all the allocated memory.
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-1 on TGMmini) |
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.
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-1 on TGMmini) |
fileName | complete path to file. UNICODE on PC, ANSI on TGMmini |
int32_t ToolChainCore_GCodePrefixPostfix | ( | uint32_t | intIdx, |
TGM_LPCSTR | strPrefix, | ||
TGM_LPCSTR | strPostfix | ||
) |
intIdx | |
strPrefix | |
strPostfix |
int32_t ToolChainCore_GetGCodeParameters | ( | uint32_t | intIdx, |
cnc::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-1 on TGMmini) |
params | Pointer to cnc::GCODE_PARAMETERS structure, which will be filled with set values |
float64_t ToolChainCore_GetGCodeRunTime | ( | uint32_t | intIdx, |
int32_t | fileIdx | ||
) |
intIdx | |
fileIdx |
int32_t ToolChainCore_GetGCodeSizeInfo | ( | uint32_t | intIdx, |
cnc::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-1 on TGMmini) |
0 | OK |
intIdx | core index (0-2 on PC, 0-1 on TGMmini) |
pInfo | pointer to cnc::GCODE_INFO, which will be filled with the size values |
int32_t ToolChainCore_GetLastError | ( | uint32_t | intIdx, |
cnc::CALLBACK_INFO * | pLastErrorInfo | ||
) |
Returns the last error, if any.
There is also possibility to register callback function cnc::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-1 on TGMmini) |
0 | success (there was no error, compilation or runtime - members of pLastErrorInfo structure are not set) |
1 | xexec error (runtime error) |
intIdx | core index (0-2 on PC, 0-1 on TGMmini) |
pLastErrorInfo | Pointer to structure cnc::CALLBACK_INFO with returned error information (for return values 1 or 2) |
|
noexcept |
Get actual log value set by INI file or by ToolChainCore_SetLogValue()
int32_t ToolChainCore_GetMachineParameters | ( | uint32_t | intIdx, |
cnc::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-1 on TGMmini) |
-1 | timeout |
0 | success |
intIdx | core index (0-2 on PC, 0-1 on TGMmini) |
pParameters | pointer to cnc::MACHINE_PARAMETERS structure, will be filled with actual values |
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.
Error code | Description |
---|---|
-1 | parameter pos is nullptr |
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0-1 on TGMmini) |
0 | success |
intIdx | Core index (0-2 on PC, 0-1 on TGMmini) |
reserved | Not used |
pos | Pointer to cnc::ACTUAL_GM_VALUES structure which will be filled with actual values. |
int32_t ToolChainCore_GetStructuresSize | ( | uint32_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-1 on TGMmini) - not used here | ||||||||||||||||||||
nItems | number of items in items array, in the range 1 - 8. | ||||||||||||||||||||
items | pointer to array filled with following values:
|
TGM_LPCTSTR ToolChainCore_GetVersionString | ( | uint32_t | intIdx | ) |
Returns the DLLs version number and the date and time of compilation.
intIdx | core index (0-2 on PC, 0-1 on TGMmini) - ignored in this function |
int32_t ToolChainCore_GoToPosition | ( | uint32_t | intIdx, |
const uint32_t | nCoords, | ||
const float64_t * | 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-1 on TGMmini) |
0 | success |
intIdx | core index (0-2 on PC, 0-1 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 |
int32_t ToolChainCore_GoToPositionEx | ( | uint32_t | intIdx, |
const cnc::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-1 on TGMmini) |
0 | success |
intIdx | core index (0-2 on PC, 0-1 on TGMmini) |
pDest | specifies end position, type of trajectory and optional feed. The following fields of the cnc::SIMPLE_GM_PARAMS_WIN32 structure are used:
|
TGM_LPCTSTR ToolChainCore_IdxToFile | ( | uint32_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-1 on TGMmini) |
fileIdx | File name index (e.g. from cnc::SIMPLE_GM_PARAMS_WIN32 structure) |
int32_t ToolChainCore_Init | ( | const cnc::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 cnc::DLL_INIT_STRUCT with initialization parameters |
int32_t ToolChainCore_IsBusy | ( | uint32_t | intIdx | ) |
Checks if the machine is executing G-code.
intIdx | Core index (0-2 on PC, 0-1 on TGMmini) |
int32_t 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::cnc_status::INVALID_00 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 | Reserved for future use |
userValue | This value will be copied to cnc::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 |
int32_t ToolChainCore_LoadFromIni | ( | uint32_t | intIdx, |
TGM_LPCTSTR | iniFile, | ||
uint32_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-1 on TGMmini) |
iniFile | Full path of the .INI file |
pnMaxCores | Pointer to variable which receives number of available cores in the system, can be nullptr |
Call this function at the application startup
int32_t ToolChainCore_MFunc | ( | uint32_t | intIdx, |
const cnc::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-1 on TGMmini) |
0 | success |
intIdx | core index (0-2 on PC, 0-1 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) |
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.
Error code | Description |
---|---|
-1 | one or more invalid parameters |
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0-1 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-1 on TGMmini) |
regime | ---------— | -----------------— 1 | Only sets initial position for G-code, no setting of coordinates 10 | Setting of coordinates for simulation (not yet implemented) 20 | Setting of coordinates for testing (not yet implemented) 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 |
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.
Can be called only if CNC status is a negative number.
intIdx | core index (0-2 on PC, 0-1 on TGMmini) | ||||||
mode | allowed modes:
|
Error code | Description |
---|---|
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0-1 on TGMmini) |
-1 | The CNC module is in motion state |
0 | success |
int32_t ToolChainCore_SetBreakpoint | ( | uint32_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-1 on TGMmini) |
0 | success |
intIdx | core index (0-2 on PC, 0-1 on TGMmini) |
editorLine | Line number, execution stops before this line |
fileIdx | File index, can be get by ToolChainCore_FileToIdx |
int32_t ToolChainCore_SetCallBack | ( | uint32_t | intIdx, |
uint32_t | fceNo, | ||
intptr_t | dwUserData, | ||
cnc::FuncPrototype * | funcPtr | ||
) |
Sets callback function.
Callbacks are way of reverse communication from CNC module back to application. The list of all available 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-1 on TGMmini) |
0 | callback function set |
intIdx | core index (0-2 on PC, 0-1 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. int32_t ToolChainCore_SetGCodeParameters | ( | uint32_t | intIdx, |
const cnc::GCODE_PARAMETERS * | params | ||
) |
Sets parameters (properties) of G-code.
Calling is possible also during G-code interruption ToolChainCore_StopCNCEx, but only some fields of cnc::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 changed at this moment (machine is in motion) |
0 | success |
intIdx | Core index (0-2 on PC, 0-1 on TGMmini) |
params | Pointer to cnc::GCODE_PARAMETERS structure with desired parameters |
int32_t ToolChainCore_SetGCodeRunTime | ( | uint32_t | intIdx, |
int32_t | fileIdx, | ||
float64_t | timeInS | ||
) |
Set runtime of the G code.
intIdx | |
fileIdx | |
timeInS |
|
noexcept |
Set new log value directly to CNC module.
logValue | bit-coded value to set what information is logged and where. Bits can be anyhow combined. At least on of the Output bit (see the table) must be set to produce any output. The logging is common for all the CNC cores. |
Bit value | Description |
---|---|
0x00000001 | Debug mode - generates helper debug files to analyze G-code processing |
0x00000002 | Verbose - increases number of information sent to Log and/or debug files |
0x00000004 | Worker - info from SF_XYZWorker_5 library |
0x00000008 | ToolChain - info from the main SF_TCh_5 library |
0x00000010 | Driver - info from the SF_RTDrv_5 library |
0x00000020 | Compiler - info from G-code analyzer and compiler SF_DComp_5 library |
0x00000040 | Exec - info from executor SF_DExec_5 library |
0x00000080 | Math - info from tool compensation calculator SF_XYZMath_5 library |
0x10000000 | Output to DebugView - send information to DbgView (Windows) or console (Linux) |
0x20000000 | Output to File - send information to log file (usually in log subdirectory) |
0x40000000 | Output to TGMotion - send information to TGMotion Debug Console |
int32_t ToolChainCore_SetMachineParameters | ( | uint32_t | intIdx, |
const cnc::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-1 on TGMmini) |
-1 | timeout |
0 | success |
intIdx | core index (0-2 on PC, 0-1 on TGMmini) |
pParameters | pointer to cnc::MACHINE_PARAMETERS structure with new values |
int32_t ToolChainCore_SetRelFeed | ( | uint32_t | intIdx, |
float64_t | relFeed | ||
) |
Sets the feed override (relative speed).
Error code | Description |
---|---|
-2 | intIdx parameter out of range (must be 0-2 on PC, only 0-1 on TGMmini) |
0 | success |
intIdx | core index (0-2 on PC, 0-1 on TGMmini) |
relFeed | Relative feed value in range 0.001 - 2.0. (i.e. 0.1 % - 200 %). Invalid values are rounded to above boundaries. |
int32_t ToolChainCore_SetUserParams | ( | uint32_t | intIdx, |
const float64_t * | userParams, | ||
uint32_t | userParamsCount | ||
) |
Set parameters P00 - P99 for use in G-code.
intIdx | core index (0-2 on PC, 0-1 on TGMmini) |
userParams | array of 100 float64_t parameters |
userParamsCount | must be 0 - do not use the parameters or 100. Other values are invalid. |
int32_t ToolChainCore_StartCNCEx | ( | uint32_t | intIdx, |
cnc::cnc_status | 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-1 on TGMmini) |
0 | success |
intIdx | Core index (0-2 on PC, 0-1 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. |
cnc::cnc_status ToolChainCore_StatusCNC | ( | uint32_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) |
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 CNC status is also returned by ToolChainCore_GetPosEx in the cnc::ACTUAL_GM_VALUES structure, so there is no need to call this function if the ToolChainCore_GetPosEx is used.
int32_t ToolChainCore_StopCNCEx | ( | uint32_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 canceled 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-1 on TGMmini) |
0 | success |
intIdx | Core index (0-2 on PC, 0-1 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 functions are sent. |