Attention Mastercam C# and VB.NET Programmers
If you are a Mastercam Third Party programmer, or you dabble in .NET programming, you may be interested to know about our new Mastercam NETHook templates for Visual Studio 2010 and Visual Studio 2010 Express Edition. NETHooks allow you to extend and/or automate some of your Mastercam functionality using the .NET programming language.
This NETHook template will help you set up new projects with the necessary function calls and resources to create a custom NETHook. Every time you create a new NETHook you have to implement the same functions call and resources over and over. This template does it all for you, eliminating the redundancy. It also includes a resource file with icons, which can be used to create MC toolbar buttons.
The steps below will walk you through how to use the new Mastercam X5 C# Project Template. (Please note that you can click on the illustrations to bring up larger images. Then click your browser Back button to return to the blog.)
3. Check to make sure that the reference to Mastercam NETHook API is valid; if it is broken you will see a yellow icon with an exclamation mark. If this is the case, delete the reference and add a new reference. Browse to your Mastercam installation folder and select the NETHook2_0.dll.
7. A resource file is also created. This file contains 4 images for toolbar buttons; one for small image and the other for large image, and a string table containing two strings used for toolbar button tooltips.
9. We are now ready to compile our NETHook. Select Build / Build Solution from Visual Studios menu. The project should build successfully and create your NETHook and export a copy of your Function Table.
12. Launch Mastercam and select the Settings / Customize menu to display the dialog as shown and select NETHook from the category (this corresponds with the Category section of your function table) and you will see your two icons.
13. Drag and drop each icon onto the Mastercam toolbar area to create a new toolbar.
You have now successfully created a Mastercam X5 C# NETHook! You can download the templates below: