- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
i was very exited about the new Drawing PDF export API function, since this will bring more automation to our internal workflow.
But my first attempts to use it where quite unsuccessful.
Not sure how to properly access the functionality.
Starting point:
- A fusion 3D document is open in fusion 360
- This document has one referenced drawing
- I am using Python
What i want to do:
- Run a script via "Tools->Add-Ins"
- The script is supposed to export the associated drawing as PDF to my PC
Sounds simple, right?
So far it seems i have some technical issues to do that.
- Exporting a drawing works if the drawing is already open in Fusion 360 and a script is executed on the drawing (accessing the drawing document). However, scripts are normally not accessible in the toolbar in the drawing itself... So its kind of strange to do it like this. And also it is strange to expect the drawing to already being open. The script should be able to react.
- Accessing the referenced drawing via the 3D model is not really trivial. The only link that i found was by accessing and opening the dataFile (parent)references:
app = adsk.core.Application.get()
active = app.activeDocument
drawingDataFile = active.dataFile.parentReferences.item(0)
drawingDocument = app.documents.open(drawingDataFile)
- To retrieve the drawing document, fusion first has to open the drawing in fusion 360 in order to use it.
- However if i open the drawing document and then try to export the PDF, it seems, that the document is not ready yet, so the PDF export does not happen. The DrawingExportManager returns True, but there is no PDF file... So maybe this is a race condition.
- Then i tried to use an eventhandler to determine if the document has opened and then execute the DrawingExportManager, however, the eventhandler fires before the file is completely loaded, so the same race condition occurs.
Now i am honestly out of ideas.
Maybe i am missing some fundamental understanding of how this is supposed to work?
Can anybody share an example that works or maybe point me in the right direction?
Thanks in advance.
BR
Solved! Go to Solution.
Link copied