Expected Point, got Point

Why?

image

The Point expected is either a System.Drawing.Point or a Rhino.Geometry.Point2d. You can see the two overloads here

https://developer.rhino3d.com/api/RhinoCommon/html/Overload_Rhino_Display_RhinoView_ScreenToClient.htm

MouseCursor.Location gives you already a Point2d, so use that directly.

Categorized.
Please assign your new messages to the appropriate category.
Thanks

Thanks @nathanletwory

MouseCursor.Location gives Point2d, but ScreenToClient expects Point. How do I convert it?

I’m actually want to draw a brush stock that is thicker when mouse move slowly, and thinner when mouse move fast.

So I end up working it out… after heaps of trial and error

This puts a point at my mouse cursor position! :slight_smile:

image

but, when i put a timer on it, Rhino viewport locks up after about 5 seconds

As I mentioned before, the overload should automatically take the Point2d. This works just fine:

import Rhino

pos = Rhino.UI.MouseCursor.Location

res = Rhino.RhinoDoc.ActiveDoc.Views.ActiveView.ScreenToClient(pos)

print res

To dynamically draw while moving mouse you may want to use the dynamic draw approach. Here is an example:

Here the guide to the C++ version that explains a bit more Dynamically Drawing Geometry when Picking Points with C/C++