Use a Variable value in Expression?

Carlos Fondevila
Carlos Fondevila Altair Community Member
edited September 17 in Community Q&A

Hi all,

I'm trying to use a Variable value in a Expression, for example, I've created the variable "Speed":

image

And I want to use it as a variable in the body Motion Expression:

image

 

But it doesn't works.

Do you know haw can I use variables values to use in Expressions?

 

Thanks!

 

Best Answer

  • GTT Adam
    GTT Adam
    Altair Employee
    edited September 17 Answer ✓

    Hi Carlos,

    For variables in the Expression Builder, you usually have to wrap them in curly brackets: { }

    Solver Variables can also be referenced using the VARVAL call: {sv_position.VARVAL}

     

    Hope this helps!

    Adam Reid

Answers

  • GTT Adam
    GTT Adam
    Altair Employee
    edited September 17 Answer ✓

    Hi Carlos,

    For variables in the Expression Builder, you usually have to wrap them in curly brackets: { }

    Solver Variables can also be referenced using the VARVAL call: {sv_position.VARVAL}

     

    Hope this helps!

    Adam Reid

  • Praful
    Praful
    Altair Employee
    edited September 13

    Hi Carlos,

    For variables in the Expression Builder, you usually have to wrap them in curly brackets: { }

    Solver Variables can also be referenced using the VARVAL call: {sv_position.VARVAL}

     

    Hope this helps!

    Adam Reid

    In addition to the curly braces around the variable, the entire expression has to be provided within backtics ` ` (its a key that looks similar to apostrophe, available at the top left near Esc)

    So your expression should look like

    `STEP(TIME,0,0,5,{sv_position.value.lin})`

    Praful