Als je een Inventor drawing hebt met meerdere sheets, dan kan het soms nodig zijn om iedere sheet als een apart pdf bestand op te slaan. Onderstaande iLogic routine laat je toe om exact dat te doen.


oPath = ThisDoc.Path
oFileName = ThisDoc.FileName(False) 'without extension
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

'Define the drawing
Dim oDrawing As DrawingDocument
oDrawing = ThisDoc.Document

Dim oSheet As Sheet
Dim lPos As Long
Dim rPos As Long
Dim sLen As Long
Dim sSheetName As String
Dim iSheetNumber As Integer

'step through each drawing sheet
For Each oSheet In oDrawing.Sheets

	'find the seperator in the sheet name:number
	lPos = InStr(oSheet.Name, ":")
	'find the number of characters in the sheet name
	sLen = Len(oSheet.Name)
	'find the sheet name
	sSheetName = Left(oSheet.Name, lPos -1)
	'find the sheet number
	iSheetNumber = Right(oSheet.Name, sLen -lPos)

	oOptions.Value("All_Color_AS_Black") = 0
	oOptions.Value("Remove_Line_Weights") = 0
	oOptions.Value("Vector_Resolution") = 400
	oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintCurrentSheet 

	'get PDF target folder path
	'oFolder = oPath & "\PDF" 
	oFolder = Left(oPath, InStrRev(oPath, "\")) & "PDF\" & oFileName

	'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

	'Set the PDF target file name
	oDataMedium.FileName = oFolder & "\" & sSheetName & " " & iSheetNumber  & ".pdf"
	oSheet.Activate
	'Publish document
	oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)

Next


Deze iLogic routine maakt een folder met de naam PDF met daarin een folder met de naam van de drawing. Daarin worden de verschillende sheets met de sheetname en sheetnummer als PDF bewaard. 


Klik hier om te zien hoe je iLogic rules kan inladen en gebruiken in Inventor.

Controleer onze opleidingskalender voor meer informatie over Inventor.