How to get the final value of CAMParameter

How to get the final value of CAMParameter

kandennti
Mentor Mentor
881 Views
2 Replies
Message 1 of 3

How to get the final value of CAMParameter

kandennti
Mentor
Mentor

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?
0 Likes
882 Views
2 Replies
Replies (2)
Message 2 of 3

kandennti
Mentor
Mentor

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.

0 Likes
Message 3 of 3

jsormaz
Advocate
Advocate

I am facing the same issue.

 

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

Instagram:
@sonsofsormaz
0 Likes