Realtime track mouse cursor position in viewport and get coordinates

Quite some time ago I was following a tutorial for using CommandOptions with Python and the result was a colourful line drawn between the first click of the mouse (which creates one point) and the mouse cursor.

I am trying currently to display a leader with text in real time before being placed by the second click but I cannot find this tutorial.

Does anyone remember it?
Or has any clue how to do this?

I’d try Rhino.Input.Custom.GetPoint and the MouseMove/Down and DynamicDraw events.

I guess you’re talking about something like the example on this page:
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Input_Custom_GetPoint_DrawLineFromPoint.htm

import Rhino
from System.Drawing import Color
gp = Rhino.Input.Custom.GetPoint()
gp.SetCommandPrompt('Pick a point')
gp.DynamicDrawColor = Color.Red
gp.SetBasePoint(Rhino.Geometry.Point3d.Origin, False)
gp.DrawLineFromPoint(Rhino.Geometry.Point3d.Origin, True)
gp.Get()

Here you can find a more complicated example:

1 Like

Yes, that’s the one, thanks a lot. :partying_face: