private void buttonStrgSzr_Click(object sender, EventArgs e) { TypedValue[] TVs = new TypedValue[] { new TypedValue(0, "SOLID"), new TypedValue(8, "AR-MArker"), new TypedValue(62, "3") }; SelectionFilter SF = new SelectionFilter(TVs); PromptSelectionResult PSR = ed.SelectAll(SF); if (PSR.Status != PromptStatus.OK) { return; } SelectionSet SS = PSR.Value; using (Transaction trStrgSzr = db.TransactionManager.StartTransaction()) using (acadDoc.LockDocument()) { foreach (SelectedObject SO in SS) { if (SO.ObjectId.IsValid) { Solid S = null; //try //{ S = (Solid)trStrgSzr.GetObject(SO.ObjectId, OpenMode.ForWrite); S.Erase(); } } trStrgSzr.Commit(); } }