You can use the code in this sample project to build plugins to connect a machine tool to STEP-NC machine. Your plugin will be called to get position information when you are tracking position with the CNC window. You can modify the SamplePlugin project or create a new project with the following:

  1. Make a new .NET class library project. Use the 2.0 Framework and add a reference to stepnc_plugin.dll, which is in the root directory of the sample project. It is also in the STEP-NC Machine installation.
  2. Create a new class that inherits from ICNCPlugin. Right click on the ICNCPlugin word and select "Implement Interface" to get the functions you will implement.

Write code to connect to your machine tool, return the current X/Y/Z coordinates, the current block number, and a few others. The TestForm project makes a simple dialog that continually calls your DLL and shows the values returned.

When you are happy, copy your DLL to the "plugins" directory under the STEP-NC Machine installation. Click on the "Configure" button above and the settings dialog will show a list of available plugins to pick from. The plugin will be remembered and loaded whenever you run STEP-NC Machine.

Plugin Functions

The ICNCPlugin interface defines a few functions for you to implement and the sample project gives you an example to work from. The functions are:

Sample Project

The plugin sample project contains an example DLL that you can modify and a simple dialog window that you can use for testing the plugin. Double click on "sample.sln" to begin.

The SamplePlugin project creates the plugin DLL. When asked for block number, it simply increments a counter and returns the number. When asked for position, the example will move around the four corners of a square.

The TestForm project is a simple dialog window that calls the plugin several times a second and displays the results. You can use this for testing your own plugin before you add it to STEP-NC Machine. The first time you compile the solution, you may need to right-click on the project and select "Set as Startup Project" to tell Visual Studio to run the test form.