static void OnDocumentChanged(
object sender,
DocumentChangedEventArgs e)
{
Document doc = e.GetDocument();
// To avoid reacting to family import,
// ignore family documents:
if( doc.IsFamilyDocument )
{
View view = FindElevationView(
doc, e.GetAddedElementIds() );
if( null != view )
{
string msg = string.Format(
"You just created an "
+ "elevation view '{0}'. Are you "
+ "sure you want to do that? "
+ "(Elevations don't show hidden line "
+ "detail, which makes them unsuitable "
+ "for core wall elevations etc.)",
view.Name );
TaskDialog.Show( "ElevationChecker", msg );
// Make sure we see this warning once only
// Unsubscribing to the DocumentChanged event
// inside the DocumentChanged event handler
// causes a Revit message saying "Out of
// memory."
//doc.Application.DocumentChanged
// -= new EventHandler<DocumentChangedEventArgs>(
// OnDocumentChanged );
}
}
}