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: 

Fusion 360 Api : Get Access to Cloud Post Processors in FileDialog

3 REPLIES 3
Reply
Message 1 of 4
GermanWings
153 Views, 3 Replies

Fusion 360 Api : Get Access to Cloud Post Processors in FileDialog

Hello,

I am building a add in that will access the My CAM Tree Operations , and then post each operation in a single NC File with the selected post processor. I began looking at the Fusion 360 Api Documentation and found the CAM object has a variable cam.genericPostFolder.

This variable points to a local directory on my computer that has Fusion Posts Stored.

However I required to access Cloud Post Processors , is there a way to do so ?

 

I will create a drop down then of the list of Cloud Posts to select from

then I will create a drop down for all the operations available.

 

The selected post will capture each single operation in a setup and create a NC File for each of them.

 

Let me know : 

Thanks,

Bhavar :cherry_blossom::cherry_blossom:

 

 

3 REPLIES 3
Message 2 of 4
kandennti
in reply to: GermanWings

Hi @GermanWings .

 

I don't understand Cloud Post, is it something that is in this folder?

1.png

 

Here is how to access it.

# Fusion360API Python script

import traceback
import adsk.fusion
import adsk.core

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

        dir: adsk.core.DataFolder = get_CloudCAMPosts_DataFolder()
        if not dir:
            return

        # dump files name
        dataFile: adsk.core.DataFile
        for dataFile in dir.dataFiles:
            app.log(dataFile.name)

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



def get_CloudCAMPosts_DataFolder() -> adsk.core.DataFolder:
    assetsProj: adsk.core.DataProject = get_Assets_DataProject()
    if not assetsProj:
        return None

    rootDir: adsk.core.DataFolder = assetsProj.rootFolder
    dirs = rootDir.dataFolders.asArray()
    dir: adsk.core.DataFolder
    for dir in dirs:
        if dir.name == 'CAMPosts':
            return dir

    return None

def get_Assets_DataProject() -> adsk.core.DataProject:
    app: adsk.core.Application = adsk.core.Application.get()
    pros = app.data.dataProjects.asArray()
    pro: adsk.core.DataProject
    for pro in pros:
        if pro.name == 'Assets':
            return pro

    return None

 

However, I have not checked beyond that.

Message 3 of 4
GermanWings
in reply to: kandennti

Hello @kandennti Thanks for sharing the snippet , Yes I meant that folder called "CAMPosts" , but how do I use that reference ? for posting my nc code , I see the Examples on the Documents page , they all use a variable cam.genericPostFolder , I want to use the Post Processors in CAMPosts folder that is available , as the Create NC Process Dialog uses.

Message 4 of 4
GermanWings
in reply to: GermanWings

Okay I checked the Documentation , maybe I can use dataFile.download function and create a pool of post files specifically for use of my script , let me know if there is another method

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