Component#

class ansys.mapdl.core.component.Component(type_: Literal['NODE', 'NODES', 'ELEM', 'ELEMS', 'ELEMENTS', 'VOLU', 'AREA', 'LINE', 'KP'], items_: Tuple[str, Tuple[int] | List[int] | ndarray[Any, dtype[int64]]])[source]#

Component object

Object which contain the definition of a component.

Parameters:
type_str

The entity type. For instance “NODES”, “KP”, “VOLU”, etc

items_None, str, int, List[int], np.array[int]]

Item ids contained in the component.

Examples

To create a component object

>>> mycomp = Component("NODES", [1, 2, 3])
>>>  mycomp
Component(type='NODES', items=(1, 2, 3))

To index the content of the component object:

>>> mycomp[0]
1
>>> mycomp[1]
2

To access the type of the entities:

>>> mycomp.type
"NODES"

Convert to list:

>>> list(mycomp)
[1, 2, 3]

Methods

Component.count(value, /)

Return number of occurrences of value.

Component.index(value[, start, stop])

Return first index of value.

Attributes

Component.items

Return the ids of the entities in the component.

Component.type

Return the type of the component.