public static void DOinBlock() { App.Document dwg = App.Application.DocumentManager.MdiActiveDocument; Ed.Editor ed = dwg.Editor; //Ask user to select a block. In real world, I use code //to select all targeting blocks by its name, so that //user does not have to select block manually Ed.PromptEntityOptions opt = new Ed.PromptEntityOptions("\nSelect a block:"); opt.SetRejectMessage("\nInvalid: not a block."); opt.AddAllowedClass(typeof(Db.BlockReference), true); Ed.PromptEntityResult res = ed.GetEntity(opt); if (res.Status != Ed.PromptStatus.OK) { return; } SetDrawOrderInBlock(dwg, res.ObjectId); ed.Regen(); Autodesk.AutoCAD.Internal.Utils.PostCommandPrompt(); }
// Regenerates the drawing window public static void Regen() { Autodesk.AutoCAD.EditorInput.Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; ed.Regen(); }