VisualBasic macro

Mach3 has a built in macro/scripting engine based on a product called Cypress ENABLE. The scripting engine let’s you edit the standard M-codes but also enables you to create custom M-codes that can be called from your G-code. A typical example is modifying the M6 macros to operate an automatic toolchanger.

Another use of the scripting engine is the button scripts. Behind some of the buttons on the Mach3 screen there’s a macro which is run when you click that button (the RefAll button being one of them). Those macros can be changed to work different from what they do out-of-the-box. The RefAll button for example can be changed so that the axis home’s in a different order or even all at the same time. It’s also quite easy to add your own buttons and embedd macros in them to do custom things.

The macros can be created and edited with any standard texteditor, like Notepad for example, but Mach3 has a built in editor with nice features like syntax colouring, sngle stepping and breakpoints which can be a big help when writing, testing and debugging complex macros. The editor may not look “much” compared to modern IDE’s (Integrated Development Enviroment) but it does what can be expected of it. 

Besides all the commands in the CYPRESS ENABLE language Mach3 has a quite a few commands  that are callable from the macros. These commands can be used to read values from the various DRO’s (GetDRO), check status of Mach3’s LED’s (GetLED) and tell Mach3 to move the machine to a certain position (Code “G0 X10”) among a lot of other things.

source: [http://www.henriksplace.se] On CS-Lab website you can download standard scripts for handling automatic measurement of tool-length and for automatic tool replacement. These are usually the most desirable functions and make the work easier. For advanced users we invite to learn more about macros, which provide great opportunities for self-expanding functionality of Mach3 program.

12 January 2016