Convert to PDF all IDW documents opened

Convert to PDF all IDW documents opened

Anonymous
Not applicable
1,672 Views
3 Replies
Message 1 of 4

Convert to PDF all IDW documents opened

Anonymous
Not applicable

Hi,

 

Is it possible to create a logic to convert all IDW documents opened to PDF? For example, I have the documents A.idw, B.idw and C.idw opened in my screen, I`d like to create a logic to save each one of them in separated PDF files: A.pdf, B.pdf and C.pdf. It would be great if I could also select the file where I want to save before saving.

 

Sorry if this is really basic, still new to iLogic.

 

Any help would be greatly appreciated.... Thank you 😃

0 Likes
Accepted solutions (1)
1,673 Views
3 Replies
Replies (3)
Message 2 of 4

johnsonshiue
Community Manager
Community Manager

Hi! I believe there should be a solution using iLogic. There are quite a few PDF export related tools on Inventor App store. Please take a look.

 

https://apps.autodesk.com/INVNTOR/en/List/Search?isAppSearch=True&searchboxstore=INVNTOR&facet=&coll...

 

Many thanks!



Johnson Shiue ([email protected])
Software Test Engineer
Message 3 of 4

rhasell
Advisor
Advisor
Accepted solution

Hi

Here is a copy of my code, it does not do all open files, but it will export the current file.

I do however use a batch tool made by Curtis  to export large data packs.

 

The only thing you need to change in the code is the destination directory, it will then be sufficient for testing and modifying.

 

'Date: 14.10.2020
'Author: Reg Hasell

'A basic check to see if the file already exists, (I did not want to slow the process down too much)
'The PDF file is created in the d:\data\Export directory.
'The current Revision is added to the filename.

Dim oDoc As Document
oDoc = ThisDoc.Document
Dim oPDFAddIn As TranslatorAddIn
oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")

Dim oDocument As Document
oDocument = ThisDoc.Document

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") = 400
	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 = ThisDoc.Document
oFolder = "d:\data\1 EXPORT"
oDataMediumPDF.FileName = oFolder + "\" + oFileName & "[" & oRevNum & "]" & ".pdf"
'MessageBox.Show(oDataMediumDWG.FileName, "Title")
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
2026.3
Message 4 of 4

Anonymous
Not applicable

Hi rhasell, I already have a code to individually convert to PDF each idw file opened, still, your code is more elaborated and can prevent some errors. Thank you =).

0 Likes