How to add viewpoint in Rhino by mouse click and some other question


#1

In rhinopython not grasshopper python
I have some problem use the Rhino.Display.DisplayPipeline.DrawPoint or the Rhino.Input.custom. I don’t know how to use these classes.
I just want add some dynamic display point by mouse clicks.
My simple code following but failed:

import rhinoscriptsyntax as rs
import Rhino
import System.Drawing

while 1:
    pt = Rhino.Input.Custom.GetPoint()
    pt.Get() 
    c = pt.Point() 
    print (c)
    print(type(c))
    Rhino.Display.DisplayPipeline.DrawPoint(c,System.Drawing.Color.Blue)

Someother problems:

  1. How to Capture mouse events
  2. can somebody explain the ‘gp.DynamicDraw += GetPointDynamicDrawFunc’ means.
    How did the ‘+=’ works to hook on the function.

(Dale Fugier) #2

Its not clear to me what you are looking to do. But you might want to take a look at the CustomGetPoint.py sample included with RhinoPython. From with the RhinoPython editor, select Help -> Samples -> Advanced -> CustomGetPoint. Does this help any?


#3

THX, I have clear the dynamic display but It depends on the mouse movement , could I display any points or lines not with dynamic display?
Any ways to capture mouse events or keyboard? Like play a game. It is not the model, just the display?


(Dale Fugier) #4

Other than dynamic drawing in a GetPoint operation, you can always create a display conduit and draw with it.

http://wiki.mcneel.com/developer/displayconduit?s[]=conduit

Regarding capturing mouse or keyboard events, why do you need this? What are you trying to do?