Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have the following code (nonreelevant parts cut):
class mmCommandCreatedEventHandler(adsk.core.CommandCreatedEventHandler): def __init__(self): super().__init__() def notify(self, args): cmd = args.command inputs = cmd.commandInputs for body in rootComp.bRepBodies: if body.name[0:len(coreStr)] == coreStr: selInput = inputs.addSelectionInput(body.name, 'Faces with alternate center \'%s\'' % body.name, 'Select faces to receive alternate center') selInput.addSelectionFilter('Faces') selInput.addSelectionLimits(0, 0) # Connect up to command related events. onExecute = CommandExecutedHandler() cmd.execute.add(onExecute) handlers.append(onExecute)
For reasons I can't identify, if the body of the if loop is executed (string comparison returns true), the for loop is immediately exited and the lines starting with "# Connect up to command related eventss." are not executed. If the if loop isn't executed, the foor loop properly finishes and the final lines properly execute. I'm assuming that I'm missing something really silly, but I seriously can't figure out why this is happening. Does anyone else see what's going on?
Solved! Go to Solution.