Is there a way to batch plot to pdf?

Is there a way to batch plot to pdf?

jblower
Enthusiast Enthusiast
688 Views
7 Replies
Message 1 of 8

Is there a way to batch plot to pdf?

jblower
Enthusiast
Enthusiast

I've got a model w/ 100 individual drawings.  Problem is I need a pdf copy in addition to the .dwg for each.  Any way to do a batch plot and crank them out rather than needing to do each one individually?

0 Likes
689 Views
7 Replies
Replies (7)
Message 2 of 8

Waguespack_Curtis
Contributor
Contributor

@jblower What version of Inventor are you using?

0 Likes
Message 3 of 8

jblower
Enthusiast
Enthusiast

2021 PRO

0 Likes
Message 4 of 8

blandb
Mentor
Mentor

I have an ilogic rule that generates a PDF on every save of a drawing, so later my boss can bind them all to a single pdf later if he wants.

 

But have you looked into using the TASK SCHEDULER > Print Files > Add drawings > Options > choose pdf writer?

Autodesk Certified Professional
0 Likes
Message 5 of 8

jblower
Enthusiast
Enthusiast
No, I'll see if that works.
0 Likes
Message 6 of 8

Curtis_Waguespack
Consultant
Consultant

Hi @jblower,

 

You can give this a try. 

 

Here is a link to a batch tool I created years ago that will allow you to select drawings and then run an iLogic rule to create the PDF

 

iLogic Drawing Batch Tool 2015.v.1.4.idw

 

I don't have Inventor 2021 on this machine so you will have to create and load the PDF rule into this file first by following these steps.

 

  • Open the batch tool file and create a rule called Create PDFs *** ( the exact name is not important but it must have *** on the end.)
  • Paste the code provided below into the new PDF rule and click the Save button.
  • Then save the batch tool. drawing file. (this will open the iLogic batch tool form)
  • In the form click the Refresh Rule List button.
  • Then select the PDF rule from the drop down list.
  • Now you're ready to use the batch tool to select the drawings and batch them.

 

Curtis_Waguespack_0-1691600439194.png



 

 

oDoc =  ThisApplication.ActiveEditDocument
oPath = IO.Path.GetDirectoryName(oDoc.fullfilename) 'use this line to wrtie the PDFs to the same folder as the drawing
'oPath = "C:\Temp\My PDFs" 'use this line if you want to output the PDFs to a different folder
oFileName = IO.Path.GetFileNameWithoutExtension(oDoc.fullfilename)'without extension

oPDFPathandName = oPath & "\" & oFileName & ".pdf"

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

oOptions.Value("All_Color_AS_Black") = 1
oOptions.Value("Remove_Line_Weights") = 1
oOptions.Value("Vector_Resolution") = 400
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
'oOptions.Value("Custom_Begin_Sheet") = 2
'oOptions.Value("Custom_End_Sheet") = 4

'Check for the PDF folder and create it if it does not exist
If Not System.IO.Directory.Exists(oPath) Then
    System.IO.Directory.CreateDirectory(oPath)
End If

 'Set the PDF target file name
oDataMedium.FileName = oPDFPathandName

'Publish document
oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)

 

 

 

EESignature

Message 7 of 8

jblower
Enthusiast
Enthusiast
That partially worked but for some reason all my drawings w/ assemblies cause IV to crash. And others saved in ACAD force me to save them in IV first even though they're IV dwg. Any idea why?
0 Likes
Message 8 of 8

Curtis_Waguespack
Consultant
Consultant

Hi @jblower 

 

I couldn't tell if you were referring to an issue with the batch tool that I posted or the Task Scheduler.

 

If it was the former, you can edit the rule called Batch Rule and delete all the code and replace it with this version, which will open the file with deferred updates and will close the drawings without saving changes.

 

Curtis_Waguespack_1-1691605992383.png

 

 

If Parameter("ActionList") = "" Then
MessageBox.Show("No rule selected to batch process.", "iLogic",MessageBoxButtons.OK,MessageBoxIcon.Warning)
Return
End If

Try
ThisDoc.Save
Catch
End Try

oRUSure = MessageBox.Show("This could take a while, are you sure you want to:  " & vbLf & "   " & Parameter("ActionList") , _
 "Start Batch Process?",MessageBoxButtons.YesNo,MessageBoxIcon.Question)
 
If oRUSure = vbNo Then
Return 'exit rule
End If 

 
'[ batch process the list Of files -----------------------------------------------------

If Parameter("Files_List") = "< No Files >" Then 
MessageBox.Show("There are no files in the list.", "iLogic",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return 'exit rule
End If

Try 
oTest = MultiValue.List("Files_List") 'check for list parameter

Dim invDoc As DrawingDocument
Dim oOptions As NameValueMap
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oOptions.Value("DeferUpdates") = True
		
	i=0
	For Each oItem in MultiValue.List("Files_List")
		'open the indexed file, false opens the file without generating the graphics
		'invDoc = ThisApplication.Documents.Open(MultiValue.List("Files_List").Item(i), True) 
		invDoc = ThisApplication.Documents.OpenWithOptions(MultiValue.List("Files_List").Item(i), oOptions, True)

		'run the rule
		iLogicVb.RunRule(Parameter("ActionList"))
	
		i=i+1
		If invDoc.FullFileName <> ThisDoc.Document.FullFileName Then
			Try
			invDoc.close(True) 'close the file skip save
			Catch
			End Try
		Else
		End If
	Next
Catch

End Try
']


MessageBox.Show("Batch processing files is complete.", "iLogic",MessageBoxButtons.OK,MessageBoxIcon.Information)

 

EESignature