Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Slider Command Input Help (Command Inputs in General)

Message 1 of 3
636 Views, 2 Replies

Slider Command Input Help (Command Inputs in General)

Hey all,

I'm new to Fusion's API and to Python in general, and I'm having a lot of trouble creating command inputs. Essentially, I have a basic sketch I want to make that's driven by certain dimensions passed in by the user when the script is run. I'm using the "Create Bolt" script as scaffolding, but I'm having trouble switching from input values (included in the Bolt script) to slider inputs. I've read the documentation on command inputs but, not being a native programmer, it yielded no help. Can anybody assist with some high-level conceptualization of what pieces of code need to be present to get slider inputs? (What are the CommandCreatedHandler, CommandExecuteHandler, CommandDestroyHandler, etc?)


Alternatively, here's the specific problem I'm having.

This is the snippit within the CommandCreatedHandler that I'm attempting to use to get user input:

            #define the inputs
            inputs = cmd.commandInputs
            inputs.addStringValueInput('boardName', 'Board Name', defaultBoardName)

            inputs.addFloatSliderCommandInput('camber', 'Camber','in',.1,1)

The string value input ('Board Name') works fine, but the Float Slider throws errors. Specifically, it seems to be angry with the corresponding part of the CommandExecuteHandler:

class BoardCommandExecuteHandler(adsk.core.CommandEventHandler):
    def __init__(self):
    def notify(self, args):
            unitsMgr = app.activeProduct.unitsManager
            command = args.firingEvent.sender
            inputs = command.commandInputs

            board = Board()
            for input in inputs:
                if == 'boardName':
                    board.boardName = input.value
                elif == 'camber':
                    board.camber = input.value

The text in red shows the part that's throwing the error. What's wrong with this?


Any assistance/explanation greatly appreciated. Thanks,


Message 2 of 3
in reply to: Anonymous

Hi myles,


For this part "elif == 'camber': board.camber = input.value", FloatSliderCommandInput doesn't have property "value" but "valueOne" and "valueTwo", because it can have two values. So calling of property "value" will throw exception. Please change the property to "valueOne" and try again.


Best regards,




Message 3 of 3
in reply to:

Wow, quick response and it worked perfectly! Funny how 3 letters can keep me stumped for so long...


Thanks a ton!


Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th

Autodesk Design & Make Report