cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Set Global Variable from Parameter Table

Set Global Variable from Parameter Table

Currently parameter tables do not support Global Variables. Even the pass-through solution in 21.2 doesn't work, because it sets the 'Data' node as a number but it should be a string. The best solution I've found is to use the standard "Set Node Value" template for the On Set field and manually change

reference.value = newValue;

to

reference.value = string.fromNum(newValue);

Of course, I still have to find the path to "MODEL:/Tools/GlobalVariables/MyGlobalVariable/Data" and paste that into the Reference field.

2 Comments

A option could be to allow any variable anywhere in a model, to be marked as a parameter and if so marked, show it in the parameter section of the toolbox. That will solve this problem and also that it is not possible to have several parameter tables with identical field names.

JordanLJohnson
Autodesk

Model Parameters are globally accessible, so I suspect new models will simply use them instead of Global Variables.

Existing models attempting to upgrade so that global variables use parameter values would add an OnReset trigger to the model, and apply the value here, instead of in the OnSet trigger of the parameter itself:

MyGlobalVar = Model.parameters.Parameter1;

Parameter values are set before the Model's OnReset fires, so this method applies the value.

I would be interested to discuss further, if these two ideas don't resolve your concerns.

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

Submit Idea