I use Passthrough in Fusion 360 to send commands to my CNC such as “X500 F5000” to move out of the way for me to screw things down. Is it possible to send a message string via Passthrough that pops up a message box with an OK button and the message string displayed? I only really need this functionality on the loading of the file, not during operation. I mentioned the Passthrough as that is the closest thing I know so far relating to sending information to the control software. I understand that Passthrough would probably not be useful dor what I am trying to achieve.
Its not standard functionality. But if you know javascript, you can add it. I wrote a tool change macro that lets you open multiple files. Part of that looks for tool information and displays what bit to load. I used Peter's early work for tool changes as a starting point since it gave me a clue as to how to parse the loaded file and pull out the info I need. Here's the discussion: Toolchanges · Issue #26 · OpenBuilds/OpenBuilds-CONTROL And the code: OpenBuilds-CONTROL/toolchange.js at master · OpenBuilds/OpenBuilds-CONTROL And more info on how to write javascript macros with dialogs and such: Getting started with Javascript Macros in CONTROL / Library of Macros created by the community
Ok. Here's a crude way of doing it. It may work for you. I couldnt find a built in way to listen for just the file open so it listens for a change on the gcode editor tab, which happens when you load a file. It then looks for the first line that contains the text "ALERT:" and displays that line in a dialog. In fusion, you would add a passthrough comment that starts with "ALERT:" Code: editor.session.on('change', function(delta) { let foundAlert = editor.find('ALERT:'); if (foundAlert !== undefined) { let alertText = editor.session.getLine(foundAlert.start.row); var dialog = Metro.dialog.create({ clsDialog: 'dark', title: "<i class='fas fa-exclamation-triangle'></i> ALERT", content: "<i class='fas fa-exclamation-triangle fg-darkRed'></i> " + alertText, actions: [{ caption: "Close", cls: "js-dialog-close", onclick: function() { // } }] }); } }); If you use Controls gcode editor to edit the code, this is a terrible solution since it will pop up the dialog with every editing keystroke. Like I said, its crude, but may work for you. Here's the first few lines of my test gcode: Code: (Made in : Autodesk CAM Post Processor) (G-Code optimized for Grbl 1.1 / BlackBox controller) (OpenBuilds CNC : GRBL/BlackBox) (Post-Processor : OpenbuildsFusion360PostGrbl.cps V1.0.30) (Units = inch) (Drawing name : Keyhole bracket v2) (Program Name : 1001) (1 Operation :) (1 : 2D Pocket1) ( Work Coordinate System : G54) ( Tool 3: Flat End Mill 3 Flutes, Diam = 0.25inch, Len = 0.75inch) ( Spindle : RPM = 5100) ( Machining time : 24 sec) G90 G94 G17 G20 (ALERT: Do this now) (ALERT: Do this also)
Okay. I think I got it. This code will alert on file load but not on user edits. Code: function alertMacro() { editor.session.on('change', function(e) { if (editor.curOp && editor.curOp.command.name) { return null; } let foundAlert = editor.find('ALERT:'); if (foundAlert !== undefined) { let alertText = editor.session.getLine(foundAlert.start.row); console.log('what is pos ' + alertText) var dialog = Metro.dialog.create({ clsDialog: 'dark', title: "<i class='fas fa-exclamation-triangle'></i> ALERT", content: "<i class='fas fa-exclamation-triangle fg-darkRed'></i> " + alertText, actions: [{ caption: "Close", cls: "js-dialog-close", onclick: function() { // } }] }); } }); } $(document).ready(() => setTimeout(alertMacro, 1000)); Oh, in case you dont know. Add this to a javascript macro and select "Run macro at startup". Restart Control and you should be set.
Family member was in hospital so I hope you accept my apology for not replying to this amazing post. This actually helps out with a lot of other sequencing too! You have gone above and beyond here. I appreciate how much time you spend helping others. I am so grateful.