When in AutoDesk Inventor 2019, if i have a .IDW file open,
I can export it to a PDF, or click 'Save As', and change the file name extension to .pdf.
Both options create a PDF file of this .IDW file.
My question is, are these 2 methods different? Because I am writing a macro, and I cannot find the export function, but I can find the SaveAs function so I was thinking of going with the SaveAs function.
Thanks
Hi
As far as I can see, they are the same.
All the sample export iLogic code snippets use "Savecopyas"
I have attached some working code for your reference.
All you need to is change the destination directory. ("d:\data\1 EXPORT")
SyntaxEditor Code Snippet
'Date: 26.09.2016 'Author: Reg Hasell ' Version 1.0 'It will Do a very basic check to see if the file already exists, (I did not want to slow the process down too much 'It will then create a PDF file in the export directory. 'It will also add the current Revision to the filename. Dim oDoc As Document oDoc = ThisApplication.ActiveDocument Dim oPDFAddIn As TranslatorAddIn oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}") 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 Dim oDataMediumPDF As DataMedium oDataMediumPDF = ThisApplication.TransientObjects.CreateDataMedium '--PDF settings--- 'If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then If oPDFAddIn.HasSaveCopyAsOptions(oDoc, oContext, oOptions) Then oOptions.Value("All_Color_AS_Black") = 0 oOptions.Value("Remove_Line_Weights") = 0 oOptions.Value("Vector_Resolution") = 4800 oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets End If '---End PDF settings '--- oPath = ThisDoc.Path oFileName = ThisDoc.FileName(False) 'without extension oRevNum = iProperties.Value("Project", "Revision Number") oDocument = ThisApplication.ActiveDocument oFolder ="d:\data\1 EXPORT" oDataMediumPDF.FileName =oFolder + "\" + oFileName & "[" & oRevNum & "]" & ".pdf"
If System.IO.File.Exists(oDataMediumPDF.FileName) Then oChoice=MessageBox.Show(oDataMediumPDF.FileName & " Already Exists - Overwrite?", "Title", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If oChoice=7 'MessageBox.Show("exit", "Title") Return Else 'MessageBox.Show("Overwrite", "Title") End If End If '''--- Publish document. oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMediumPDF) Beep MessageBox.Show("Done!", "Title")
Hi
I am sure that the more educated members of the forum can give a more detailed description, but is is a descriptive name given to the translator addin, allowing you to reference the object throughout the code without having to reference the translator addin every time.
That's my uneducated view, I am not a programmer, just copy and paste, change and debug.