ElementWithAddins#

class ansys.rocky.app.ra_addins.ElementWithAddins#

Rocky PrePost Scripting wrapper for properties in a module or elements with module properties like in material interaction and particle input.

Overview#

GetModuleProperties

Get the names of the module properties.

GetModuleProperty

Get the value of a module property.

SetModuleProperty

Set the value of a module property.

GetValidOptionsForModuleProperty

Get all valid options only for properties that have a list of possible options.

ListAddinCommands

Get the names of the active module commands.

ExecuteCommand

Execute a command related to the module.

Import detail#

from ansys.rocky.app.ra_addins import ElementWithAddins

Method detail#

ElementWithAddins.GetModuleProperties() → collections.abc.Sequence[AddinPropertyIdentifier]#

Get the names of the module properties.

Return type:

tuple(AddinPropertyIdentifier)

ElementWithAddins.GetModuleProperty(property_name: str | AddinPropertyIdentifier, unit: str | None = None) → float | bool | str | ansys.rocky.app.ra_addin_list.RAModulePropertyList#

Get the value of a module property.

Parameters:
  • property_name (Union[str, AddinPropertyIdentifier]) – The name of the module property to get.

  • unit (str) – The unit for value, just for scalar properties. If no unit is provided, the returned value will be in the unit that was set before (via SetModuleProperty()).

Return type:

float, bool, str or RAModulePropertyList

Returns:

  • For basic module properties like numbers and booleans, the returned value is a basic Python type (float, bool, or string)

  • For input files, the returned value is the string of the full path to the file

  • For properties that are lists of other properties, the returned value is a

    RAModulePropertyList.

ElementWithAddins.SetModuleProperty(property_name: str | AddinPropertyIdentifier, value: float | bool | str | ansys.rocky.app.api_element_item.ApiElementItem | None, unit: str | None = None) → None#

Set the value of a module property.

Parameters:
  • property_name (Union[str, AddinPropertyIdentifier]) – The name of the module property to set.

  • value (float, bool, str or ApiElementItem) – The value to set. If the property_name references to an enum property then value must be an str value. If the property_name references to an element reference (point cloud, particles, …) then the value can be either the name of the element (str) or an ApiElementItem representing it.

  • unit (str) – The unit for value, just for scalar properties. If no unit is provided, value is assumed to be the unit was set before.

ElementWithAddins.GetValidOptionsForModuleProperty(property_name: str) → collections.abc.Sequence[str | None]#

Get all valid options only for properties that have a list of possible options.

Parameters:

property_name (str) – The name of the module property.

Return type:

list[str]

ElementWithAddins.ListAddinCommands() → collections.abc.Sequence[AddinCommandIdentifier]#

Get the names of the active module commands.

Return type:

tuple(AddinCommandIdentifier)

ElementWithAddins.ExecuteCommand(command: str | AddinCommandIdentifier) → None#

Execute a command related to the module.

Parameters:

command (str | AddinCommandIdentifier) – The name or the AddinCommandIdentifier to be executed. Use ListAddinCommands to obtain a sequence of active commands.