Print Name of Block in Rhino C#

Hello,
I am new to Rhino development in C#.
I was wondering if there is a way to print/display the name of a selected block on rhino.
I am just looking for a way to identify specific information regarding a selected block.

Thank you!

Hi @runningteens,

Try using this as part of a plug-in command:

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
  var filter = Rhino.DocObjects.ObjectType.InstanceReference;
  var rc = Rhino.Input.RhinoGet.GetOneObject("Select block instance", false, filter, out var objref);
  if (rc == Rhino.Commands.Result.Success && null != objref)
  {
    if (objref.Object() is InstanceObject iref)
    {
      var idef = iref.InstanceDefinition;
      if (null != idef)
        Rhino.RhinoApp.WriteLine(idef.Name);
    }
  }
  return Result.Success;
}

– Dale