Ortho Issue in Custom.GetPoint Script

If “Ortho” is On or Shift key is held points are drawn orthogonal only in relation to the first point. Any idea how to fix this so it works like rhino polyline command?

import Rhino
import rhinoscriptsyntax as rs

def indexedPolyline():
    gp = Rhino.Input.Custom.GetPoint()
    gp.SetCommandPrompt("Indexed Polyline")

    dblOptionO = Rhino.Input.Custom.OptionDouble(0.1, 0, 99.9)
    gp.AddOptionDouble("ProjectOut", dblOptionO)

    points = []
    while True:
        get_rc = gp.Get()
        if gp.CommandResult()!=Rhino.Commands.Result.Success:
            return gp.CommandResult()

        if get_rc==Rhino.Input.GetResult.Point:
            p = gp.Point()
            points.append(p)
            rs.AddTextDot(len(points), p)
            gp.DrawLineFromPoint(p, True)
            if len(points) >= 2:
                rs.AddLine(points[-1], points[-2])

        elif get_rc==Rhino.Input.GetResult.Option:
            if not dblOptionO.CurrentValue: gp.EnableDrawLineFromPoint(False)
    return Rhino.Commands.Result.Success

indexedPolyline()

Hi @spineribjoint1,

Have a look at this example - it might give you a few ideas.

https://github.com/mcneel/rhino-developer-samples/blob/6/rhinopython/SampleGetPolyline.py

– Dale

Thank you @dale.

This helps a lot.