How to use pickcontext to trigger the OnPick event of a RhinoObject?

var activeView = e.View.ActiveViewport;
var xf = e.View.ActiveViewport.GetPickTransform((int)activeView.WorldToClient(pt).X, (int)activeView.WorldToClient(pt).Y);
var pickcontext = new Rhino.Input.Custom.PickContext
{
PickStyle = Rhino.Input.Custom.PickStyle.PointPick,
};
pickcontext.SetPickTransform(xf);
var obj = Display.Doc.Objects.PickObjects(pickcontext);

I have a GripObject which I would like to expand a bit its selection detection. I am trying to use the above code to trigger its OnPick event in a MouseCallback, but it didn’t trigger.
What is missing here?

can anyone help me with this?
@dale ?

I don’t know what this means, and your code doesn’t make any sense to me.

Can you explain a little more on what you are trying to do and why?

Thanks,

– Dale

@dale
Thanks for replying!

I am developing a HUD widget for a slope label.
Basically I would like to trigger the onPick event for the CustomGripObject, so I could have drag the point without actually clicking on the point itself.

You can see in the video that I have a flag to trigger when the mouse is too close to my grip, and the flag is causing the grips to draw a larger red circle. I want the user to be able to drag the point when the flag is set as true.

However, this doesn’t work, even though I tried to set the Pointpick to where the GripObject is.
var obj = Display.Doc.Objects.PickObjects(pickcontext);

@dale
Any help on this? Is my code example helpful in explaining my problem?
Any feedback would be most appreciated!

To put it in simpler terms, I would like to “drag” the object/grip without actually clicking on where the grip is. It would not only make selecting the grip easier, but also enable me to create a line-like grip.

Hi @Wiley,

I’m not sure how I would approach this. Do you know of something in Rhino that works this way?

– Dale

Hi @dale
Thanks for the reply.
I gave up using the grips in RhinoCommon and created my own grip class using MouseCallBack instead.

Thanks for the replies and help anyway!

1 Like

You could try expanding the selection window by using the ObjectTable.FindByCrossingWindowRegion method.

Effectively, this will allow you to create a rectangular buffer around your cursor which expands your hovering region. You can also set the selection filter to only return Grip objects.

2 Likes