Get not getting?

I am building code around a selected curve and some selected geometry.

The code to generate subcurves etc all working fine using the curve from this GET.

ObjRef ClosedCurve;
Result GetCurve = RhinoGet.GetOneObject("Select Closed Planar Curve", false, ObjectType.Curve, out ClosedCurve);
if (GetCurve != Result.Success)return;

But, when I add the geometry GET the first GET quits with object reference cannot be null, immediately after I select the same curve that worked before. (The second get is to select some polysurfs and closed surfaces which ill filter later from the array).

I suspect the issue is in the second get, not the first one, but its does not even get as far as displaying the prompt for second get on the command line? (both part of a sub under a button hence the regular return instead of return result.success in bottom half.

ObjRef ClosedCurve;
Result GetCurve = RhinoGet.GetOneObject("Select Closed Planar Curve", false, ObjectType.Curve, out ClosedCurve);
if (GetCurve != Result.Success)return;

ObjRef[] ProjectGeometry;
Result GetGeometry = RhinoGet.GetMultipleObjects("Select Geometry", false, ObjectType.AnyObject, out ProjectGeometry);
if (GetGeometry != Result.Success) return;

You must deselect the first object before starting the second Get.

1 Like

that fixed it, thanks!

doc.Objects.UnselectAll();

UnselectAll may not always be what you need. To specifically de-select only the object with reference ClosedCurve, use

doc.Objects.Select(ClosedCurve, false);

Hi @ChristopherBotha,

There are times when the easy object picker is not flexible enough. For example, what if wanted to pick a few sets of objects but now allow them to be selected more than once?

In these cases you will want to use a GetObject object.

This sample demonstrates what I describe above.

https://github.com/mcneel/rhino-developer-samples/blob/6/rhinocommon/cs/SampleCsCommands/SampleCsScriptedSweep2.cs

– Dale

A post was split to a new topic: How to fill holes in a mesh