algorithmic modeling for Rhino
I searched around and didn't find anything specific to this question in past threads, but I apologize if I've missed a previous answer to this question.
Is it possible to get the position of the mouse as a point in rhino space with a scripting component? How would one access the coordinates that show at the bottom of the Rhino viewport indicating the position of the mouse in the model? I don't really care about using a mouse listener to update the information in the model when the mouse moves or clicks (although if this is easy it would be nice also...).
Thanks,
Andrew
Tags:
I tried for about an hour or so but didn't get anywhere. I've done this sort of thing before from within a GetPoint operation, but I don't know how to do it without it. I'm still about as mystified by the RhinoView/RhinoViewport/Frustrum/Camera bits in the SDK as I was before RhinoCommon.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Here's a sample python script that gets the 3d points on the near and far frustum planes for a given viewport. It should be pretty easy to convert to VB or C#
https://gist.github.com/1023456
-Steve
I added some functions/properties for the next WIP which hopefully will make this clearer... hopefully;)
On RhinoView and RhinoViewport, I added
ClientToScreen and ScreenToClient which help convert a 2D point between screen coordinates and client window coordinates of the view and viewport. These act just like PointToScreen and PointToClient on the Control class in Windows.Forms
http://msdn.microsoft.com/en-us/library/system.windows.forms.contro...
On RhinoView I also added WorldToClient and ClientToWorld for converting between a 2d pixel coordinate on the viewport and a point or line in the world cordinates.
public Line ClientToWorld(System.Drawing.Point clientPoint);
public Line ClientToWorld(Point2d clientPoint);
public Point2d WorldToClient(Point3d worldPoint);
Thanks,
-Steve
Heyo!
Steve,
Are these available when using GH with Rhino 4? Intellisense picks them up, so I guess I get confused when they're not working. If they do work, can you point me in the right direction to implement the
ClientToWorld(System.Drawing.Point clientPoint )...
the client point is 'System.Windows.Forms.Cursor.Position' and it returns a 2D point in world coordinates, right?
Thanks!
Hi,steve How to create a viewport?
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
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by