Community
Try this code, wriiten in a hurry, so check on possible errors:
[CommandMethod("ltname")] public void LayoutNameOfBlockRef() { Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; Editor ed = doc.Editor; Transaction tr = doc.TransactionManager.StartTransaction(); using (tr) { PromptEntityOptions peo = new PromptEntityOptions("\nSelect block >>"); peo.SetRejectMessage("\nSelect block only >>"); peo.AddAllowedClass(typeof(BlockReference), false); PromptEntityResult res; res = ed.GetEntity(peo); if (res.Status != PromptStatus.OK) return; Entity ent = (Entity)tr.GetObject(res.ObjectId, OpenMode.ForRead); if (ent == null) return; BlockReference br = (BlockReference)ent as BlockReference; DBObject obj = tr.GetObject(br.OwnerId, OpenMode.ForRead); BlockTableRecord lbtr = tr.GetObject(br.OwnerId, OpenMode.ForRead) as BlockTableRecord; ObjectId ltId = lbtr.LayoutId; Layout lt = tr.GetObject(ltId, OpenMode.ForRead) as Layout; Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("BlockReference belongs to tab: " + lt.LayoutName); tr.Commit(); } }