Switching model parameters between user parameters

Switching model parameters between user parameters

jeremiah_boe
Contributor Contributor
411 Views
1 Reply
Message 1 of 2

Switching model parameters between user parameters

jeremiah_boe
Contributor
Contributor

I am trying to set up an iLogic model where a model parameter has the need to switch between two user parameters. Instead of just having the value show up in the expression (this I have figured out) I would like the model parameter to keep the name of the user parameter in the expression.

 

If Parameter1 = "Text1" Then

      d10 = "Test1"

Else

     d10 = "Test2"

End If

 

I am running Inventor 2019.4.9

 

0 Likes
Accepted solutions (1)
412 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor
Accepted solution

It looks like your user parameter (Parameter1) may be a text type user parameter, instead of a numerical type; and it looks like you may be trying to assign the value of that user parameter to the model parameter.  That won't work, because model parameters can't hold text type values or boolean type values.

     If you want to set the equation of a parameter using iLogic, and you want to include the name(s) of other parameter(s) within that equation, you must assign this equation to the parameter's 'expression', not to its value.  The 'Value' of a numerical parameter is a numerical data type, while the 'Expression' of any parameter is always a String data type.  The parameter's expression is then evaluated, to produce its Value.

     Here's how you can put the name of another parameter within the expression of a parameter:

Parameter.Param("d10").Expression = "Test1"

(Where "d10" is the name of a numerical model parameter, and "Test1" is the name of a numerical model or user parameter.)

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you have time, please... Vote For My IDEAS 💡or you can Explore My CONTRIBUTIONS

Inventor 2021 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes