This script example demonstrates how to find the unique values of any attribute in a model layer or background layer. In this example, unique conduit height (GEOM1) and unique conduit cross-section shapes (XSection) are found and printed.
Example
# get unique parameter def unique(links, parameter): lt = [] for link in links: val = link[parameter] # pull in all the attribute values if not val in lt: lt.append(val) # create a list of the unique values return lt conduits = pcpy.Map.Layer["Conduits"].get_entities() # get Conduits entities print unique(conduits, 'XSection') # print unique cross-section shapes print unique(conduits, 'GEOM1') # print unique conduit heights