Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

General warning swallower

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
1205 Views, 5 Replies

General warning swallower

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.

 

5 REPLIES 5
Message 2 of 6
jeremytammik
in reply to: Anonymous

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

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 6
Wolfgang.B.Weh
in reply to: Anonymous

Message 4 of 6

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



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 6
Anonymous
in reply to: jeremytammik

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

Message 6 of 6
jeremytammik
in reply to: Anonymous

Thank you very much, Adam and Wolfgang!

 

I summarised this thread here on The Building Coder:

 

http://thebuildingcoder.typepad.com/blog/2016/09/warning-swallower-and-roomedit3d-viewer-extension.h...

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community