Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Open referenced document: RuntimeError: 3 : Failed to download file.

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
p.seem
775 Views, 6 Replies

Open referenced document: RuntimeError: 3 : Failed to download file.

Hi all,

 

I have an add-in which, in certain circumstances, opens a referenced component.  Fairly recently, although I can't say exactly when, this stopped working.  

 

I've reduced it to the simple script below, and the error persists.  All you need is to create a design with a single component in it, then create  second design and insert this first as an XRef (e.g. https://a360.co/2M4RN9J)

 

Running the script below seems to retrieve a valid dataFile, but attempting to open that dataFile always results in the "Failed to download file" error.

 

import adsk.core, adsk.fusion, adsk.cam, traceback

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

        product = app.activeProduct
        design = adsk.fusion.Design.cast(product)

        # Get the root component of the active design.
        rootComp = design.rootComponent

        # Get the occurrence of the first sub component, and this occurrence references an external reference component
        occ = rootComp.occurrences.item(0)

        if occ.isReferencedComponent:
            doc = occ.component.parentDesign.parentDocument
            app.documents.open(doc.dataFile, True) 
            
    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

 

Is anyone else seeing this behaviour recently?

 

Thanks,

 

Pete

6 REPLIES 6
Message 2 of 7
BrianEkins
in reply to: p.seem

I believe this is a regression with the latest update.  I'm seeing the same problem.  In my case it was failing with the error you indicated and then once in a while it would work, but the result seemed wrong and then I finally realized it was actually opening an earlier version of the document and not the latest.  Hopefully, this can be fixed soon.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 3 of 7
p.seem
in reply to: BrianEkins

That's a shame. We need this as part of our process to release a new revision. Is there any alternative way to open a file (or force a file to download) in the API that we could use as a workaround in the mean time? I tried adding the top level assembly to the offline cache, but that made no difference.

I also noticed that latestVersion returns version number 1. I don't know if that's related.

Thanks for your help.

Pete
Message 4 of 7
BrianEkins
in reply to: p.seem

The workaround I ended up using in my case is to have the user manually open the desired file and then execute my command.  This opens up the door for user error and it's harder to use but it's the only workaround I could find.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 5 of 7
goyals
in reply to: BrianEkins

This issue is fixed and it will be available in September release. As of now it is planned for 16 Sept.

Sorry for inconvenience caused and we will be more careful in future to avoid regression.



Shyam Goyal
Sr. Software Dev. Manager
Message 6 of 7
Anonymous
in reply to: goyals

After Fusion Updated this morning, I've been having the same problem.

 

I have an add-in that cycles through referenced documents and posts the cam setups, but it gives me 'RuntimeError: 3 : Failed to download file.' for some, not all, of the files that contain referenced documents that I've been working on.

 

Strangely, if I save the file that contains the referenced documents to another folder, it seems to work. Any ideas?

Message 7 of 7
JYZMT
in reply to: goyals

Same problem here. If it helps anyone find the cause, or find a short term fix, I've found moving files, then running my script solves it. But I can't find much of a patten, both with regard to which files are effected, and a solution.

 

File used to work

Following fusion Update > script falls over

Tried saving new version of file > script falls over

Tried a SaveAS to create new file within same folder as before > script falls over.

Moved the above SaveAS file to a different folder, but otherwise it is left entirely as before, ran script > success!!! 

 

In another file, when it stopped working, I did a save as straight to a new folder, and it started working again. 

 

I thought it was related to where the linked files are and their relationship to the main master file. But I've dropped this theory now. 

 

The only patten I find is that when the script stops working in a file, if the file is moved to other folder, or duplicated to another folder (using SaveAs - I've not tried copy), it starts to work again???

 

If this helps anyone.  

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report