Setting isAutomaticSaveOnCloseEnabled doesn't work

Setting isAutomaticSaveOnCloseEnabled doesn't work

scottmoyse
Mentor Mentor
581 Views
3 Replies
Message 1 of 4

Setting isAutomaticSaveOnCloseEnabled doesn't work

scottmoyse
Mentor
Mentor

If you try the following code it doesn't change the setting in preferences:

    app = adsk.core.Application.get()
    ui = app.userInterface

    genPref = app.preferences.generalPreferences
    autosave = genPref.isAutomaticSaveOnCloseEnabled
    autoVersion = genPref.isAutomaticVersioningEnabled
    print("Autosave before: " + str(autosave))
    print("autoVersion before: " + str(autoVersion))
    if autosave:
            autosave = False
    print("Autosave: " + str(autosave))
    print("autoVersion: " + str(autoVersion))

You can see from the result in the debug console that the value has changed so far as the API is concerned. But when you check the UI, the setting is still ON... and running the code again reports autosave is True.

scottmoyse_0-1590223131332.png

If I turn off the setting manually, then autosave evaluates to False immediately. 

 

It appears there are a decent number of bugs in the API and a few misleading notes in the documentation indicating things should work when in fact they aren't supported. Who is responsible for logging bugs and how many API bug fixes are pushed out with each new release of Fusion?

 


Scott Moyse
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature


RevOps Strategy Manager at Toolpath. New Zealand based.

Co-founder of the Grumpy Sloth full aluminium billet mechanical keyboard project

0 Likes
Accepted solutions (1)
582 Views
3 Replies
Replies (3)
Message 2 of 4

goyals
Autodesk
Autodesk
Accepted solution

I just looked at your code. You change the value of variable locally and not set it on API again.  Please try below code. 

app = adsk.core.Application.get()

genPref = app.preferences.generalPreferences

autosave = genPref.isAutomaticSaveOnCloseEnabled

if autosave:

  genPref.isAutomaticSaveOnCloseEnabled = False

Thanks.



Shyam Goyal
Sr. Software Dev. Manager
0 Likes
Message 3 of 4

scottmoyse
Mentor
Mentor
yeah I tried that before posting on here, that doesn't work either.

Kind Regards
Scott Moyse
Manufacturing Technical Specialist Autodesk Expert Elite
P: +64 9 302 4028 M: +64 21 055 7775
scott.m@cadpro.co.nz

CADPRO Systems Ltd
Auckland - 527b Rosebank Road, Avondale Auckland
Christchurch - Unit 3, Kendal Avenue, Burnside
New Zealand

Scott Moyse
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature


RevOps Strategy Manager at Toolpath. New Zealand based.

Co-founder of the Grumpy Sloth full aluminium billet mechanical keyboard project

0 Likes
Message 4 of 4

scottmoyse
Mentor
Mentor

@goyals wrote:

I just looked at your code. You change the value of variable locally and not set it on API again.  Please try below code. 

app = adsk.core.Application.get()

genPref = app.preferences.generalPreferences

autosave = genPref.isAutomaticSaveOnCloseEnabled

if autosave:

  genPref.isAutomaticSaveOnCloseEnabled = False

Thanks.


I take that back... This does work. I mustn't have tested it properly previously. Thank you.


Scott Moyse
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature


RevOps Strategy Manager at Toolpath. New Zealand based.

Co-founder of the Grumpy Sloth full aluminium billet mechanical keyboard project

0 Likes