Export DWG time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
We have multi-sheet IDW that we then save each sheet to an individual DWG that gets named whatever the "Project Number" is for the model on that sheet. If I go to File, SaveAs, Autodcad DWG and select all pages, it takes less than a minute for a 20 sheet drawing. I will then have to rename all the DWG files and be done.
The code I wrote below gets the "Project Number" first model on the sheet and exports each DWG with the correct file name... problem is it takes over 7 minutes for the same 20 sheet drawing. This uses the DWG Addin function but is there another method that works more efficiently? I have a hard time believing this is the best I'm gonna get so I'm hopeful I did something wrong or there is a better method. Anyone have any suggestions?
' Get the DWG translator Add-In. Dim DWGAddIn As TranslatorAddIn DWGAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC2-122E-11D5-8E91-0010B541CD80}") 'Set a reference to the active document (the document to be published). Dim oDoc As Document oDoc = ThisApplication.ActiveDocument Dim oContext As TranslationContext oContext = ThisApplication.TransientObjects.CreateTranslationContext oContext.Type = kFileBrowseIOMechanism ' Create a NameValueMap object Dim oOptions As NameValueMap oOptions = ThisApplication.TransientObjects.CreateNameValueMap ' Create a DataMedium object Dim oDataMedium As DataMedium oDataMedium = ThisApplication.TransientObjects.CreateDataMedium ' Check whether the translator has 'SaveCopyAs' options If DWGAddIn.HasSaveCopyAsOptions(oDoc, oContext, oOptions) Then Dim strIniFile As String strIniFile = "\\fdg-vault\Design Data\iLogic\FDG-IDW-EXPORT-DWG.ini" ' Create the name-value that specifies the ini file to use. oOptions.Value("Export_Acad_IniFile") = strIniFile End If 'Set the destination file name Dim oPath = ThisDoc.Path Dim oSheet As Sheet Dim DWGName As String Dim DwgNo As String Dim oDrawingView As DrawingView For Each oSheet In oDoc.Sheets 'Grab the first drawing view on the sheet & model oDrawingView = oSheet.DrawingViews(1) oModel = oDrawingView.ReferencedDocumentDescriptor.ReferencedDocument 'Grab the Project iproperty of the first drawing view model DwgNo = oModel.PropertySets.Item(3).Item("Project").Value DWGName = oPath & "\" & DwgNo & ".dwg" 'MessageBox.Show(DWGName, "Title") oDataMedium.FileName = DWGName 'Publish document. Call DWGAddIn.SaveCopyAs(oDoc, oContext, oOptions, oDataMedium) Next