Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8553

How to use control key when get point

$
0
0

@pythonuser wrote:

Hi;
Press the control key will lock the cursor when I use the customgetpoint function, I want to change the color of point when I press control key and get the point, it is way to solve it?

PS:
I push my core now, this core have somg problem, when I press the control key and pick point, the point have not delete, but it is not important, the important thing is affter this, the cursor have lock.

import Rhino
import rhinoscriptsyntax as rs
import scriptcontext as sc
import System.Drawing.Color

def GetPointAndDelete(points,ids):
  global poi
  while True:
    def GetPointDynamicDrawFunc( sender, args ):
      current_point = args.CurrentPoint
      for i in range(len(ids)):
        if current_point.DistanceTo(points[i])<1:
          poi=ids[i]
          args.Display.DrawLine(points[i], current_point, System.Drawing.Color.Red,3)
    def GetPointMouseEventArgs( sender, args ):
      if args.ControlKeyDown:
        sc.doc.Objects.Delete(poi)
    gp = Rhino.Input.Custom.GetPoint()
    gp.DynamicDraw += GetPointDynamicDrawFunc
    gp.MouseDown += GetPointMouseEventArgs
    gp.Get(True)
    if( gp.CommandResult() != Rhino.Commands.Result.Success ):
      return
    else:
      continue


pois = rs.GetObjects("get points")
points =[]
for i in range(len(pois)):
  point = rs.coerce3dpoint(pois[i])
  points.append(point)
GetPointAndDelete(points,pois)

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 8553

Trending Articles