Skip to main content

Mechanical scripting interface

Variable

Last update: 14.01.2025

class Ansys.ACT.Mechanical.Fields.Variable

Bases: object

Represents an object that is either an input or an output for a P:Ansys.ACT.Mechanical.Fields.Variable.Field. Depending on whether it is an input or output and on the way it is defined, this object holds a series of discrete values or an expression that may involve other variables.

Overview

Methods

Name Description
GetDiscreteValue Changes a value at a given position in the tabular definition of the variable.
SetDiscreteValue Changes a value at a given position in the tabular definition of the variable.

Properties

Name Description
DefinitionType Gets a value that indicates how this variable is defined.
DiscreteValueCount Gets the number of discrete values of this variable.
DiscreteValues Gets or sets the discrete values of this variable or
Field Gets the owner field.
Formula Gets or sets the expression that is used to defined this variable, or
Index Gets the index of this variable in its container field.
IsInput Gets a value indicating whether this variable is an input for its container field. Otherwise, it is an output variable.
IsOutput Gets a value indicating whether this variable is an output for its container field. Otherwise, it is an input variable.
MinMaxDiscreteValues Returns a Tuple containing the min and max values from the list of discrete values.
Name Gets the variable’s name.
QuantityName Gets the name of the quantity represented by this variable.
Range Gets the domain of validity for variable’s value.
Unit Gets the symbol of the unit used to express this variable’s values.

Property detail

property Variable.DefinitionType : Ansys.ACT.Mechanical.Fields.VariableDefinitionType | None

Gets a value that indicates how this variable is defined.

property Variable.DiscreteValueCount : int | None

Gets the number of discrete values of this variable.

property Variable.DiscreteValues : List[Ansys.Core.Units.Quantity] | None

Gets or sets the discrete values of this variable or

property Variable.Field : Ansys.ACT.Mechanical.Fields.Field | None

Gets the owner field.

property Variable.Formula : str | None

Gets or sets the expression that is used to defined this variable, or

property Variable.Index : int | None

Gets the index of this variable in its container field.

property Variable.IsInput : bool | None

Gets a value indicating whether this variable is an input for its container field. Otherwise, it is an output variable.

property Variable.IsOutput : bool | None

Gets a value indicating whether this variable is an output for its container field. Otherwise, it is an input variable.

property Variable.MinMaxDiscreteValues : tuple[Ansys.Core.Units.Quantity, Ansys.Core.Units.Quantity] | None

Returns a Tuple containing the min and max values from the list of discrete values.

property Variable.Name : str | None

Gets the variable’s name.

property Variable.QuantityName : str | None

Gets the name of the quantity represented by this variable.

property Variable.Range : Ansys.ACT.Mechanical.Fields.Range | None

Gets the domain of validity for variable’s value.

property Variable.Unit : str | None

Gets the symbol of the unit used to express this variable’s values.

Method detail

Variable.GetDiscreteValue(index: int)

Changes a value at a given position in the tabular definition of the variable.

Variable.SetDiscreteValue(index: int, value: Ansys.Core.Units.Quantity)

Changes a value at a given position in the tabular definition of the variable.