Revit API | Auto Dismiss Selected Revit Dialogues

Today I was approached by my colleague asking if there is a way to stop Revit from showing up some dialogues, particularly the one that asks is the user would like walls to be attached to the modified floor/roof element. The story was that the Revit C4R model  they work on was partially messed by one inexperienced user who accidentally clicked on Yes for that “wall attachment” option without knowing it. They did not find out until days later and then it took the team a lot of time and effort to fix the model.

So the aim for this task is to automatically dismiss that dialogue with a default “No” input in the background. The easiest way to do that is to use an even handler. Basically the logic is to detect if that particular type of dialogue is about to show and then check if that is the dialogue we want to avoid. Initially I thought each type of dialogue message would have a particular type of identity associated just like the built-in parameters/types, etc. It turned out that only a portion of them do but still a lot of them do not have ids. Then the only way I could think of doing this is to check the content against the message we actually see in Revit.

The downside is that this solution is language specific and requiring a 100% match, meaning that it might not work for Revit in another language even with slight spelling differences. But this is not a big issue if the script includes all the variations of the same dialogue message. The current implementation is an external command wrapped in an external application as an clickable button on ribbon, which is per-session based. It does have an alternative of implementing on-start and on-shut method to load it before project opens.

Code Block  – Auto Dismiss Revit Dialogues of Wall Attachment to Roof/Modified Floor

Leave a Reply