KMotion Libraries - GCode Interpreter - Trajectory Planner - Coordinated Motion - .NET

Revision as of 15:35, 17 October 2019 by Sascha F Zeller (Talk | contribs)

Building the KMotion Libraries

To build the KMotion Libraries:

  1. Install Microsoft Visual Studio Community 2015 (include MFC option)
  2. Open BuildAllLibs.sln Solution from root directory of KMotion Installation
  3. Select Release or Debug Configuration as desired
  4. Select Build | Build Solution
  5. new Library .DLLs and .EXEs will reside in the root\KMotion\Release or Debug folder


KMotionDLL.dll

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.

GCodeInterpreter.dll

C++ Library that facilitates Trajectory Planning, Coordinated Motion, Motion Buffering, and GCode.  It contains the CCoordMotion and CGCodeInterpreter classes.


GCode Actions

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.

Index Description Action#
0 M0 0
1 M1 1
2 M2 2
3 M3 3
4 M4 4
5 M5 5
6 M6 6
7 M7 7
8 M8 8
9 M9 9
10 S 10
11 User But0 11
12 User But1 12
13 User But2 13
14 User But3 14
15 User But4 15
16 User But5 16
17 User But6 17
18 User But7 18
19 User But8 19
20 User But9 20
21 M100 100
22 M101 101
23 M102 102
24 M103 103
25 M104 104
26 M105 105
27 M106 106
28 M107 107
29 M108 108
30 M109 109
31 M110 110
32 M111 111
33 M112 112
34 M113 113
35 M114 114
36 M115 115
37 M116 116
38 M117 117
39 M118 118
40 M119 119
41 M30 24
42 Cycle Start 25
43 Halt 26
44 Stop 27
45 FeedHold 28
46 Resume 29
47 Prog Start 30
48 ProgExit 31

KMotion_dotNet.dll

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:

Unblock Help File.png
Last modified on 17 October 2019, at 15:35