Grasshopper

algorithmic modeling for Rhino

Hello everybody!

After reading this post:

http://www.grasshopper3d.com/forum/topics/get-coordinates-of-mouse-in

I would like to ask if there is any news on getting the position of the mouse in X and Y coordinates.

I am thinking about what, for instance, the functions mouseX and mouseY do in Processing.

Thanks.

Cheers!

Views: 1960

Replies to This Discussion

Apparently .NET has a method for that. Check out the attached file for an example. Requires Rhino 5 and the latest Python component.

Attachments:

Rhino common is proving a method for this...


public class FeedBack : Rhino.UI.MouseCallback

{ public bool run = true;

public FeedBack() : base()

{ this.Enabled = true; }

protected override void OnMouseDown(Rhino.UI.MouseCallbackEventArgs e)

{ if (e.Button == MouseButtons.Left)

{ // do what you want System.Windows.Forms.MessageBox.Show(e.ViewportPoint.ToString()); }

if (e.Button == MouseButtons.Right)

{ // do what you want this.Enabled = false; }

// you can override this

base.OnMouseDown(e); } }

Hello Michael and Anders,

 

Thanks for your response.

Dispite I think I did not make myself clear in my question, as I actually meant getting Rhino´s X and Y coordinates in Grasshopper, I found your code very useful.

Michael, I tried your code but I am afraid I am not experienced enough to deal with it. I tried to initialize your class with:

 

Feedback f = new Feedback();

 

But it returns an error. Could you give me a hand on that?

And finally,  do any of you know how to get Rhino´s X&Y coordinates?

Thank you very much!

Attached a VB.net solution...

Attachments:

i've just this found this, it's brilliant! via processing was a pain..

thanks Richard!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service