# Dynamic Drawing of Lines Based on Chosen Points

**URL:** <https://discourse.mcneel.com/t/dynamic-drawing-of-lines-based-on-chosen-points/2199>\
**Category:** Scripting\
**Created:** [September 9, 2013, 5:59pm UTC](https://discourse.mcneel.com/t/dynamic-drawing-of-lines-based-on-chosen-points/2199 "2013-09-09T17:59:30Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![stevebaer](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/stevebaer/32/473567_2.png) [@stevebaer](https://discourse.mcneel.com/u/stevebaer)\
**Post date:** [September 9, 2013, 6:27pm UTC](https://discourse.mcneel.com/t/dynamic-drawing-of-lines-based-on-chosen-points/2199/2 "2013-09-09T18:27:13Z")

</div>

I think this may be what you are looking for

```python
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)

```

---

_[View the full topic](https://discourse.mcneel.com/t/dynamic-drawing-of-lines-based-on-chosen-points/2199)._
