Community
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.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Error Adding User Parameter Using Python

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
garyTAC3Y
318 Views, 2 Replies

Error Adding User Parameter Using Python

garyTAC3Y
Participant
Participant

Hello All,

 

I was successful with pulling all of my userParameters from a design, converting them to JSON, then saving them to a file. Now that I have switched to a new design, I am trying to read that saved file, convert back from JSON to a nested dictionary, and then create userParameters using the info in that nested dictionary.

 

Everything works great up to the point where I try to create (ADD) a new userParameter. No matter what I use for parameters in the app.activeProduct.userParameters.add, I get...

 

TypeError: in method 'UserParameters_add', argument 3 of type 'adsk::core::Ptr< adsk::core::ValueInput > const &'

 

from...

        design = app.activeProduct
        userp=design.userParameters
        result = userp.add('testing',123,'in','this is a test')

This is a static example of course. I reverted to this after the elements from my dictionary were throwing the same error.

Thanks!

 

 

0 Likes

Error Adding User Parameter Using Python

Hello All,

 

I was successful with pulling all of my userParameters from a design, converting them to JSON, then saving them to a file. Now that I have switched to a new design, I am trying to read that saved file, convert back from JSON to a nested dictionary, and then create userParameters using the info in that nested dictionary.

 

Everything works great up to the point where I try to create (ADD) a new userParameter. No matter what I use for parameters in the app.activeProduct.userParameters.add, I get...

 

TypeError: in method 'UserParameters_add', argument 3 of type 'adsk::core::Ptr< adsk::core::ValueInput > const &'

 

from...

        design = app.activeProduct
        userp=design.userParameters
        result = userp.add('testing',123,'in','this is a test')

This is a static example of course. I reverted to this after the elements from my dictionary were throwing the same error.

Thanks!

 

 

Labels (3)
2 REPLIES 2
Message 2 of 3
kandennti
in reply to: garyTAC3Y

kandennti
Mentor
Mentor
Accepted solution

Hi @garyTAC3Y -San.

 

The second argument must be a ValueInput object.

        userp: adsk.fusion.UserParameters = design.userParameters
        result = userp.add(
            'testing',
            adsk.core.ValueInput.createByReal(123),
            'in',
            'this is a test'
        )
2 Likes

Hi @garyTAC3Y -San.

 

The second argument must be a ValueInput object.

        userp: adsk.fusion.UserParameters = design.userParameters
        result = userp.add(
            'testing',
            adsk.core.ValueInput.createByReal(123),
            'in',
            'this is a test'
        )
Message 3 of 3
garyTAC3Y
in reply to: kandennti

garyTAC3Y
Participant
Participant
Thank you for the info! I see that I somehow missed the object type required and now I have read up on it. I sincerely appreciate the help!
1 Like

Thank you for the info! I see that I somehow missed the object type required and now I have read up on it. I sincerely appreciate the help!

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

Post to forums  

Autodesk Design & Make Report