Skip to content

How to Develop a TMcraft Node

Table of Contents

Examples are valid for:

TMflow Software version: 2.14 or above.

TM Robot Hardware version: Only support HW3.2 or above

Other specific requirements: None

Note that older or newer software versions may have different results.

 

TMcraft node is customized Node UI Program, a C# + WPF-based execution file (exe) developed by 3rd party. The Program can interacts with TMflow through TMcraft API to do actions, such as creating or modifying project variables, creating or modifying points, setting I/O, jogging the robot, etc. Before the Node UI is closed, the program can transform the settings into TMscript and write it into the Flow Project.

For security issues, developers cannot just put an exe file onto TMflow; instead, they have to develop and build the Node UI into a User Control Library ( DLL file ) first. Through the TMcraft-Build on TMstudio Pro, this User Control Library is then built as an execution file and zipped with other resources (such as libraries, media, etc.). Finally, import this zipped file to TMflow, this TMcraft Node can be used on Flow project after enabling.

What is TMcraft API #

TMcraft API is an interface layer that connects TMcraft Node with TMflow to get all sorts of robot/project information and request TMflow to take different actions or generate scripts for the project run. In addition, this API is an actual Dynamic Link Library file (DLL) for users to add as one of the program dependencies and to use the functions within to interact with TMflow.

 

TMcraft.dll has four parts: ITMcraftNodeEntry, Providers, Info and ENUMs.

 

  1. ITMcraftNodeEntry is the essential part of the API to establish the connection between the Node and TMflow (i.e. InitializeNode()).The rest of the API functions are not available without this connection.
  2. Providers are a set of classes with functions associated with different interactions with TMflow frequently used among the Programs.
  3. Info is a collection of classes, such as BaseInfo, PointInfo, and VariableInfo, used by different types of Provider functions.
  4. ENUM are value types defined by a set of named constants of the underlying integral numeric type, including: IO_TYPE, VariableType, FreeBotModes, RobotEventType and TMflowType.

Also, TMcraft API includes a few member functions: Close(), GetErrMsg(), and Version. Refer to the TMcraft Node API function manual for details.

 

Here is the simplest sample code of a TMcraft Node.

TMcraft Node Code Example

Please download sample script from here

 

This sample can be defined as the following parts:

  1. Add TMcraft.dll as a reference (using TMcraft).
  2. Implement the Interface ITMcraftNodeEntry to the User Control class. This interface has two members that require implementation, InitializeNode() and InscribeScript().
  3. InitializeNode() would be activated once opened the Node UI, which connects the Node with TMflow; technically, this makes the TMcraftNodeAPI object (TMNodeEditor) available for calling all TMcraft functions, such as DataStorageProvider.SaveData().
  4. InscribeScript() would activate when the Node UI is closed, and developers should define what TMscript would implement to the flow project using ScriptWriteProvider functions.
  5. The rest of the program should be all sorts of event functions that could interact with TMflow through TMcraft functions.

 

For more details on developing, please refer to tutorials and sample codes of the TMcraft Development Kit.

Powered by BetterDocs