Message 1 of 3
What's the event listener for user parameter changes?

Not applicable
04-28-2019
08:09 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have written an add-in which reads the list of user parameters and changes some sketchTexts. It works when I run it via a button on the toolbar, but I want it to update automatically if I add or change a parameter's name or value. What event listener can I use to watch for changes to the user parameters?
It's similar to the "Maintaining User Parameter references" question, but in that case the solution was addRadialDimension, and in my case there aren't any dimension types I can use because I'm changing the text of a sketchText, which is not dimension driven.
# Event handler for the commandCreated event. class ParametricTextCreatedEventHandler(adsk.core.CommandCreatedEventHandler): def __init__(self): super().__init__() def notify(self, args): eventArgs = adsk.core.CommandCreatedEventArgs.cast(args) cmd = eventArgs.command # I *think* I add something here to listen for a change in user parameters. But what?
# cmd.something? # Connect to the execute event. onExecute = ParametricTextExecuteHandler() cmd.execute.add(onExecute) handlers.append(onExecute)