# Filename: pl_set_connected.py
# Purpose: Connect points in a line.
# 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

# You must call set_connected() for each section you want to connect.
# Indices correspond to point sequence numbers, which can be seen by
# right-clicking on object, then selecting Label > Point sequence.

for obj in sel:
   # connect first section
   obj.set_connected(3,6,True)  # (start pt, end pt, connection on or off)
   
   # connect a different section
   obj.set_connected(8,10,True)  # (start pt, end pt, connection on or off)
     
   sel.replace(obj)  # replaces the old object so changes are seen immediately