Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi.
Im trying to get inventor to export my drawing to a folder on a network drive.
But my iLogic code doesnt work.
I have found a code that i thought would work but i get an error saying
"The given path's format is not supported."
SyntaxEditor Code Snippet
'query user question = MessageBox.Show("Is a .PDF Export To Monitor Required?", "iLogic Question",MessageBoxButtons.YesNo,MessageBoxIcon.Question) 'set condition based on answer If question = vbYes Then '------start of iLogic------- oPath = ThisDoc.Path oFileName = ThisDoc.FileName(False) 'without extension oRevNum = iProperties.Value("Project", "Revision Number") oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById _ ("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}") oDocument = ThisApplication.ActiveDocument oContext = ThisApplication.TransientObjects.CreateTranslationContext oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism oOptions = ThisApplication.TransientObjects.CreateNameValueMap oDataMedium = ThisApplication.TransientObjects.CreateDataMedium If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then oOptions.Value("All_Color_AS_Black") = 0 oOptions.Value("Remove_Line_Weights") = 0 oOptions.Value("Vector_Resolution") = 400 oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets oOptions.Value("Custom_Begin_Sheet") = 1 oOptions.Value("Custom_End_Sheet") = 10 End If 'get PDF target folder path oFolder = Left(oPath, InStrRev(oPath, "\\G:\Dokumentation\Ritningar\Ritningar Monitor\$Ritningar From CAD")) & "\\G:\Dokumentation\Ritningar\Ritningar Monitor\$Ritningar From CAD" 'Check for the PDF folder and create it if it does not exist If Not System.IO.Directory.Exists(oFolder) Then System.IO.Directory.CreateDirectory(oFolder) End If If iProperties.Value("Project", "Revision Number") >= "1" Then 'Set the PDF target file name oDataMedium.FileName = oFolder & "\" & oFileName & _ "-" & oRevNum & ".pdf" Else 'Set the destination file name oDataMedium.FileName = oFolder & "\" & oFileName & ".pdf" End If Else Return End If On Error Goto handlePDFLock 'Publish document oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium) '-------------------------------------------------------------------------------------------------------------------- Exit Sub handlePDFLock:MessageBox.Show("PDF not created, most likely someone else has it open.", "No PDF for you " & ThisApplication.GeneralOptions.UserName & "!") Resume Next 'Show message box MessageBox.Show("Drawing saved and PDF Exported to LAST EDITED document folder/PDF", "Save I-logic") '------end of iLogic-------
Whats wrong?
Using Inventor 2015
Jesper
//Jesper
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Solved! Go to Solution.