How to manage Fusion Offline work with API? (performance reasons)

How to manage Fusion Offline work with API? (performance reasons)

sergey.osipovEK6NG
Explorer Explorer
725 Views
3 Replies
Message 1 of 4

How to manage Fusion Offline work with API? (performance reasons)

sergey.osipovEK6NG
Explorer
Explorer

While development for Fusion we recognized some operations with components are working much faster if local cache is used and network is disabled.

 

How can we force specific documents to be cached locally with using API?   

Also can we programmatically switch Fusion into offline work mode?

 

Thanks

0 Likes
726 Views
3 Replies
Replies (3)
Message 2 of 4

kandennti
Mentor
Mentor

Hi @sergey.osipovEK6NG .

 

This is how it was done.

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui = app.userInterface

        state = app.isOffLine

        # app.executeTextCommand(u'NuCommands.WorkOffline') #NG
        app.executeTextCommand('Commands.Start WorkOfflineCommand')

        msg = '{}line now!'.format('Off' if not state else 'On')
        ui.messageBox(msg)
        
    except:
        ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

However, there will be a time lag in the actual switching to OnLine.

Message 3 of 4

sergey.osipovEK6NG
Explorer
Explorer

Thank you! we will try this

 

Do you know is it possible to force fusion to cache the specific documents before it went offline?

0 Likes
Message 4 of 4

kandennti
Mentor
Mentor

The cached data would be the files in the folder that will be opened when you run the following in the TextCommands?

Cache.open

I think the file here has been updated because the timestamp changes when it is saved, but I don't know of any other way.

0 Likes