Export Single View to DWG with User-inputted Filename

Export Single View to DWG with User-inputted Filename

Anonymous
Not applicable
459 Views
1 Reply
Message 1 of 2

Export Single View to DWG with User-inputted Filename

Anonymous
Not applicable

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

0 Likes
460 Views
1 Reply
Reply (1)
Message 2 of 2

jeremytammik
Autodesk
Autodesk

Dear IanMage1,

 

Three questions:

 

One: What problems are you having with the code discussed in the post?

 

It is based on the Revit SDK sample ImportExport, so you should have a reliable running version of it at hand.

 

Two: What problems do your users have with the renaming of the file?

 

Don't break a running system!

 

Three: Have you searched this forum for previous discussions of this topic?

 

I quickly looked up 'dwg export name' and see a large number of related threads.

 

I would be very surprised if this question has not already been addressed.

 

Hence the blog post, of course.

 

How about you and I collaborate to get that blog post updated so it works for you?

 

Cheers,

 

Jeremy



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

0 Likes