Keyboard & Mouse status + Jumping OSnap points

rhinopython
rhino5
vbscript

#1

Short questions:

  1. In Python Script, how to I access Mouse & Keyboard status, like finding out in a while loop if CTRL-key was pressed, or kept engaged, or released (same for ALT, TAB, SHIFT) etc.?

  2. (How) Can I access (current) OSnap point for an object, and change it to another valid OSnap point on the same object? (Link to documentation or example?)

Obviously I’m searching for the wrong terms since I cannot find any on this.

INTENDED USE CASES
Combining §1 and §2, I want to be able to TAB from one OSnap point to another pt on a selected object starting from an already selected OSnap) point.

On a Line for example, I would like to switch from one End pt to the Mid pt to the other End pt. By pressing TAB again it would bring the (visual) OSnap pt back to the first pt, and so on.

For Solids I’d like to be able do the same thing along Edges. If a corner (vertice) is selected, the nearest Edges would first be TABbed through (hightlighting the edges). On a Circle I obviously would like to be able to TAB to the center Pt and to all the 6 quadrants. Aso.

If not possible in Py, then perhaps in VBScript? All and any hints are very welcome.
.


UPDATE

OK, now I found that from args in GetPointMouseMoveFunc(sender, args) I can get :

  • args.LeftButtonDown
  • args.MiddleButtonDown and
  • args.RightButtonDown

and also :

  • args.ShiftKeyDown and
  • args.ControlKeyDown

… but no AltKey nor TabKey down. :frowning:

// Rolf


(Dale Fugier) #2

Hi Rolf,

RhinoCommon does not provide any functionality that allows you to determine the current state of the keyboard.

If you were in a plug-in, you’d call Windows APIs, such as GetKeyState and GetAsyncKeyState.

– Dale