Parts: ENS_PART

Object API ››
Parent Previous Next

Parts: ENS_PART

Methods:

Examples

An example creating a clip part using the current selection of parts explicitly (note by default the same parents are used implicitly.

# create a new clip using the currently selected parts as parents

a = core.DEFAULTPARTS[ensight.PART_CLIP_PLANE].createpart(sources=core.selection(ENS_PART))

# change its name (remember the return value is a list)

a[0].DESCRIPTION = "Hello"

# add to the current selection

core.selection(ENS_PART).addchild(a[0]) 


An example of using get_values() with the crash test case:

part = ensight.objs.core.PARTS['engine'][0]

coords = ensight.objs.core.VARIABLES['Coordinates'][0]

d = part.get_values([coords,  'plastic', 'Analysis_Time'],activate=1)

print(d.keys())

['Analysis_Time', 'plastic', Class: ENS_VAR, desc: 'Coordinates', CvfObjID: 1005, cached:no, 'NODE_IDS']

print(d[coords].shape)

(562L, 3L)

print(d['Analysis_Time'][0])

0.235

Attributes:


Note: the following method is obsolete. attrtree() should be used instead.

Example using the attrgroupinfo()/attrinfo() calls:

def walkit(part,v,ins):

    print("{} Group name= {}".format(ins, v['name']))

    print("{} Attrs:".format(ins))

    for i in v['attrlist']:

        info = part.attrinfo(i)

        print("{} {} ({:d}) - '{}'".format(ins, info['name'], i, info['desc']))

    for i in v['grouplist']:

        walkit(part,i,ins+" ")

 

a = core.PARTS[0]

list = a.attrgroupinfo()

walkit(a,list,"")