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: 

2D Trace operation can't be used

1 REPLY 1
SOLVED
Reply
Message 1 of 2
karolis.s
106 Views, 1 Reply

2D Trace operation can't be used

I need to create a rest machining in the corner between two planes by using chamfer tool. The only way I know how to do that is by using 2D Trace operation.

Unfortunately, I cannot access its 'CadContours2dParameterValue'..

P.S. if an operation is created by with setup.createFromTemplate method I get same response.

#Author-
#Description-

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

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

        cam: adsk.cam.CAM = app.activeDocument.products.itemByProductType('CAMProductType')
        setup: adsk.cam.Setup = cam.setups.item(0)

        # create a trace operation input
        input = setup.operations.createInput('trace')
        input.displayName = 'Trace Operation' 

        # add the operation to the setup
        trace_op = setup.operations.add(input)
        
        contour_param = trace_op.parameters.itemByName('contours').value
        # for param in trace_op.parameters:
        #    print(param.name)

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

 

1 REPLY 1
Message 2 of 2
kandennti
in reply to: karolis.s

Hi @karolis.s -San.

 

The parameter names seem to be wrong.

・・・
        # contour_param = trace_op.parameters.itemByName('contours').value
        for param in trace_op.parameters:
            try:
                if param.value.classType() == "adsk::cam::CadContours2dParameterValue":
                    app.log(param.name)
            except:
                pass
・・・

 

1.png

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