Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
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: 

knowing the names of parameters

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
anthony.a.douglas
561 Views, 2 Replies

knowing the names of parameters

Hey there, I am still trying to understand the more fundamental nature of the object model and how things are programmed here, but I am running into some issues.

 

First of all, in the example here, for instance :https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-2716A113-555D-41B0-8FC4-4FCD265434C4 a parameter of a toolpath is modified.  The issue I have is how I would know what the name of the parameter was.  I cannot see where in the reference manual these parameters are listed.  There would be a great many, but they still all need to be documented, or how can we know what they are, their implications and names.

This problem occurs in other cases, such as https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-2716A113-555D-41B0-8FC4-4FCD265434C4 the parameter with the name "job_programName" - how could I have known that the parameter I wanted had that name?

A

 

 

2 REPLIES 2
Message 2 of 3

Hi @anthony.a.douglas .

 

This way you can dump all the parameters.

#Fusion360API Python script
import adsk.core, adsk.cam, traceback

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        doc = app.activeDocument
        products = doc.products
        
        # Get the CAM product
        cam = adsk.cam.CAM.cast(products.itemByProductType("CAMProductType"))

        # List of all setups
        setups = cam.setups
        
        # dump setup.parameters
        setup = setups[0]
        for prm in setup.parameters:
            print('{} : {}'.format(prm.name, prm.expression))

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

 

However, no method for obtaining the correct value has been found.

https://forums.autodesk.com/t5/fusion-360-api-and-scripts/how-to-get-the-final-value-of-camparameter... 

Message 3 of 3
kandennti
in reply to: kandennti

There was another way.
If you hold down the Shift key in the GUI and display the tooltip, you will see the parameter names.

 

1.png

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

Post to forums  

Autodesk Design & Make Report