Getting started with JavaScript macros in OpenBuilds Control

OpenBuilds Control is a free to use application that allows you to connect and control a grbl based CNC router, laser, plasma or dragknife machine. The application is easy to use and targeted towards the beginner. It has a ton of functionality built in, including wizards for surfacing your spoilboard and calibrating your axis steps, as well as probing routines to help set up your jobs quickly and accurately. Control’s default functionality is more than enough for most use cases, but what if you want to customize a menu item or have a need for your own wizard for a specific job setup? That’s where JavaScript macros come in.

Overview

OpenBuilds Control macros come in two flavors; gcode and JavaScript. Gcode macros, as the name implies, are strictly for sending gcode to your controller. JavaScript macros on the other hand allow you to inject JavaScript functions into the app and even replace entire functions with custom code.

Adding JavaScript macros are added using the add macro functionality in the Macros tab. Simply add a new macro, give it a name, click on the JavaScript tab, add your code and save. It couldn’t be easier. The tricky part obviously is writing and debugging the code.

Debugging

Since Control is a web-based app, press Ctrl + Shift + i to bring up the inspection panel. From there you can paste your JavaScript code directly into the console and look for any errors. I find this easier than editing the macro directly. Once I know my JavaScript is working as expected, I’ll create a macro for it.

I wont go into how to debug JavaScript here, but here are a few references. First, check out the Backend Devtools section of the Control wiki: https://github.com/OpenBuilds/OpenBuilds-CONTROL/wiki/3.–Backend-Devtools

Also, Chrome DevTools has a built in debugger. You can learn more about that here: https://developers.google.com/web/tools/chrome-devtools/javascript

You can’t right click in the Control app, so if you need to inspect a specific element, the easiest thing to do is open up a browser and go to:

http://localhost:3000

Coming Soon

In the coming weeks, I’ll be releasing videos on how to use OpenBuilds Control macros to add dialog boxes, wizards and menu items. In the meantime, check out this quick video on how to hide the Z jog buttons when the 100mm step size is active.

OpenBuilds Control can be downloaded here.


OpenBuilds Products I Use (affiliate):

OpenBuilds Control​
Workbee 1510​
BlackBox Motion Controller​
Interface CNC Touch Controller​
Router11
XYZ Touch Probe Plus

Tags:
0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*

©2021 Thayne Co

CONTACT ME

I'm not around right now. But you can send me an email and I'll get back to you, asap.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account