//获取块表 BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead); //获取图纸空间的块表记录 BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.PaperSpace], OpenMode.ForRead); //在这些块表记录中进行循环 foreach (ObjectId btrId in btr) { if (btrId.GetBlockName() != null) //取得块名 { ed.WriteMessage("\n块名为:{0}", btrId.GetBlockName(), btrId.ToString()); } }