# Filename: pl_get_pattern.py
# Purpose: Gets the fill pattern index of a polygon.
# Returns: Integer.

from maptek import vulcan_gui

# select layer from the screen
sel = vulcan_gui.selection("Select Object")  # prompt for selection
sel.criteria = ["LINE", "POLYGON"]  # limit selection to a line

# get all polyline objects in the layer as an indexed list
for obj in sel:
    if obj.is_closed(): # checks that the object is a closed polygon, not a line
        obj_name = obj.get_name()  # get name of object
        pattern = obj.get_pattern()  # get the fill pattern index of the polygon
        
        print(f"{obj_name} : Pattern index: {pattern}")