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: 

How to get the final value of CAMParameter

2 REPLIES 2
Reply
Message 1 of 3
kandennti
384 Views, 2 Replies

How to get the final value of CAMParameter

Hi there,

 

I'm working on a test script for CAM, but there were some parts that were unclear to me.

I'm testing it with the sample data here.
1.png

I have created a script that looks like this.
import adsk.core, adsk.fusion, adsk.cam, traceback

_app = adsk.core.Application.cast(None)
_ui = adsk.core.UserInterface.cast(None)

def run(context):
    try:
        global _app, _ui
        _app = adsk.core.Application.get()
        _ui = _app.userInterface

        doc = _app.activeDocument
        products = doc.products
        product = products.itemByProductType('CAMProductType')
        cam = adsk.cam.CAM.cast(product)

        ope :adsk.cam.Operation = cam.allOperations[0]

        stayDownDistance :adsk.cam.CAMParameter = ope.parameters.itemByName('stayDownDistance')

        print('title:{}\nname:{}\nexpression:{}'.format(
            stayDownDistance.title,
            stayDownDistance.name,
            stayDownDistance.expression
        ))

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

I would like to get the "Maximum Stay-Down Distance" value for the first operation.
2.png
The CAMParameter object has an "expression" but no property that indicates the final value, such as "value".
3.png
"10 in" not found.

The only way I can think of at the moment is to parse "expression" and get the corresponding values from all the parameters and calculate them...

Is there an easy way to get the final value?
2 REPLIES 2
Message 2 of 3
kandennti
in reply to: kandennti

I'm developing an add-ins that uses the recently introduced ActiveSelectionEvent and allows you to check configuration information without opening a dialog.
We plan to release it on github in the future.

 


However, due to the above problems, it is far from what we want.
If you have some information, I would appreciate it.

Message 3 of 3
jsormaz
in reply to: kandennti

I am facing the same issue.

 

Is there still no way to directly get the value of a CAMParameter?

Instagram:
@sonsofsormaz

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