Thanks Mustafa.Salaheldin.
I used the above code,but there will be error:
private void FaliureProcessor(object sender, FailuresProcessingEventArgs e) { bool hasFailure = false; FailuresAccessor fas = e.GetFailuresAccessor(); List<FailureMessageAccessor> fma = fas.GetFailureMessages().ToList(); foreach (FailureMessageAccessor fa in fma) { try { if (fa.GetFailureDefinitionId() == BuiltInFailures.OverlapFailures.DuplicateInstances) { //use the following lines to delete the warning elements List<ElementId> elemntsToDelete = fa.GetFailingElementIds().ToList(); IList<ElementId> elemntToDelete = new List<ElementId>(); elemntToDelete.Add(elemntsToDelete[0]); fas.DeleteElements(elemntToDelete); fas.DeleteWarning(fa); hasFailure = true; //use the following line to disable the message supressor after the external command ends CachedUiApp.Application.FailuresProcessing -= FaliureProcessor; } } catch (Exception ex) { TaskDialog.Show("`1", ex.ToString()); } } if(hasFailure) { e.SetProcessingResult(FailureProcessingResult.ProceedWithCommit); } e.SetProcessingResult(FailureProcessingResult.Continue); }
What reason is this?