Object API ››
Parent Previous Next


There are three basic forms of ENS_GROUP objects. The first is encountered as part of the object tree rooted in the ENS_CASE objects. These objects are not marked as selections and can be returned as some an object’s PARENT. There are restrictions on the types of objects that can be added to these objects and they cannot move between cases. All such groups will have PARENTs. The second are the core selection objects. These can be accessed by core.selection() and are marked as selections. They cannot be destroyed and are owned by EnSight. They can only hold homogeneous objects based on the parameter passed to core.selection(). They are intimately tied to the native EnSight GUI and reflect widget selections. The final type are “user” selection groups. These are created with core.create_group() and can store non-homogeneous objects. These are owned by Python and can be destroyed at will. They are normally used to wrapper lists of objects to allow for more efficient get/set property operations.



In EnSight 10.0, the ENS_GROUP object plays a much more important role in the GUI than it did in 9.x.  This is outlined on the page EnSight 10.0 Groups.


In EnSight 10.0.2(h), the ENS_GROUP object was significantly updated. The most important addition is a 3D transformation that is applied to the children of this group when they are drawn. This is sort of like an EnSight 'frame', except that the transformations are hierarchical. The group object does three transformations: a rotation, a translation and a scale.  These transformations are independent and applied in that order.

New attributes added in EnSight 10.0.2(h):

New methods added in EnSight 10.0.2(h):

ENS_GROUP - selection object

Selection objects are special ENS_GROUP objects that reflect the current selections in the EnSight GUI. These include ENS_PART and ENS_ANNOT objects. If the selection object is for the ENS_PART or ENS_VAR selection, the list of children can be part/var ids or the string names of the parts/vars to be added. Adding an object to one of these objects changes the current selection and removing one from this group unselects it.

ENS_GROUP - other Python protocols

The ENS_GROUP (and ENS_CASE) objects implement portions of the Python sequence protocol. These include length, indexing, contains and iteration. An example based on selection objects:

for i in core.PARTS:

    i.SELECTED = True

# Get selection object

sel = core.selection(ENS_PART)

# Note: sel is an ENS_GROUP object!

print "Number of objects = ",len(sel)

for i in sel:

    print(" {}".format(i.DESCRIPTION))

# test for presence

print("Is the first part selected: {}".format(core.PARTS[0] in sel))