# Filename: pl_center_average.py
# Purpose: Gets the center of a polyline by an average of the points.
# Returns: Point.

from maptek import vulcan_gui

# use dynamic selection to select correct object
sel = vulcan_gui.selection("Select layer object.")
sel.criteria = ["LINE", "POLYGON"]  # limit selection to a polyline object
sel.single_object = True  # prevents selection prompt from asking more than once

for obj in sel:
    obj_name = obj.get_name()  # get name of object
    pt = obj.center_average()  # get the center average of a polyline 

    print(f"Center average {obj_name}: {pt}")