ComponentManager#

class ansys.mapdl.core.component.ComponentManager(mapdl)#

Collection of MAPDL components.

Notes

Components need to be selected using Mapdl.cmsel() before being listed in Mapdl.components

Examples

Simply list all the selected components:

>>> mapdl.components
MAPDL Components
----------------
MYCOMP1                          : NODE
MYCOMP2                          : ELEM

Get a component:

>>> mapdl.components["mycomp1"]
Component(type='NODE', items=(1, 3, 6))

Set a component specifying the type and items:

>>> mapdl.components["mycomp3] = "KP", [1,2,3]

Set a component without specifying the type, by default it is NODE:

>>> mapdl.components["mycomp4"] = (1, 2, 3)
/Users/german.ayuso/pymapdl/src/ansys/mapdl/core/component.py:282: UserWarning: Assuming a NODES selection.
It is recommended you use the following notation to avoid this warning:
\>\>\> mapdl.components['mycomp3'] = 'NODES' (1, 2, 3)
Alternatively, you disable this warning using:
> mapdl.components.default_entity_warning=False
warnings.warn(

You can change the default type by changing Mapdl.components.default_entity

>>> mapdl.component.default_entity = "KP"
>>> mapdl.component["mycomp] = [1, 2, 3]
>>> mapdl.component["mycomp"].type
'KP'

You can also create a component from the already selected entities:

>>> mapdl.lsel("S",1, 2)
>>> mapdl.components["mylinecomp"] = "LINE"
>>> mapdl.components["mylinecomp"]
(1, 2)

Selecting a component and retrieving it:

>>> mapdl.cmsel("s", "mycomp3")
>>> mapdl.components["mycomp3"]
Component(type='KP', items=(1, 2, 3))

Methods

ComponentManager.items()

Return a view object that contains the name-type pairs for each component.

ComponentManager.select(names[, mute])

Select Select components given their names

Attributes

ComponentManager.default_entity

Default entity for component creation.

ComponentManager.default_entity_warning

Enables the warning when creating components other than node components without specifying its type.

ComponentManager.logger

Access to the logger.

ComponentManager.names

Return a tuple that contains the components.

ComponentManager.types

Return the types of the components.