I use this code to get the mouse position:
public static Point3d pt = new Point3d();
public static IGH_Component comp;
public class FeedBack : Rhino.UI.MouseCallback
{
public FeedBack()
{
this.Enabled = true;
}
protected override void OnMouseMove(Rhino.UI.MouseCallbackEventArgs e)
{
Rhino.Display.RhinoView v = e.View;
Line line = v.ActiveViewport.ClientToWorld(e.ViewportPoint);
Plane cplane = v.ActiveViewport.ConstructionPlane();
double t;
Rhino.Geometry.Intersect.Intersection.LinePlane(line, cplane, out t);
pt = line.PointAt(t);
comp.ExpireSolution(true);
e.Cancel = true;
}
}
Now I tried to detect mouse clicks.
When the mouse is clicked I want to get the mouse position (x,y,z of the selected viewport).
I tried to change the code to MouseUp but it causes problems with the viewports in Rhino.
I want to use both functions (MouseMove and MouseClick) at the same time.
Is there a way to do this in python?
Thanks.