# Filename: pl_set_direction.py
# Purpose: Sets the direction of a polyline.
# Returns: None.

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
    dir = obj.set_direction(0)  # 0 = clockwise, 1 = counter clockwise

    clockwise = obj.is_clockwise()  # check if clockwise

    print(f"{obj_name} clockwise: {clockwise}")