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: 

Error: missing 1 required positional argument: 'initialValue' but I did input `initialValue`

Message 1 of 3
776 Views, 2 Replies

Error: missing 1 required positional argument: 'initialValue' but I did input `initialValue`

Hi there!

I am new to use Fusion360 API although I have used Fusion360 as my major modeling tools for a while. And I feel amazing about Fusion360 API for what they can do. I have never imagine modeling by codes. However, Fusion360 API is not that easy to learn because it is not widespread to find solutions to debug.

So I have to write this post to asking help. Sorry for bothering you.


Here is my problem:

I just want to create a dialog to get some user input so I using `CommandInputs` and `addValueInput` method to get user input. That seems easy, right? But here is something I got confused.

My python code part is here:

inputs = adsk.core.CommandInputs

length_input = inputs.addValueInput('length_input', 'Length(cm)', 'cm', default_length)


But when I run the code and it comes out with `TypeError: addValueInput() missing 1 required positional argument: 'initialValue'`

I did put `default_length` as the `initialValue` and its type is `ValueInput`. I don't know what I did wrong and I could find out the result using google. This have stuck me several days. 😥

(I guess this is a foolish problem but I did cost a lot of time here. This cause me EMO 😥)


Best Wishes!



Message 2 of 3
in reply to: 11713013

The problem is you aren't getting the inputs object the right way. The inputs object is linked to a command, so in your CommandCreated class you need to have this :

cmd = args.command
inputs = cmd.commandInputs

The reason you were getting this error is that since you weren't dealing with the right object, the 'self' argument in the class was missing, thus everything mas moved back and the last positional argument wasn't given.


In general in the Fusion API, you'll almost never get an object from the class or a constructor, you'll either use something like a create method or get it through already existing objects (like in this example).


If you still have problems, this sample code form the documentation might help :


Message 3 of 3
in reply to: tykapl.breuil

Oh, I see.

You are so nice!

Thank you so much for this answer and I will give it a try!

It seems I do not fully understand the UserInterface part of Fusion360 API. I should re-read the manual. 


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