algorithmic modeling for Rhino
Aside from a few posts that partially address this issue, I haven't seen a functional method laid out for detecting left mouse clicks within the rhino viewport sans timer. Please direct me if I've missed it.
I'm building a series of menus within Visual Studio that rely on detecting which geometry is selected or not. At this point, an event being raised for any left-mouse click within a rhino viewport would be helpful (VB). Once detected, I have the code to determine which, if any, geometry is selected or not.
Thanks!
Tags:
Hi Nathan,
I don't think it's possible. Rhino consumed left-clicks and displays menus by itself sometimes. You'll need to ask Steve Baer or Dale Fugier though and the best place to do that would be on the Rhino plug-in newsgroup.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Most people get this type of functionality by listening to select/deselect events. There are several events on RhinoDoc for this (DeselectObjects, DeselectAllObjects, SelectObjects). This works best since mouse clicks aren't the only way to select objects.
Okay thanks. Sounds like a more solid approach.
Try this....
public class MyHandler: Rhino.UI.MouseCallback
{
protected override void OnMouseDown(Rhino.UI.MouseCallbackEventArgs e)
{
if(e.Button == MouseButtons.Left)
{
// check for selected geometry
}
base.OnMouseDown(e);
}
}
Michael,
I've converted your solution to vb.net (I'm more familiar), and for starters, am just trying to pop a msgbox with the event.
Public Class MyHandler
Inherits Rhino.UI.MouseCallback
Protected Overrides Sub OnMouseDown _
(e As Rhino.UI.MouseCallbackEventArgs)
If e.Button = MouseButtons.Left Then
msgbox("test")
End If
MyBase.OnMouseDown(e)
End Sub
End Class
This is a bit out of my league... am I even close? I can't get it to work. thanks.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by