Hi @maurizio_manzi
Here is the little snippet of codes you can implement in your code
#operation creation
opInput = setup.operations.createInput('pocket2d')
opInput.tool = getTool()
# Enable Tool orientation
opInput.parameters.itemByName('overrideToolView').expression = 'true'
opInput.parameters.itemByName('view_orientation_mode').expression = "'axesZX'" ## Setting tool orentation mode to select Z axis/plane & X axis
opInput.parameters.itemByName('view_orientation_flipZ').expression = 'true'
#Adding the operation
pocketOp = setup.operations.add(opInput)
edge = body.edges.item(0) ## Body is a brepbody
pocketFace = body.faces.item(0)
## seleting my edge for Z Axis
toolAxis: adsk.cam.CadObjectParameterValue = pocketOp.parameters.itemByName("view_orientation_axisZ").value
toolAxis.value = [edge]
## Select a face for pocket
pocketSelection: adsk.cam.CadContours2dParameterValue = pocketOp.parameters.itemByName("pockets").value
faces = pocketSelection.getCurveSelections()
face_ = faces.createNewPocketSelection()
face_.inputGeometry = [pocketFace]
pocketSelection.applyCurveSelections(faces)
Thanks,
Boopathi Sivakumar
Senior Technology Consultant