get_const_val#

Variables.get_const_val(cname: str, part_list: List[str | int | ENS_PART] | None = None, undef_none=False) float | None | List[float | None]#

Return a float value of a variable Case constant at the current timestep, or return a list of values one for each part if a per part constant.

Parameters:
cname: str

the text name of the constant or ENS_VAR object

part_list: list

The list of part objects to get the constant values on. It can either be a list of names a list of IDs (integers or strings) or directly a list of ENS_PART objects. If not provided, all the parts will be considered.

undef_none: bool

if False (default) returns undef value (ensight.Undefined) if var value is undefined. If False, for undefined values None will be returned

Returns:
float or list of float:

if the variable is a constant, it will either return the constant value, ensight.Undefined or None depending on the input. If the variable is a constant per part, a list of floats, ensight.Undefined or None will be returned