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: 

User parameters null after one variable is set?

Message 1 of 2
179 Views, 1 Reply

User parameters null after one variable is set?

I send a set of data to Fusion through a web app. My add in then parses the data and gets an array of user parameter names and the values that they are to be set to. I then run a loop where each user parameter is accessed through the itemByName method and the expression is set to the value that I send.


This works fine for the first variable, but the second time through the loop no variable name can be found. If I alter the order in which the parameter names are sent, the effect is still the same. It is as if the userParameters are reset after an expression is set?



# With the design open, alter all of the sent parameters
design = app.activeProduct
for n in range(len(eqNames)):
    thisParam = design.userParameters.itemByName(eqNames[n])
    if thisParam is None:
        print('Null variable - '+eqNames[n])
        thisParam.expression = eqValues[n]



The first time through the loop, the user parameter is set appropriately. Every time thereafter, I get a null/None.

Message 2 of 2

I was eventually able to get this to work. It was a combination of whitespace at the start of the variable names and the use of adsk.fusion.Design.cast(app.activeProduct) vs app.activeProduct

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