I think this may be what you are looking for
import rhinoscriptsyntax as rs
import Rhino
import System.Drawing.Color
import math
def CustomPerpLine(point_a):
# Color to use when drawing dynamic lines
line_color_1 = System.Drawing.Color.FromArgb(255,0,0)
line_color_2 = System.Drawing.Color.FromArgb(0,255,0)
# This is a function that is called whenever the GetPoint's
# DynamicDraw event occurs
def GetPointDynamicDrawFunc( sender, args ):
point_b = args.CurrentPoint
#draw a line from the first picked point to the current mouse point
args.Display.DrawLine(point_a, point_b, line_color_1, 1)
line = Rhino.Geometry.Line(point_a, point_b)
length = line.Length
cplane = plane = args.Viewport.GetConstructionPlane().Plane
angle = math.radians(90)
xform = Rhino.Geometry.Transform.Rotation(angle, cplane.Normal, point_b)
line.Transform(xform)
args.Display.DrawLine(line.From, line.To, line_color_2, 1)
# Create an instance of a GetPoint class and add a delegate
# for the DynamicDraw event
gp = Rhino.Input.Custom.GetPoint()
gp.DynamicDraw += GetPointDynamicDrawFunc
gp.Get()
if( gp.CommandResult() == Rhino.Commands.Result.Success ):
pt = gp.Point()
rs.AddLine(point_a, pt)
if( __name__ == "__main__" ):
#get the first point
point_a = rs.GetPoint("point A")
if point_a:
CustomPerpLine(point_a)