RAInputVariables#

class ansys.rocky.app.ra_input_variables.RAInputVariables(id: str, model_id: str | None = None)#

Bases: ansys.rocky.app.api_element_item.ApiElementItem

Rocky PrePost Scripting wrapper for the list of parametric input variables.

The input variables correspond to the Variables list on the Input tab of a project’s Expressions/Variables dock. This wrapper can be used to create, remove and list a project’s input variables.

Retrieve the RAInputVariables through the corresponding RAProject. Example usage:

project = app.GetProject()
input_variables = project.GetInputVariables()

input_variables.CreateVariable('a', value=1)
input_variables.CreateVariable('b', value=2)

input_variables.RemoveVariable('a')

for variable in input_variables:
    variable.SetValue(3)

b = input_variables.GetVariableByName('b')
b.SetValue(4)

Overview#

CreateVariable

Create a new input variable. Returns the new variable.

RemoveVariable

Remove an input variable.

GetVariableByName

Get an existing input variable via its name.

Import detail#

from ansys.rocky.app.ra_input_variables import RAInputVariables

Method detail#

classmethod RAInputVariables.GetWrappedClass()#
classmethod RAInputVariables.GetClassName() str#
RAInputVariables.CreateVariable(name: str, value: float = 0.0) RAParametricVar#

Create a new input variable. Returns the new variable.

Parameters:
  • name – The variable’s name.

  • value – The initial value for the variable.

RAInputVariables.RemoveVariable(variable: RAParametricVar | str) None#

Remove an input variable.

Parameters:

variable – Either an instance of RAParametricVar or the name of the variable to remove.

RAInputVariables.GetVariableByName(name: str) RAParametricVar#

Get an existing input variable via its name.

Parameters:

name – The input variable’s name.

RAInputVariables.__len__() int#
RAInputVariables.__getitem__(index)#
RAInputVariables.__iter__()#