RhinoCommon ObjectTable Worksession Objects

It seems to me that the only way to get at objects worksessioned into a Rhino Document is by using RhinoDoc.Objects.FindByLayer - using RhinoDoc.Objects.FindByFilter or RhinoDoc.Objects.GetObjectList don’t seem to recognize them. Is this true, or am I missing some ObjectEnumeratorSettings filter option? If it is the case, is there a way to apply an ObjectEnumeratorSettings filter to a list of RhinoObject after already having retrieved it?

Try the following:

var filter = new ObjectEnumeratorSettings
{
  NormalObjects = true,
  LockedObjects = true,
  ActiveObjects = true,
  ReferenceObjects = true
};

var rh_objects = doc.Objects.FindByFilter(filter);
if (null != rh_objects)
{
  foreach (var rh_obj in rh_objects)
  {
    if (rh_obj.IsDeleted)
      continue;

    var str = (rh_obj.IsReference) ? "worksession" : "model";
    var desc = rh_obj.ShortDescription(false);
    RhinoApp.WriteLine("{0} {{{1}}} is a {2} object", desc, rh_obj.Id, str);
  }
}

Does this help?

– Dale

1 Like

Never thanked you @dale - this worked beautifully. I was missing “ReferenceObjects” in my filter - I guess I assumed it meant something different.

Appreciate the help!