Quantcast
Channel: Grasshopper Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 3655

Drawing a line from Point to Cursor during GetPoint

$
0
0

Hi there,

I have a c# component to pick two points and try to preview a line during the second GetPoint operation. The line only gets updated when I manipulate the camera and not when I move the mouse.
Maybe I subscribe to the wrong event?

private void RunScript(ref object A)
  {
    Rhino.Input.Custom.GetPoint getPt = new Rhino.Input.Custom.GetPoint();

    getPt.Get();
    basePt = getPt.Point();

    // Preview Line for second GetPoint
    getPt.DynamicDraw += drawMethod;
    getPt.Get();

    display.Dispose();
  }

// <Custom additional code> 
Rhino.Display.CustomDisplay display = new Rhino.Display.CustomDisplay(true);
Point3d basePt = new Point3d();

void drawMethod(object sender, Rhino.Input.Custom.GetPointDrawEventArgs e)
{
  display.Clear();
  display.AddLine(new Line(basePt, e.CurrentPoint), System.Drawing.Color.DodgerBlue, 10);
}

5 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 3655


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>