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

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

Anonymous
Not applicable
477 Views
3 Replies
Message 1 of 4

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

Anonymous
Not applicable

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? )
 
 
0 Likes
Accepted solutions (1)
478 Views
3 Replies
Replies (3)
Message 2 of 4

jsormaz
Advocate
Advocate
Accepted solution

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
Mentor
Mentor
Message 4 of 4

Anonymous
Not applicable
Amazing... I would have never figured this out on my own.. Much appreciation!!!
0 Likes