Public voiddeletedimension () {//Defining a DatabaseDatabase db =hostapplicationservices.workingdatabase; //Get current fileDocument doc =Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; //gets the current command-line objectEditor ed =Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; using(Transaction trans =db. Transactionmanager.starttransaction ()) {#regionDelete a group//Define a group dictionaryDbdictionary groupdict =(dbdictionary) db. Groupdictionaryid.getobject (Openmode.forread); //Search for group objects that meet the criteria in a group dictionary foreach(DictionaryEntry IDEinchgroupdict) { //Get Group ObjectAcadgroup Partgroup =(Acadgroup) trans. GetObject (ObjectId) IDE. Value, Openmode.forread); //Delete action for groups with a group name that contains "part-" or groups with a number of 2 entities in an anonymous group if(PartGroup.Name.Contains ("part-") || (partgroup.isanonymous && Partgroup.numentities = =2)) { //Delete the objects in the group and then delete the group, then delete the group directly. foreach(ObjectId IDinchPartgroup.getallentityids ()) {Entity ent=(Entity) ID. GetObject (Openmode.forwrite); Ent. Erase (); Ent. Dispose (); } partgroup.upgradeopen (); Partgroup.erase (true); Partgroup.downgradeopen (); } } #endregionDelete a group#regionDelete dimension linestypedvaluelist Values=Newtypedvaluelist (); Values. ADD (0,typeof(Dimension). Name); Selectionfilter Filter=NewSelectionfilter (values); Promptselectionresult PSR=ed. SelectAll (filter); if(PSR. Status = =Promptstatus.ok) {//Application.showalertdialog (String. Format ("The selected dimension line has {0}!") ", PSR. Value.count)); foreach(ObjectId IDinchPSR. Value.getobjectids ()) {Entity ent=(Dimension) ID. GetObject (Openmode.forwrite); Ent. Erase (); Ent. Dispose (); } } #endregionDelete dimension linesTrans.commit (); } }