Message 1 of 3
How to get the final value of CAMParameter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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.
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.
The CAMParameter object has an "expression" but no property that indicates the final value, such as "value".
"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?