[CommandMethod("g")]//让光栅自动置前置后无反应 public static void g() { BlockTableRecord 块表记录; DrawOrderTable dot; ObjectIdCollection oo; Document acDoc = Application.DocumentManager.MdiActiveDocument; Database acCurDb = acDoc.Database; Editor ed = acDoc.Editor; PromptSelectionOptions rp = new PromptSelectionOptions(); rp.MessageForAdding = "请选择光栅"; PromptSelectionResult res = acDoc.Editor.GetSelection(rp); if (res.Status == PromptStatus.OK) { SelectionSet acSSet = res.Value; using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction()) { BlockTable 块表 = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) as BlockTable; 块表记录 = acTrans.GetObject(块表["*Model_Space"], OpenMode.ForRead) as BlockTableRecord; dot = (DrawOrderTable)acTrans.GetObject(块表记录.DrawOrderTableId, OpenMode.ForWrite, false); oo = Ldyh.LdyhAutoCAD.Tools.CollectBlockEnts(块表记录); dot.MoveBelow(oo, acSSet[0].ObjectId); acTrans.Commit(); } } } 用MoveToTop、MoveToBottom、MoveBelow、MoveBelow均无反应, 但手工在AutoCAD中操作是可以的,操作顺序是:选择光栅-右键菜单-绘图次序-后置。这样,其它实体都浮在了光栅表面上,即不再被光栅所覆盖了。
|