Message 1 of 10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi -I am approx 4 hrs into API's and I want to do some simple user parameter manipulation.
I have copied the below script from a Brian Ekins post back in 2015
import adsk.core, adsk.fusion, adsk.cam, traceback, math
def run(context😞
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
des = adsk.fusion.Design.cast(app.activeProduct)
userParams = des.userParameters
if ui.messageBox('Change to configuration one?', 'Parameter Edit', adsk.core.MessageBoxButtonTypes.YesNoButtonType, adsk.core.MessageBoxIconTypes.QuestionIconType) == adsk.core.DialogResults.DialogYes:
userParams.itemByName('Length').expression = '50'
userParams.itemByName('Height').expression = '30'
else:
userParams.itemByName('Length').expression = '30'
userParams.itemByName('Height').expression = '20'
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
unfortunately I am getting an error " 'none type' object has no attribute expression"
FYI I have created the two parameters in Fusion user parameters as in the above and made them favourites (not sure if that matters)
Your help would be greatly appreciated. Kind regards Paul
Solved! Go to Solution.