Automatic accept warning

Is there a way to automaticaly accept this warning when it pops up?
image

Yeah, try sth similar:
Ignore revit error (duplicate mark) - Revit API - pyRevit Forums (pyrevitlabs.io)

2 Likes

I had to do a lot of digging and trying and failing until i figured it out!
I get this message every time after running a specific script.
So i added the code shown below:

class WarningFailureMessageClass(IFailuresPreprocessor):
    def PreprocessFailures(self, failuresAccessor):
        fail_acc_list = failuresAccessor.GetFailureMessages().GetEnumerator()
        for failure in fail_acc_list:            
            failuresAccessor.DeleteWarning(failure)
        return FailureProcessingResult.Continue

def WarningFailureMessage(TR = transact):
    options = TR.GetFailureHandlingOptions()
    options.SetFailuresPreprocessor(WarningFailureMessageClass())
    TR.SetFailureHandlingOptions(options)

I guess it will handle all warnings and not just the one i need to be handled, but that’s fine by me.
When i add “WarningFailureMessage()” to the end of my script it does the job.
Thanks for getting me on the right track! @Tomasz

1 Like