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: 

Display Part "PathName" in MessageBox

1 REPLY 1
Reply
Message 1 of 2
isocam
192 Views, 1 Reply

Display Part "PathName" in MessageBox

Can anybody help?

 

Is it possible, using a Fusion 360 Script/AddIn to do the following:

 

Say I have a part open called "Bearing Housing" that is saved in a folder called "Purchased Parts"

 

Is it possible to display the parts path name using a fusion 360 scrip/Addin?

 

Example,

 

.....\Purchased Parts\Bearing Housing.f3d

 

Many thanks in advance!!!!

 

Darren

1 REPLY 1
Message 2 of 2
marshaltu
in reply to: isocam

Hello,

 

Please try the following codes and see if it meets your requirement.

 

#Author-
#Description-

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

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface
        
        doc = app.activeDocument
        datafile = doc.dataFile
        path = datafile.name + '/' + doc.name
        datafolder = datafile.parentFolder
        while datafolder:
            path = datafolder.name + '/' + path
            datafolder = datafolder.parentFolder
        ui.messageBox('The path is \"{}\"'.format(path))

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

Thanks,

Marshal



Marshal Tu
Fusion 360 Developer
Autodesk, Inc.

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report