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: 

Can I pull the project name and subsequent folder names from the API?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Chak257
141 Views, 3 Replies

Can I pull the project name and subsequent folder names from the API?

Using python?

 

    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface
        doc = app.activeDocument
        partName = doc.name
        print(partName)
 
This gives me the part name that I am currently working on.   I am looking for a way to pull the name of the parent folder its stored in, as well as any parent folders up to the main project folder it resides in. 
 
Project Folder Name
--Sub Folder Name
----Sub Folder Name 2
------Sub Folder Name 3
--------Part File Name    ( I can get this, but is there a way to pull the names of all the folders above the part level to store in variables? )
 
 
3 REPLIES 3
Message 2 of 4
jsormaz
in reply to: Chak257

Start here:

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-54a08742-92b2-4831-b9e6-4161b89f6e1e

 

 

doc.dataFile.parentFolder.name

 

you can keep going deeper (.parentFolder.parentFolder) until you get null

Instagram:
@sonsofsormaz
Message 3 of 4
JeromeBriot
in reply to: Chak257
Message 4 of 4
Chak257
in reply to: jsormaz

Amazing... I would have never figured this out on my own.. Much appreciation!!!

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