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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Activate a folder in the CAM environment

Message 1 of 3
206 Views, 2 Replies

Activate a folder in the CAM environment



I am really struggling with the lack of functionality of the CAM API.


I have created a library inside of Fusion with several projects that have different geometries and CAM Setups saved inside of them. I have been able to open these documents and import in the CAD models easily, but have been unable to grab objects from the CAM environment. 


I have tried to save the CAM setups as Templates and then import them into the new project with some success, but I need to import the templates into a specific folder in the new projects new setup, and I do not see any functionality to activate a folder to do this. 


cam.setups.item(0).folders.item(0).isSelected = True


This does not work as the 'isSelected' property appears to be read only.


I have also tried to open the template document and using text commands, have been able to copy the entire Setup, including folders and toolpaths. However when I navigate over to the new project, I have no way of selecting the RootSetup so that I could use a text command to paste the copied Template.



# Targets and copies the first setup in the template document
template =,False).products.itemByProductType('CAMProductType')
templateCam =
app.executeTextCommand('Commands.Start IronCopy')

# Reactivate the CAM enviroment in new document,True).activate()
camProduct = app.activeDocument.products.itemByProductType('CAMProductType')
cam =
setups = cam.setups

# Trying to paste to copied Setup but 'cam.setups'
# does not target the setups  object in the ui and thus
# the paste does nothing.
app.executeTextCommand('Commands.Start IronPasteCommand')




are there any text commands to select items in the UI? like the image below



Lastly I tried to use the API and text commands to create a new setup from scratch, but I still ran into the problem where I could not target a newly created folder. I used the text command:


app.executeTextCommand('Commands.Start IronFolder')


to create a new folder but the new folder is not the active object, and so when I create or insert toolpaths using templates, the instead fall under the Setup on the same level as the Folder, and I instead need them inside the folder.



Thanks in advance for any insight.

Kind regards,







Message 2 of 3
in reply to: Joshua.mursic

Hi @Joshua.mursic .


You can choose to use "ONK" as described here. 

Can't you select it this way?

# Fusion360API Python script

import traceback
import adsk.fusion
import adsk.core
from urllib.parse import quote

def run(context):
    ui = None
        app = adsk.core.Application.get()
        ui = app.userInterface
        doc = app.activeDocument
        # products = doc.products
        # cam ="CAMProductType"))

        # ObjectPaths.Onk
        onk = u'ONK::CmpInst={}/Cmp={}/{}/'.format(


        # select setups
        app.executeTextCommand(u'Commands.Select {}'.format(onk))

        if ui:


To check the "ONK", select the element to be checked in advance and use this command from the add-in I have created and published, which will be output to a text command window. 


Message 3 of 3
in reply to: kandennti

Amazing! Thank you so much @kandennti, I have learned so much from your posts. That is working perfectly.

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