Message 1 of 4
[Bug]DrawingDocument is not active
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Keep the f3d and f2d files open and make the f3d file active.
Run the following script.
# Fusion360API Python script
import traceback
import adsk.fusion
import adsk.core
import adsk.drawing
def run(context):
ui: adsk.core.UserInterface = None
try:
app: adsk.core.Application = adsk.core.Application.get()
ui = app.userInterface
app.log(f'ver {app.version}')
for doc in app.documents:
datafile: adsk.core.DataFile = doc.dataFile
if datafile.fileExtension == 'f2d':
doc.activate()
app.log(f'activeDocument.name:{app.activeDocument.name}')
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
The text command window will output the following results.
ver 2.0.12670
activeDocument.name:Draw v1
However, the document tabs in the GUI do not have the f2d file active.