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: 

Create a 2D-operation and set the tool orientation over API

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
maurizio_manzi
206 Views, 2 Replies

Create a 2D-operation and set the tool orientation over API

Hello,
It is now possible, for example, to insert a pocket operation via the API and to select various parameters including geometry via the API. Is it also possible to set the complete tool orientation via the API (see image)? Does anyone have an example?

 

 

ToolOrientation.png

 

Best regards

Maurizio

 

2 REPLIES 2
Message 2 of 3

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

Message 3 of 3

Thank you very much

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