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: 

Is there a way to open a Fusion 360 drawing file from a Python Script?

1 REPLY 1
Reply
Message 1 of 2
spiritandsoledesigns
444 Views, 1 Reply

Is there a way to open a Fusion 360 drawing file from a Python Script?

I have a need to automate some tasks I do in FUSION360 in that I would like to execute a msdos batch file that may have 30-50 drawing file names in my Fusion360 projects folder, and have it call a python script which will open the fusion360 drawing, change a couple of the user parameter values and then export the drawing as stl to a network folder.

 

I found script that has example of how to change the user parameters and export as stl however I can't figure out how to get a python script to open fusion360 with a name of drawing file.   

 

Is there anyway to do this with the Fusion360 API?   Anyone know of any examples in Python?

 

Randy   

1 REPLY 1
Message 2 of 2

 

 

app = adsk.core.Application.get()
ui  = app.userInterface

theData = app.data

dataProjectIndex = 0
i = 0
while i < theData.dataProjects.count:
  if (theData.dataProjects.item(i).name == 'PROJECT NAME'):
    j = 0
    while j < theData.dataProjects.item(i).rootFolder.dataFolders.count:
      if (theData.dataProjects.item(i).rootFolder.dataFolders.item(j).name == 'FOLDER NAME'):
      k = 0
      while k < theData.dataProjects.item(i).rootFolder.dataFolders.item(j).dataFiles.count:
            app.documents.open(theData.dataProjects.item(i).rootFolder.dataFolders.item(j).dataFiles.item(k),False)
      k += 1
    return
  j += 1
i += 1

 

 

This may get you started. This is part of an Add-In that I use to open all files within a certain folder in a certain project.

Instagram:
@sonsofsormaz

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