Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sending gcode to router

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
luchier
907 Views, 9 Replies

Sending gcode to router

Hello,

 

Would it be possible to send the fusion generated gcode directly to the cnc control software? This software comes in several modules and bad thing can happen if the wrong module is used. I almost broke the machine this weekend.

 

I am planning to make Fusion as the software of choice for design and machining in our fablab CNC. So, I really don't want anybody to make the same mistake. Sending the gcode file directly to the right module is a good solution. It also simplifies the processing chain that can be daunting for new comers.

 

 

Would it be possible, via a script or addin, to add a checkbox below the 'open NC file in editor' of the postprocessor window? Then by clicking on the 'post' button, fusion save the file then send it to the software by a 

"\path\to\the\controlerModule.exe" "\path\to\gcodeFile.nc"

 

Thanks,

Nicolas Luchier

9 REPLIES 9
Message 2 of 10
marshaltu
in reply to: luchier

Hello,

 

Unfortunately there is no API to support to customize existing "Post Process" dialog. However you can create a brand-new dialog by yourself and make use of the API "CAM.postProcess". Then you would have full control for the new dialog to add what you need. 

 

Thanks,

Marshal 



Marshal Tu
Fusion 360 Developer
Autodesk, Inc.

Message 3 of 10
luchier
in reply to: marshaltu

Hi Marshal,

 

Thanks for your answer. A dedicated dialog is great too! What would be the best solution for showing the dialog? A menu entry in the right-click list would be possible?

 

I'll have a look to the cam.postProcess API. Meanwhile, would you have a piece of code that could be of help?

 

Thanks,

Nicolas

Message 4 of 10
ekinsb
in reply to: luchier

Hi Nicolas,

 

You'll be writing an add-in that will support the custom post processing command.  There are a few help topics that should help you get started.  I would especially recommend the first five topics in the Fusion API User's Manual (http://help.autodesk.com/view/NINVFUS/ENU/?guid=GUID-C1545D80-D804-4CF3-886D-9B5C54B2D7A2).

 

-Brian

 

 

 

 


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 5 of 10
luchier
in reply to: ekinsb

Hi Brian,

Thanks for giving me some insights. I am digging into the API and already
made some progress

For now, I am considering two possibilities, both with a button in the CAM
action panel:
* To loop over setup and/or toolpaths and propose a dropdown to choose what
toolpath to send
* To select a setup or a specific toolpath and clic the button to send the
corresponding toolpath. This has currently my preference

Regarding the second point, I didn't find any example concerning the
selection/getting-the-data process. Could you point me to some pages (if
any) of the manual on this subject?

Thanks,
Nicolas
Message 6 of 10
marshaltu
in reply to: luchier

Hello,

 

Unfortunately it didn't work to convert a selection to CAM object(Setup/Folder/Operation). I logged CAM-4609 in our internal system to track the issue.

 

In addition, you should be able to find some samples from our help page http://help.autodesk.com/view/NINVFUS/ENU/?guid=GUID-449190dd-d155-4673-bb2e-9806d742d5b8. The path is "Programming Interface -> Sample Programs -> CAM".

 

Thanks,

Marshal



Marshal Tu
Fusion 360 Developer
Autodesk, Inc.

Message 7 of 10
luchier
in reply to: marshaltu

Hi,

 

Does that mean that I can't rely on selection to get to toolpath?

For instance, this script works in the model workspace but not in the CAM workspace

import adsk.core, adsk.fusion, traceback

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface
        
        result = ''
        for selection in ui.activeSelections:
            selectedEnt = selection.entity
            if selectedEnt.objectType == adsk.fusion.BRepBody.classType():
                result += 'Selected Body: ' + selectedEnt.name + '\n'
            else:
                result += 'Other selection: ' + selectedEnt.objectType + '\n'

        ui.messageBox(result, 'Selection Result')
    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

Maybe the simplest way to go is to create a list of the toolpaths, put it in a commande input dropdown and get the user selecting the path he wants to send...

 

Thanks

Message 8 of 10
marshaltu
in reply to: luchier

Hello,

 

That is correct. You may have to get a list of toolpath and let users select from drop-down list.

 

Thanks,

Marshal



Marshal Tu
Fusion 360 Developer
Autodesk, Inc.

Message 9 of 10
prainsberry
in reply to: marshaltu

Hello,

 

Here is a sample that will pretty much do what you need i think.  It lets you pick an operation and posts and sends it straight to Universal g-code sender. 

https://github.com/tapnair/UGS_Fusion

 

Feel free to fork and modify for your purposes.  Should be pretty straight forward to change the output location or launch a different application.

 

 



Patrick Rainsberry
Developer Advocate, Fusion 360
Message 10 of 10
luchier
in reply to: prainsberry

Hi Patrick,

 

This is indeed a very good start. All is mainly already coded. Thanks a lot!

 

Nicolas

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report