Export Single View to DWG with User-inputted Filename

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone,
I spent a good amount of time writing an addin that would export a single view of a Revit document to a DWG file with a user's inputted filename, before logging the exported view name with its associated inputted filename. The log contains a line-by-line list of views within a Revit document, each with their associated export file name (whether given by the user from previous exports or entered directly into the log); if the user were to export (or re-export) a view that has an associated export file name in the log, the addin would automatically--after exporting the single view to a DWG--rename the exported file (using the FileInfo.MoveTo() function) to the view's associated export file name in the log. This works as intended.
However, some of the users of my addin would prefer that I, rather than rename the DWG file after its export, give the associated export file name to the initial exported file, such that the FileInfo.MoveTo() function is never used. I came across Jeremy's DWG Export Filename post, which directed me to the Initialize() function of the ExportData.cs code sample in the SDK. I don't have any experience incorporating this kind of code into my addins, and I'm not sure if using this code sample would even solve my issue; the modified code in this post can be used to reorder, replace, or omit some of Revit's hard-coded filename prefixes, but does not seem to allow an arbitrary user-inputted string to be the initial export filename.
Is it currently possible to override Revit's hard-coded file-naming conventions to achieve this goal, or is the FileInfo.MoveTo() function the best option at this point?
Thank you,
IanMage1