Mouse events

unhandled

(Christianwagner84) #1

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.


(David Rutten) #2

The code you posted is C#, do you want an answer in python?


(Christianwagner84) #3

An answer in python would be great.


(David Rutten) #4

<bow out>david<\bow out>


(Christianwagner84) #5

A solution in python would be nice but C# is also okay.