User parameters null after one variable is set?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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])
else:
thisParam.expression = eqValues[n]
The first time through the loop, the user parameter is set appropriately. Every time thereafter, I get a null/None.