Find new parts

This function finds the new parts which are created when EnSight performs some part creation action. I discovered this gem inside skybox.py, which probably means Randy wrote it.

Download the script

 

Usage:

existing_parts = find_parts()
something_that_creates_parts()
new_parts = find_parts(existing_parts)
# you now have a list of all the parts created by something_that_creates_parts()

Code:

def find_parts(prev=None):
    l = ensight.query_parts(parts="all",client=1)
    out = []
    for i in l:
        out.append(i[0])
    if (prev):
        for i in prev:
            try:
                out.remove(i)
            except:
                pass
    return out

EnSight version: 9.1 and later
OS: all

Leave a Reply