Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IDW file save/export to PDF differences

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
546 Views, 3 Replies

IDW file save/export to PDF differences

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

3 REPLIES 3
Message 2 of 4
rhasell
in reply to: Anonymous

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")

 

Reg
2024.2
Please Accept as a solution / Kudos
Message 3 of 4
Anonymous
in reply to: rhasell

Thank you for your quick reply.

 

May I ask, what is 

oPDFAddIn ?
Message 4 of 4
rhasell
in reply to: Anonymous

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.

 

Reg
2024.2
Please Accept as a solution / Kudos

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report