# Filename: pl_append.py
# Purpose: Adds a point to the end of a line.
# Returns: Bool.

# In this case, vulcan_gui imports vulcan
# so, 'from maptek import vulcan' does not need to be called explicitly.
from maptek import vulcan_gui

# new point [x,y,z,w,t,name]
# When t=1, then the new point will be connected to the line.
# If t=0, then just a point will be added to the object without connecting.
pt1 = [77360.0, 4560.0, 0.0, 0.0, 1, 'new_point']  

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

for obj in sel:
   print (f"Adding pt to: {obj.name}")  # report results to the user
   obj.append(pt1)  # add the new point to the line object
   sel.replace(obj)  # replaces the old object so changes are seen immediately