ensobjlist#

class ansys.pyensight.core.ensobjlist(*args, session: Session | None = None, **kwargs)#

Class used when returning lists of EnSight proxy objects. A subclass of ‘list’.

In the EnSight object Python bindings, whenever a list is returned that is known to exclusively contain ENSOBJ subclass objects, the ensobjlist (list subclass) is returned instead. This class simply adds a few ENSOBJ specific methods and some functionality to the list object.

One additional feature of the ensobjlist is that the __getitem__() interface supports strings and lists of strings. In that situation, the object acts as if the find() method is called.

These are equivalent

>>> a = objlist["Hello"]
>>> a = objlist.find("Hello", attr="DESCRIPTION")

These are as well

>>> a = objlist[("Hello", "Goodbye")]
>>> a = objlist.find(("Hello", "Goodbye"), attr="DESCRIPTION")
Parameters:
*args

Superclass (list) arguments

**kwargs

Superclass (list) keyword arguments

Methods

ensobjlist.append(object, /)

Append object to the end of the list.

ensobjlist.clear(/)

Remove all items from list.

ensobjlist.copy(/)

Return a shallow copy of the list.

ensobjlist.count(value, /)

Return number of occurrences of value.

ensobjlist.extend(iterable, /)

Extend list by appending elements from the iterable.

ensobjlist.find(value[, attr, group, wildcard])

Find objects in the list using the ENSOBJ interface.

ensobjlist.get_attr(attr[, default])

Query a specific attribute for all ENSOBJ objects in the list

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

Return first index of value.

ensobjlist.insert(index, object, /)

Insert object before index.

ensobjlist.pop([index])

Remove and return item at index (default last).

ensobjlist.remove(value, /)

Remove first occurrence of value.

ensobjlist.reverse(/)

Reverse IN PLACE.

ensobjlist.set_attr(attr, value)

Set an attribute value on all contained objects

ensobjlist.sort(*[, key, reverse])

Sort the list in ascending order and return None.