# Filename: pl_set_closed.py
# Purpose: Sets the polyline to closed.
# Returns: None.

from maptek import vulcan_gui

# use dynamic selection to select correct line object
sel = vulcan_gui.selection("Select layer object to connect points.")
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.set_closed(True)  # closes polygon
    sel.replace(obj)  # replaces the old object and preserves changes