hey peter. any way to inspect a specific element quickly? I'm used to doing it with a right click which is disabled in control.
Fire up localhost:3000 in a browser, when you are outside of the Electron window, the normal devtools work again
Updated the code above so that the macro cant run twice (adds a hidden div on first run) and added a dialog box at the end to let you know what happened. Also added show z buttons when in continuous jog mode.
Hey Peter. Any advice on loading a local image into a dialog? I havent tried, but I'm assuming that control updates wipes out the OpenBuildsCONTROL directory. That's why I was going to put it somewhere else.
Base64 var directly in the macro? Base64 Image Encoder Can also embed SVG (open the file as text, put the XML into a var)
Hello, Could you please help me with the JS code that opens a file and then runs it? I have already this: window.open("file:///C:\Users\laure\OneDrive\Bureaublad\gcode.gcode"); socket.off('prbResult'); // Disable old listeners socket.emit("runJob", { data: editor.getValue(), isJob: false, completedMsg: false }); So it is a fixed path/file that I am overwriting all the time, and I would like to automaticly open and run the last saved version of this file. Thanks
File reading is a little more complicated than that. See OpenBuilds-CONTROL/main.js at master · OpenBuilds/OpenBuilds-CONTROL More about the FileReader API: FileReader - Chrome Platform Status and FileReader - Web APIs | MDN In essence not possible (security reasons): How to read local files using HTML 5 FileReader?
Could post it to https://ip-of-the-PC-running-control:3000/upload instead ? Externally to CONTROL, watch the file for changes and post it when it changes?
With the onClick function, how do I get that to run a javascript macro I have under Macros? Is there a name I have to give in the macro function?
Code: var sizebtn = `<button id="grblXYSizeMenu" class="ribbon-button" onclick="??????"> <span class="icon"> <span class="fa-layers fa-fw"> <i class="fas fa-tape fa-rotate-180 fg-blue"></i> </span> </span> <span class="caption grblmode">XY Size</span> </button>` $( "#grblXYSizeMenu" ).after( chkSize );
Does this code also need to go in a new macro along side the macro or does the code to add the button go in the same macro as the macro that shows me the size?
I have tried putting it all in one macro and defining a function to run the result. It however can not see the function when I click on the button. Code: function XYSizeCheck(){ if (typeof object !== 'undefined') { var string = "" if (object.userData.inch) { string += "<span style='font-size:42px;'>X: " + Math.ceil(object.userData.bbbox2.max.x - object.userData.bbbox2.min.x) + "inch" + "<br>" + "Y: " + (object.userData.bbbox2.max.y - object.userData.bbbox2.min.y) + "inch</span>"; } else { string += "<span style='font-size:42px;'>X: " + Math.ceil(object.userData.bbbox2.max.x - object.userData.bbbox2.min.x) + "mm" + "<br>" + "Y: " + (object.userData.bbbox2.max.y - object.userData.bbbox2.min.y) + "mm</span>"; } console.log(string) Metro.dialog.create({ title: "Stock Size needed", clsDialog: "dark", content: ` To run this job, you need a piece of stock:<hr> ` + string + ` `, actions: [{ caption: "Cancel", cls: "js-dialog-close alert", }] }); } } var sizerbtntpl = `<button id="grblSizerMenu" class="ribbon-button" onclick="XYSizeCheck();"> <span class="icon"> <span class="fa-layers fa-fw"> <i class="fas fa-tape fa-rotate-180 fg-red"></i> </span> </span> <span class="caption grblmode">XY</span> </button>` $( "#grblProbeMenu" ).after( sizerbtntpl );
Check the example in post #21 above - you have to scope the new functions as window.function... to allow global access to it
Is it possible to send GCode via a macro? I am looking to make the Z go up to the homed top, then once it has safely done that - move the X and Y to the very back of my machine (say X3600 Y2000 based on the distance from homed zero not current zero set in UI) so that I can load up my next sheet of material. Thanks for any help. I am keen to write a macro that homes then does a z probe in one operation. I am going to embed my touch plate into my wasteboard and touch off the Z each time the machine is homed.
I think something is broken. Ctrl + Shift + I doesn't look the same as on page one. I just get a console but not Devtools. I tried just a GCode macro and used G53 X100 F5000 but the machine just moved the X positive until it hit the wall at the end. In the code on the first page I can see: <button class="button outline sawStopActionBtn warning" onclick="sendGcode('M8');">APPLY BRAKE</button> <button class="button outline sawStopActionBtn primary" onclick="sendGcode('M9');">RELEASE BRAKE</button> <hr> <button class="button outline sawStopActionBtn secondary" onclick="sendGcode('$H');">HOME</button> <button class="button outline sawStopActionBtn secondary" onclick="sendGcode('G10 P0 L20 X0');">SETZERO</button> for the function of sendGcode. If I am writing this into a function should I use multiple sendGcode commands after each other or use a ; in the sendGcode("do first part; do second part;") sort of like a single line of multiple commands? I am not sure how to trigger the Z probe but I will work on that later.
Do add a G0 or G1 too, also add you G20/G21s and G90/G91s too - best to not rely on assumed modals G53X100 is 100mm beyond the limit switch: See Frequently Asked Questions · gnea/grbl Wiki (Machine Coordinates are always negative) G38.2 is the probe command sendGcode is for Single commands For "jobs" use runJob (the backend handles the queuing etc): See the basic tips in the into when you open devtools:
I don't think you need JS at all though: Can probably do what you need to do with gcode only G21; Millimeter mode G90; Absolute Positioning G53 G0 Z-5; lift z up G53 G0 X-20 Y-20 ;Back right corner G53 G0 Z-80; Rapid down to just above probe plate G38.2 Z-20 F100 ; Probe Z down max of 20mm G10 P0 L20 Zxx ; Set Z-Zero relative offset
There is no devtools I attached the image to show. It isn't there. I read through the FAQ you linked. I now know that all of the G53 commands should be negative, but is that from my max distance/length of the machine? It looks from there that to get to X500 using G53 coords I should be using G53 X-500, but I am wrong. Doing a G53 X-500 goes to 500mm from the end of my machine. It's like the homing sequence completes and sets my machine zero to the other end of the X and Y. It looks to be getting that setting from my machine settings in Openbuilds Control. I thought the homing would set G53 to: 0,0 (which from the documentation you linked is what a lot of people assume wrong). Instead it appears to be setting it to: {negative value specified X length},{negative value specified Y length}. So to move to the back of my machine, I can just use G53 X0 and that does the trick. Attached my settings backup to show what I have set. Maybe I should have this in it's own thread to not muddy this one up as this is very specific to me and my lack of knowledge/understanding is the issue.
Or just use your perfect suggestion I do want to add a button to the interface like I did with getting the X and Y size (works perfectly now thanks for the help on that one). I am not sure if I can add a macro straight on there or just send the commands via a function. The commands are what I needed for the most part. I wish I could duplicate your brain and put it in a jar to ask questions of instead of your time educating me and others that might find this helpful one day
G53 X0 = far right G53 Y0 = far back G53 Z0 = Z lifted up all the way Negative directions. Away from 0 means more left, more front, more down. Higher number = further away from back, right, top Regardless of where the switches are, 0 0,0 is always in the same spot: at axis maximums.
It’s not intuitive but if that was the standard at the start of it all it makes sense why they keep it that way. Thanks.
Fair enough, has to be a JS macro to inject the button. But refine the sequence of commands as a gcode macro first - once it does it perfectly - wrap the gcode up in a Code: var myCustomProbeMacro = ` G21; Millimeter mode G90; Absolute Positioning G53 G0 Z-5; lift z up G53 G0 X-20 Y-20 ;Back right corner G53 G0 Z-80; Rapid down to just above probe plate G38.2 Z-20 F100 ; Probe Z down max of 20mm G10 P0 L20 Zxx ; Set Z-Zero relative offset ` Which you then send out using" Code: socket.emit("runJob", { data: myCustomProbeMacro, isJob: false, completedMsg: false, }); as part of your JS macro