Message 1 of 5
How to save as DXF programmatically

Not applicable
04-12-2017
01:40 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, I'm writing an addin script and wanted to know how do you programmatically save files and how to save them as a DXF file.
I have this code so far, but it keeps giving me an error, about how the 2nd parameter "datafolder" is incorrect.
app = adsk.core.Application.get()
docu = app.activeDocument
datafolder = adsk.core.DataFolder
ui.messageBox("The name of the datafolder is: "+str(datafolder.name))
saved = docu.saveAs("FilecreatedFromGUI", datafolder, "Newly created file", "")
if(saved == True):
ui.messageBox("File was successfully saved!!!")
if(saved == False):
ui.messageBox("File failed to save.")