KMotion Libraries - GCode Interpreter - Trajectory Planner - Coordinated Motion - .NET
Building the KMotion Libraries
To build the KMotion Libraries:
- Install Microsoft Visual Studio Community 2015 (include MFC option)
- Open BuildAllLibs.sln Solution from root directory of KMotion Installation
- Select Release or Debug Configuration as desired
- Select Build | Build Solution
- new Library .DLLs and .EXEs will reside in the root\KMotion\Release or Debug folder
C++ Library that facilitates and coordinates all the communication to KFLOP. It contains the CKMotionDLL class which provides the multi-process, multi-thread, multi-board access to KFLOP using a Client/Server approach. It also creates and instance of the Coordinated Motion Class and GCode Interpreter Classes.
C++ Library that facilitates Trajectory Planning, Coordinated Motion, Motion Buffering, and GCode. It contains the CCoordMotion and CGCodeInterpreter classes.
The GCode Interpreter has a method of invoking generalized "Actions". Actions can be invoked from MCodes, S Words, User Defined Buttons, or Special Actions. The Actions performed can be various operations such as changing the states of one or two I/O Bits, writing a Speed value to a DAC, Invoking a User C Program in KFLOP, Invoking a PC Program, Application Callback, or Executing GCode.
The MCODE_TYPE defines what type of Action to perform. It is not related to an MCode Number. An Action consists of an MCODE_TYPE and several parameters (numeric and a string). The number and purpose of the parameters vary depending on the MCODE_TYPE.
The Interpreter allows you to configure about 30 MCodes to perform Actions. Several MCodes such as M0 (stop) and M30 (stop/rewind) have Interpreter functionality, but can also perform an additional Action. 20 MCodes (100-119) are for User use.
The Interpreter's 'S' word can also invoke an Action.
The KMotionCNC Application also uses Actions assigned to custom User Buttons and to "Special Actions" that are executed on operations such as Application Startup. All Actions are stored in an array and referenced by the index into the array (not necessarily the MCode number). See the chart below.
KMotionCNC allows the MCode Actions to be configured in its Tool Setup. See here and here.
From .NET you can configure the Action Array using the KM_Interpreter.SetMcodeAction Method. Note the Array Index does not necessarily equal the MCode Number.
After the Action Array in the Interpreter is configured any executed MCode (or S) will perform the configured Action.
Note that MCodes can also set GCode Parameters (PQR words) into KFLOP persist variables. This is described here.
This Forum Thread may also help.
GCode Action Table
The GCode Interpreter contains a Table of Actions:
- MCODE_ACTION McodeActions[MAX_MCODE_ACTIONS];
An Action is defined by an action code and several parameters (several numeric and a string parameter).
The Actions are packed into a contiguous array of actions. When configuring the Actions from an Application the Array Index is used. When Invoking the Action the Action # is used. See the table below for the relationship.
The KMotion Libraries are accessible from Programming environments that support .NET (ie C#, VB, Labview, etc.). The .NET interface allows a single reference to KMotion dotNet.dll to pull in all the available functionality of the library and permit support for things like Auto Complete and type/parameter checking.
On-line html based .NET Library help files are available here.
A Help File Based description of the KMotion dotNet functionality is available here
(note when downloading help files some Operating Systems may require the file to be unblocked in its properties to work fully). See Below: