Here's a different approach that lets you get the current state of the Anti-Alias setting and set it to whatever value you want. Whatever change you make is also reflected in the UI. It uses the fact that ALL commands are exposed through the API and this command happens to be represented in the UI as a list control. This uses the API functionality of the list control to get a specific item in the list, check to see if it is checked or not and change its state.
def run(Context):
try:
app = adsk.core.Application.get()
ui = app.userInterface
# Get the "Effects" command.
effectsCmdDef = ui.commandDefinitions.itemById('ViewEffectCommand')
# Get the control definition associated with the command.
effectsCntrlDef = adsk.core.ListControlDefinition.cast(effectsCmdDef.controlDefinition)
# Iterate through the items in the list to find the one for "Anti-Aliasing".
# !!! This will only work in an English version of Fusion.
listItem = adsk.core.ListItem.cast(None)
antiAlias = adsk.core.ListItem.cast(None)
for listItem in effectsCntrlDef.listItems:
if listItem.name == 'Anti-Aliasing':
antiAlias = listItem
break
if antiAlias:
if antiAlias.isSelected:
ui.messageBox('Anti-Aliasing is on. Turning off.')
antiAlias.isSelected = False
else:
ui.messageBox('Anti-Aliasing is off. Turning on.')
antiAlias.isSelected = True
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
---------------------------------------------------------------
Brian EkinsInventor and Fusion 360 API Expert
Website/Blog:
https://EkinsSolutions.com