This command selects surfaces and meshes. Then, when counting by the ObjectType that was used in the selection, the surfaces are not found. In fact they are of ObjectType.Brep even though they have been selected with ObjectType.Surface.
This catches me out every time.
public override Result RunActualCommand(RhinoDoc doc, RunMode mode)
{
ObjRef[] oRefs;
Result res = RhinoGet.GetMultipleObjects("Select meshes or surfaces", false,
ObjectType.Surface | ObjectType.Mesh, out oRefs);
if (res != Result.Success)
return res;
Guid[] meshes = oRefs.Select(r => r.Object())
.Where(o => o.ObjectType == ObjectType.Mesh)
.Select(o => o.Id).ToArray();
RhinoApp.WriteLine("{0} meshes selected.", meshes.Length);
Guid[] surfaces = oRefs.Select(r => r.Object())
.Where(o => o.ObjectType == ObjectType.Surface)
.Select(o => o.Id).ToArray();
RhinoApp.WriteLine("{0} surfaces selected.", surfaces.Length);
doc.Views.Redraw();
return Result.Success;
}