
Not applicable
05-28-2021
01:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I would like to change an orientation of drill operation by Python.
I tried to change a few below parameters.
- overrideToolView: 'true'
- view_orientation_mode: "'axesZX'"
- view_orientation_flipZ: 'true'
- view_orientation_axisZ: 'true'
But I got an error when change 'view_orientation_axisZ'.
The error said "can't change this value".
Is there a way that to select YZPlane for axisZ ?
My purpose is to set toolpaths for top, bottom, back, top, right and left in Python like sample.f3d.
Thank you.
sample code
import adsk.core, adsk.cam, os, traceback
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
doc = app.activeDocument
products = doc.products
cam = adsk.cam.CAM.cast(products.itemByProductType("CAMProductType"))
setups = cam.setups
setup = setups[0]
overrideToolView = operation.parameters.itemByName('overrideToolView')
overrideToolView.expression = 'true'
mode = operation.parameters.itemByName('view_orientation_mode')
mode.expression = "'axesZX'"
flipz = operation.parameters.itemByName('view_orientation_flipZ')
flipz.expression = 'true'
axisx = operation.parameters.itemByName('view_orientation_axisX')
axisx.expression = 'true'
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
Solved! Go to Solution.