Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

Recent update broke cam.postProcess functionality

mikko.husari
Enthusiast Enthusiast
186 Views
1 Reply
Message 1 of 2

Recent update broke cam.postProcess functionality

mikko.husari
Enthusiast
Enthusiast

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.

mikkohusari_0-1696589131131.png

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)

 

0 Likes
Accepted solutions (1)
187 Views
1 Reply
Reply (1)
Message 2 of 2

mikko.husari
Enthusiast
Enthusiast
Accepted solution

I have confirmed that the issue comes up only when tool numbers overlap. Our machine does not care about tool numbering when boring holes, so we have all of our drills with the default number 32.

 

when posting by hand we are greeted with a confirmation dialog. When using the CAM API, no such dialog is presented and things just crash.

0 Likes