Hello,
I can not get Function PickObjects to work.
I checked the arguments, everything is fine.
The GetFrustumLine
signature is :
public bool GetFrustumLine (double screenX, double screenY, out Line worldLine);
but in the example https://wiki.mcneel.com/developer/rhinocommonsamples/gumball, screenX
and screenX
are set with a client point (GetPointMouseEventArgs.WindowPoint
)
Can you confirm me that the GetFrustumLine
take a screen coordinates ?
Does the PickObjects function work for you ?
my code:
class Helper
{
public static int PickObjects (Rhino.RhinoDoc doc, RhinoView view, System.Drawing.Point clientPoint, ref ObjRef[] Objects)
{
if( view == null ) return 0;
var vp = view.ActiveViewport;
PickContext ctx = new PickContext ();
ctx.View = view;
ctx.PickStyle = PickStyle.PointPick;
ctx.PickMode = PickMode.Shaded;
var xform = vp.GetPickTransform (clientPoint);
if( xform == null ) return 0;
ctx.SetPickTransform (xform);
var screenPoint = vp.ClientToScreen (clientPoint);
vp.GetFrustumLine (screenPoint.X, screenPoint.Y, out Line ln);
ctx.PickLine = ln;
ctx.SubObjectSelectionEnabled = true;
ctx.UpdateClippingPlanes ();
Objects = doc.Objects.PickObjects (ctx);
return Objects.Length;
}
}
Thank you.