Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5745

Ortho Issue in Custom.GetPoint Script

$
0
0

@spineribjoint1 wrote:

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()

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 5745

Trending Articles