In my solution I'm opening a lot of families from within a project. Sometimes some popups appear during opening a family. I enclosed the opening process inside a transaction in which I handle warnings via IFailuresPreprocessor. I noticed that:
about 90% warnings I can suppres with the following:
FailuresAccessor a; a.DeleteAllWarnings(); return FailureProcessingResult.Continue;
But the remaining 10% won't get suppressed with such treatment, they do get suppressed with:
FailuresAccessor a; IList<FailureMessageAccessor> failures = a.GetFailureMessages(); a.ResolveFailures(failures); return FailureProcessingResult.ProceedWithCommit;
Is there a general way to check with what kind of treatment current warning can get suppressed? I don't want to go into a switch case block because the warnings are really various and it'd take ages before I covered them all. Another issue is that it doesn't matter so much how I treat the warnings because I don't resave the families in my solution - I just close them without saving.
In my solution I'm opening a lot of families from within a project. Sometimes some popups appear during opening a family. I enclosed the opening process inside a transaction in which I handle warnings via IFailuresPreprocessor. I noticed that:
about 90% warnings I can suppres with the following:
FailuresAccessor a; a.DeleteAllWarnings(); return FailureProcessingResult.Continue;
But the remaining 10% won't get suppressed with such treatment, they do get suppressed with:
FailuresAccessor a; IList<FailureMessageAccessor> failures = a.GetFailureMessages(); a.ResolveFailures(failures); return FailureProcessingResult.ProceedWithCommit;
Is there a general way to check with what kind of treatment current warning can get suppressed? I don't want to go into a switch case block because the warnings are really various and it'd take ages before I covered them all. Another issue is that it doesn't matter so much how I treat the warnings because I don't resave the families in my solution - I just close them without saving.
Dear Adam,
Thank you for your cool query.
I am not aware of any generic warning swallower within the Revit API.
The solution you have already seems pretty good to me.
For something yet more generic, all I can suggest is a Windows dialogue handler:
http://thebuildingcoder.typepad.com/blog/2009/10/dismiss-dialogue-using-windows-api.html
https://github.com/jeremytammik/JtClicker
The Building Coder provides an entire topic group on the subject of Detecting and Handling Dialogues and Failures:
http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.32
Please let us know how you end up resolving this.
I am sure your solution will come in handy for others also.
Thank you!
Cheers,
Jeremy
Dear Adam,
Thank you for your cool query.
I am not aware of any generic warning swallower within the Revit API.
The solution you have already seems pretty good to me.
For something yet more generic, all I can suggest is a Windows dialogue handler:
http://thebuildingcoder.typepad.com/blog/2009/10/dismiss-dialogue-using-windows-api.html
https://github.com/jeremytammik/JtClicker
The Building Coder provides an entire topic group on the subject of Detecting and Handling Dialogues and Failures:
http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.32
Please let us know how you end up resolving this.
I am sure your solution will come in handy for others also.
Thank you!
Cheers,
Jeremy
This works fine for me.
http://forums.autodesk.com/t5/revit-api-forum/supressing-warning-pop-ups/td-p/4764741
Regards
Wolfgang
This works fine for me.
http://forums.autodesk.com/t5/revit-api-forum/supressing-warning-pop-ups/td-p/4764741
Regards
Wolfgang
Cool. Since you say so, I added it to the topic group:
http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.32
Thank you!
Cheers,
Jeremy
Cool. Since you say so, I added it to the topic group:
http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.32
Thank you!
Cheers,
Jeremy
Thank you gents 🙂
Indeed the Severity is what I was looking for, my solution seems to be working fine now. The code below:
public FailureProcessingResult PreprocessFailures(FailuresAccessor a) { IList<FailureMessageAccessor> failures = a.GetFailureMessages(); foreach(FailureMessageAccessor f in failures) { FailureSeverity fseverity = a.GetSeverity(); if(fseverity == FailureSeverity.Warning) a.DeleteWarning(f); else { a.ResolveFailure(f); return FailureProcessingResult.ProceedWithCommit; } } return FailureProcessingResult.Continue; }
Kind regards,
Adam
Thank you gents 🙂
Indeed the Severity is what I was looking for, my solution seems to be working fine now. The code below:
public FailureProcessingResult PreprocessFailures(FailuresAccessor a) { IList<FailureMessageAccessor> failures = a.GetFailureMessages(); foreach(FailureMessageAccessor f in failures) { FailureSeverity fseverity = a.GetSeverity(); if(fseverity == FailureSeverity.Warning) a.DeleteWarning(f); else { a.ResolveFailure(f); return FailureProcessingResult.ProceedWithCommit; } } return FailureProcessingResult.Continue; }
Kind regards,
Adam
Thank you very much, Adam and Wolfgang!
I summarised this thread here on The Building Coder:
Cheers,
Jeremy
Thank you very much, Adam and Wolfgang!
I summarised this thread here on The Building Coder:
Cheers,
Jeremy
Can't find what you're looking for? Ask the community or share your knowledge.