Any functions exposed in CAM API to detect invalid toolpath generation?

Any functions exposed in CAM API to detect invalid toolpath generation?

Anonymous
Not applicable
787 Views
2 Replies
Message 1 of 3

Any functions exposed in CAM API to detect invalid toolpath generation?

Anonymous
Not applicable

Hi everyone

 

I was wondering, if there is currently any functionality exposed in the Fusion CAM API that allows a user to detect if there are any invalid toolpaths in my setup. Right now, I am using the existing CAM functions to automate the toolpath generation process of a model. When I sometimes change the parametric dimensions of the model, the existing setup does automatically regenerate the toolpath but sometimes fails to generate the toolpath for some of the operations for which some reference geometries and dimensions have been rendered invalid.

 

For example, if you look at the following CAM setup tree (figure), I have decreased the dia of a certain hole in my model even more than the dia of the tool I am using to bore that hole. Consequently, in my Python script when I am automatically generating the toolpath for all the operations in my setup, the boring operations are becoming invalid. 

 

Is there currently any programmatic way of detecting these very operations which have been rendered invalid?

 

Capture.JPG

0 Likes
Accepted solutions (1)
788 Views
2 Replies
Replies (2)
Message 2 of 3

kandennti
Mentor
Mentor
Accepted solution
Hi mhasan3.
 
I tried it and it worked.
#Fusion360API python script

import adsk.core, adsk.fusion, adsk.cam, traceback

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface

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

        #get Invalid operation
        opes = [ope.name for ope in cam.allOperations if ope.isToolpathValid == False]

        if len(opes) < 1:
            msg = '-- All are valid --'
        else:
            msg = '-- The following are invalid --\n' + '\n'.join(opes) 

        ui.messageBox(msg)

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
1.png
 
 
I think other states can be acquired.
Message 3 of 3

Anonymous
Not applicable

Thanks a lot for the help!

0 Likes