Can't suppress Group change is allowed warning
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
In my code I create a group from elements that were just added.
Within the same transaction I set the name of the group to make it recognisable and more easily selectable by the user.
When I Commit the changes (i.e. creating the group and renaming it) I get a warning message that a property of the group was changed but that it is allowed because there is only one instance.
Apart from the more general question of why that message is even there in the first place, this warning message is confusing to the end users.
This being a warning I should be able to suppress it with the following IFailuresPreprocessor (which is basically the same one everybody copies from the forums)
public class GroupEditing : IFailuresPreprocessor { #region Public Methods public FailureProcessingResult PreprocessFailures(FailuresAccessor a) { IList<FailureMessageAccessor> failures = a.GetFailureMessages(); foreach (FailureMessageAccessor f in failures) { // FailureDefinitionId id = f.GetFailureDefinitionId(); FailureMessage fm = f.CloneFailureMessage(); /* if (f.GetDescriptionText().Contains("Changes to groups are allowed only in group edit mode")) { break; } */ FailureSeverity failureSeverity = a.GetSeverity(); switch (failureSeverity) { case FailureSeverity.Warning: a.DeleteWarning(f); break; case FailureSeverity.Error: a.PostFailure(fm); break; default: return FailureProcessingResult.ProceedWithRollBack; } } return FailureProcessingResult.Continue; } #endregion }
When I run the code to create the group this preprocessor gets triggered with one MessageAccessor in it.
Single stepping through the function I can see that this is a warning, that the description of the warning matches the text from the popup and that the failure is removed from the FailuresAccessor.
The FailureDefinitionId has guid {c519d291-2e28-4075-b0d0-3cbc8c848bc2}
and DescriptionText "A group has been changed outside group edit mode. The change is being allowed because there is only one instance of the type."
After leaving the function Revit then still shows the popup with this warning, as if it was not deleted.
I am using this FailuresPreprocessor in other situations as well without problem (deleted warnings stay deleted)
I am at a bit of a loss what I could be doing wrong here, as other people reported that using this same preprocessor successfully prevented this exact popup from being shown.