Message 1 of 8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Trying to get my python script to open the Design that I need to work with ( rest of the script works perfectly if the Design is already open )
Found some code online, but even if I isolate this to a separate script, Fusion freezes up every time I try and run it.
Can anyone spot an error, or suggest better code that works to open a single Design file in the UI ?
#Author-
#Description-
import adsk.core, adsk.fusion, adsk.cam, traceback
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
theData = app.data
i = 0
while i < theData.dataProjects.count:
if (theData.dataProjects.item(i).name == 'My Client'):
j = 0
while j < theData.dataProjects.item(i).rootFolder.dataFolders.count:
if (theData.dataProjects.item(i).rootFolder.dataFolders.item(j).name == 'Common Masters'):
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
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
Solved! Go to Solution.