Message 1 of 3

Not applicable
02-19-2015
08:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
i'm trying to automatically export a drawing to DWG and PDF to a certain directory.
This directory is defined by the client name (Klantnaam).
It works, but if i fill in the client name once, and then update the drawing, the pdf file wont be updated if i save the file again.
Also, the code that converts the drawing to DWG always gives an undefined error..
I hope someone can point me in the right direction
SyntaxEditor Code Snippet
Dim propertyName As String = "Klantnaam" Dim propertyValue As String customPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties") Try prop = customPropertySet.Item(propertyName) Catch ' Assume error means not found customPropertySet.Add("", propertyName) iProperties.Value("Custom", propertyName) = "null" End Try If iProperties.Value("Custom", propertyName) = "null" Then propertyValue = InputBox("Voer klantnaam in : ", "Klantnaam", "") iProperties.Value("Custom", propertyName) = propertyValue End If strFolder ="J:\Contacten\Klanten\" & propertyValue & "\Tekeningen\" & ThisDoc.FileName (False) ThisDoc.Document.SaveAs(strFolder & (".pdf") , True) ' 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 oDocument As Document oDocument = 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(oDocument, oContext, oOptions) Then Dim strIniFile As String strIniFile = "C:\temp\acad.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 fileName As String fileName = ThisDoc.FileName(False) & " -Rev " & iProperties.Value("Project", "Revision Number") & " Section cut " oDataMedium.FileName = strFolder & ".dwg" 'Publish document. Call DWGAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
Solved! Go to Solution.