Message 1 of 3
Retrieve tool associated with operation with Python API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I've successfully retrieved the setups of my CAM and the operations of every setups.
Now I would like to get the tool associated with every operation, but in the API reference of the Operation object I cannot find any reference to the tool used in that operation.
Here's my code:
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
doc = app.activeDocument
products = doc.products
product = products.itemByProductType('CAMProductType')
if product == None:
ui.messageBox('There are no CAM operations in the active document')
return
cam = adsk.cam.CAM.cast(product)
o = cam.setups.item(0).operations.item(0)
for s in cam.setups:
for o in s.operations:
#here I want to retrieve the tool associated with this operation
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))