Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
dataFile.move(targetFolder) causes the dreaded "A software problem has caused Fusion to close unexpectedly" message. Ouch.
dataFile.copy(targetFolder) works just fine.
Here's a minimal amount of code that demonstrates the problem. The important part is the last line where Fusion blows up. Change move() to copy() in the last line and it works fine.
Any ideas for a workaround? I'd really like to move some dataFiles.
Thanks, -Dave
p.s. Wouldn't it be nice to have a itemByName() method on the dataFolders and dataProjects objects?
app = adsk.core.Application.get()
ui = app.userInterface
projectName = 'Test'
project = None
for checkProj in app.data.dataProjects:
if checkProj.name == projectName:
project = checkProj
break
if project is None:
ui.messageBox("Project '{}' not found".format(projectName), '', adsk.core.MessageBoxButtonTypes.OKButtonType, adsk.core.MessageBoxIconTypes.InformationIconType)
return
testFileName = 'TestFile'
testFile = None
for checkFile in project.rootFolder.dataFiles:
if checkFile.name == testFileName:
testFile = checkFile
if testFile is None:
ui.messageBox("File '{}' not found".format(testFileName), '', adsk.core.MessageBoxButtonTypes.OKButtonType, adsk.core.MessageBoxIconTypes.InformationIconType)
return
testFolderName = 'TestFolder'
testFolder = project.rootFolder.dataFolders.itemByName( testFolderName )
if testFolder is None:
ui.messageBox("Folder '{}' not found".format(testFolderName), '', adsk.core.MessageBoxButtonTypes.OKButtonType, adsk.core.MessageBoxIconTypes.InformationIconType)
return
testFile.move( testFolder )
Solved! Go to Solution.