Fusion crashing after importing file from local storage(.f3d)

Fusion crashing after importing file from local storage(.f3d)

mayur_kapadnis
Participant Participant
309 Views
2 Replies
Message 1 of 3

Fusion crashing after importing file from local storage(.f3d)

mayur_kapadnis
Participant
Participant
def ImportFile(input_data: dict) -> dict:
    '''
    input_data = {"fileName": <fileName>}
    output_data = {"status": <True/False>, "message": <message>}
    '''
    try:
        # Extract the file name from input_data
        fileName = input_data["fileName"]
       
        # Check if file exists
        if not os.path.isfile(fileName):
            return {"status": False, "message": f"File '{fileName}' does not exist."}
       
        # Get the application object
        app = adsk.core.Application.get()
        design = adsk.fusion.Design.cast(app.activeProduct)
       
        # Get the root component of the active design (assembly)
        rootComp = design.rootComponent
       
        # Get import manager
        importManager = app.importManager
       
        # Get archive import options
        archiveOptions = importManager.createFusionArchiveImportOptions(fileName)
       
        # Log before importing
        print(f"Attempting to import '{fileName}'...")
       
        # Import the archive file into the current assembly
        importManager.importToTarget(archiveOptions, rootComp)
 
        doc = app.activeDocument
        doc.close(False)
 
        return {"status": True, "message": f"File '{fileName}' imported successfully into the assembly."}
   
    except Exception as e:
        return {"status": False, "message": f"Failed to import file: {traceback.format_exc()}"}  

I am trying to import f3d file from local storage into fusion active document, but fusion app gets crashed

0 Likes
310 Views
2 Replies
Replies (2)
Message 2 of 3

Jorge_Jaramillo
Collaborator
Collaborator

Hi,

 

Where from in your script are you calling the ImportFile() function? and what input_data are providing to it?

Did you get some exception information from it?

 

Also, are you aware of the warning I highlighted in the following image from the API documentation?

Jorge_Jaramillo_0-1727186183906.png

Could it be this escenario?

 

Regards,

Jorge

 

Message 3 of 3

kandennti
Mentor
Mentor

Hi @mayur_kapadnis -San.

 

I tried it and was able to import it without any problems.

Can the f3d file you are trying import be manipulated in the GUI?

0 Likes