I think your best deal is FORGE DA4R(Design Automation for Revit). It is really good for tasks like that and you don't even have to own Revit license.
But if you want to have a desktop app, you can create a IExternalDBApplication Interface that implements, every time you open a new document, it exports sheet then you can subscribe it manually once and for all.
In another Windows Desktop Console Application, you can implement open revit file then close it so on.
I wrote some code for this hope that helps. Need some polishing though.
This is IExternalDBApplication Interface
public class sheetExporterDB : IExternalDBApplication
{
public ExternalDBApplicationResult OnShutdown(ControlledApplication application)
{
application.DocumentOpened -= Application_DocumentOpened;
return ExternalDBApplicationResult.Succeeded;
}
public ExternalDBApplicationResult OnStartup(ControlledApplication application)
{
application.DocumentOpened += Application_DocumentOpened;
return ExternalDBApplicationResult.Succeeded;
}
private void Application_DocumentOpened(object sender, Autodesk.Revit.DB.Events.DocumentOpenedEventArgs e)
{
Document doc = e.Document;
using (Transaction t = new Transaction(doc))
{
// Start the transaction
t.Start("Export Sheets DWG");
try
{
var viewSheets = new FilteredElementCollector(doc).OfClass(typeof(ViewSheet)).Cast<ViewSheet>();
// create DWG export options
DWGExportOptions dwgOptions = new DWGExportOptions();
dwgOptions.MergedViews = true;
dwgOptions.SharedCoords = true;
dwgOptions.FileVersion = ACADVersion.R2013;
List<ElementId> views = new List<ElementId>();
foreach (var sheet in viewSheets)
{
if (!sheet.IsPlaceholder)
{
views.Add(sheet.Id);
}
}
doc.Export(@"D:\sheetExporterLocation","TEST.dwg", views, dwgOptions);
}
catch (Exception ex)
{
}
// Commit the transaction
t.Commit();
}
}
}
This is the console app
static void Main(string[] args)
{
Process p = new Process();
ProcessStartInfo psi = new ProcessStartInfo()
{
WindowStyle = ProcessWindowStyle.Hidden,
// Project Location
FileName = @"D:\forgeWindowTest.rvt"
};
p.StartInfo = psi;
p.Start();
}
Hope that helps,
Recep.