Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
It was working fine for whole setups, but current version only accepts single operations as a parameter. We need to be able to postprocess full setups.
What happened?
I can post every operation to separate files, but If I try to post all of them at once it errors out.
This is the error if I try to post full setup.
Here is the test code:
import adsk.core, adsk.fusion, adsk.cam, traceback, os
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
doc = app.activeDocument
products = doc.products
product = products.itemByProductType('CAMProductType')
# check if the document has a CAMProductType. I will not if there are no CAM operations in it.
if product == None:
ui.messageBox('There are no CAM operations in the active document. This script requires the active document to contain at least one CAM operation.',
'No CAM Operations Exist',
adsk.core.MessageBoxButtonTypes.OKButtonType,
adsk.core.MessageBoxIconTypes.CriticalIconType)
return
cam = adsk.cam.CAM.cast(product)
# specify the program name, post configuration to use and a folder destination for the nc file
programName = '101'
outputFolder = cam.temporaryFolder
# set the post configuration to use based on Operation Type of the first Setup
postConfig = os.path.join(cam.personalPostFolder, 'biesse cix.cps')
units = adsk.cam.PostOutputUnitOptions.DocumentUnitsOutput
# create the postInput object
postInput = adsk.cam.PostProcessInput.create(programName, postConfig, outputFolder, units)
postInput.isOpenInEditor = False
# create the post properties
postProperties = adsk.core.NamedValues.create()
# create the disable sequence number property
disableSequenceNumbers = adsk.core.ValueInput.createByBoolean(False)
postProperties.add("showSequenceNumbers", disableSequenceNumbers)
# add the post properties to the post process input
postInput.postProperties = postProperties
setups = cam.setups
setup = setups.item(0)
# operations = setup.allOperations
# operation = operations.item(2)
cam.postProcess(setup, postInput)
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
So, cam.postProcess(operation, postInput) works but cam.postProcess(setup, postInput) does not work. It worked fine in previous version of fusion.
This is the version I am currently running:
Fusion 360 2.0.16985 x86_64
Active Plan: Subscription
Windows 11 Pro 22H2 (22621.2283)
Solved! Go to Solution.