- [CommandMethod("tta")]
- public static void tta()
- {
- Document doc = Application.DocumentManager.MdiActiveDocument;
- Editor ed = doc.Editor;
- Database db = doc.Database;
- var resStr =
- ed.GetString("\nPlease Input BlockName:");
- if (resStr.Status != PromptStatus.OK)
- return;
- var resSel =
- ed.SelectAll(
- new SelectionFilter(
- new TypedValue[]
- {
- new TypedValue(0, "Insert"),
- new TypedValue(2, resStr.StringResult)
- }));
- if (resSel.Status != PromptStatus.OK)
- return;
- using (var tr = db.TransactionManager.StartTransaction())
- {
- foreach(var id in resSel.Value.GetObjectIds())
- {
- var br = tr.GetObject(id, OpenMode.ForRead) as BlockReference;
- ed.WriteMessage("\n{0}", br.Position);
- }
- }
- }
|