这个代码只能用于ACAD2010以上
public static class BEdit { [CommandMethod("TestBEDIT")] public static void TestBEdit() { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; if (Autodesk.AutoCAD.Internal.AcAeUtilities.IsInBlockEditor()) { ed.WriteMessage("\n块编辑器的块名是" + Autodesk.AutoCAD.Internal.AcAeUtilities.GetBlockName()); } else { ed.WriteMessage("\n没有名字"); } } }