不知道这样效率会不会好些 [CommandMethod("t9")] public static void Test9() { Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; PromptSelectionResult res1 = ed.GetSelection(); ObjectId[] ids1 = res1.Value.GetObjectIds(); PromptSelectionResult res2 = ed.SelectAll(new SelectionFilter(new TypedValue[] { new TypedValue(0, "line") })); List<ObjectId> ids2 = new List<ObjectId>(res2.Value.GetObjectIds()); List<ObjectId> ids = new List<ObjectId>(); foreach (ObjectId id in ids1) { if(ids2.Contains(id)) { ids.Add(id); } } ed.SetImpliedSelection(ids.ToArray()); } |