protected override void OnMouseDown(GetPointMouseEventArgs e) { base.OnMouseDown(e); var picker = new PickContext(); picker.View = e.Viewport.ParentView; picker.PickStyle = PickStyle.PointPick; var xform = e.Viewport.GetPickTransform(e.WindowPoint); picker.SetPickTransform(xform); foreach (var cp in m_conduit_points) { double depth; double distance; if (picker.PickFrustumTest(cp.Point, out depth, out distance)) cp.Color = System.Drawing.Color.Red; else cp.Color = System.Drawing.Color.White; } }
private List<ObjRef> ssget_point(RhinoDoc doc, RhinoView view, Point3d point) { var world_to_screen = view.ActiveViewport.GetTransform(CoordinateSystem.World, CoordinateSystem.Screen); point.Transform(world_to_screen); var pick_context = new PickContext(); pick_context.View = view; pick_context.PickStyle = PickStyle.PointPick; pick_context.PickGroupsEnabled = true; var xform = view.ActiveViewport.GetPickTransform(Convert.ToInt32(point.X), Convert.ToInt32(point.Y)); pick_context.SetPickTransform(xform); double depth, distance; foreach (var rhino_object in doc.Objects) { //rhino_object.OnPicked(pick_context, ) } if (pick_context.PickFrustumTest(point, out depth, out distance)) pick_context.UpdateClippingPlanes(); return null; }
protected override void OnMouseDown(Rhino.Input.Custom.GetPointMouseEventArgs e) { if (m_dc.PickResult.Mode != Rhino.UI.Gumball.GumballMode.None) return; m_dc.PickResult.SetToDefault(); Rhino.Input.Custom.PickContext pick_context = new Rhino.Input.Custom.PickContext(); pick_context.View = e.Viewport.ParentView; pick_context.PickStyle = Rhino.Input.Custom.PickStyle.PointPick; var xform = e.Viewport.GetPickTransform(e.WindowPoint); pick_context.SetPickTransform(xform); Rhino.Geometry.Line pick_line; e.Viewport.GetFrustumLine(e.WindowPoint.X, e.WindowPoint.Y, out pick_line); pick_context.PickLine = pick_line; pick_context.UpdateClippingPlanes(); // pick gumball and, if hit, set getpoint dragging constraints. m_dc.PickGumball(pick_context, this); }