Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Anonymous
in reply to: Curtis_Waguespack

So the big picture is that we want to take a sorted parts list and make PDF of every drawing in order as they appear on the parts list (for manufacturing purposes). I actually was able to get this accomplished this morning with more research and looking in the Community Resources and Programming Help. This is the method that I found worked for what we need to do... It does assume that a parts list is in the drawing and that each part print is in the same location as the part model. Both of which work fine for us. I have some programming background, but am by no means a programmer. There might be other ways to get the task accomplished, but this is working for us now.

 

 

Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oDrawingView As DrawingView
Dim oSheet As Sheet = oDrawDoc.ActiveSheet
Dim oPartList As PartsList

oPartList = oSheet.PartsLists(1)
 
oDrgPrintMgr = oDrawDoc.PrintManager
oDrgPrintMgr.Printer = "PDFCreator"
oDrgPrintMgr.PrintRange = kPrintAllSheets
oDrgPrintMgr.AllColorsAsBlack = False
oDrgPrintMgr.ScaleMode = kPrintBestFitScale 'oDrgPrintMgr.ScaleMode = kPrintModel
oDrgPrintMgr.ColorMode = kPrintDefaultColorMode
oDrgPrintMgr.PaperSize = SizeActiveSheet
oDrgPrintMgr.SubmitPrint

Dim drawBomRow As DrawingBOMRow
Dim refDoc As Document

For Each oPartListRow In oPartList.PartsListRows
	If oPartListRow.Visible = "True" And oPartListRow.Custom = "False" Then
		Try
		drawBomRow = oPartListRow.ReferencedRows.Item(1)
		refDoc = drawBomRow.BOMRow.ComponentDefinitions.Item(1).Document
		FilePath = refDoc.FullFileName()
		FilePath = Left(FilePath,Len(FilePath)-3) & "idw"
		ThisApplication.Documents.Open(FilePath,True)
		Dim oDrawDoc2 As DrawingDocument = ThisApplication.ActiveDocument
		oDrgPrintMgr2 = oDrawDoc2.PrintManager
		oDrgPrintMgr2.Printer = "PDFCreator"
		oDrgPrintMgr2.PrintRange = kPrintAllSheets
		oDrgPrintMgr2.AllColorsAsBlack = False
		oDrgPrintMgr2.ScaleMode = kPrintBestFitScale 'oDrgPrintMgr.ScaleMode = kPrintModel
		oDrgPrintMgr2.ColorMode = kPrintDefaultColorMode
		oDrgPrintMgr2.PaperSize = SizeActiveSheet
		oDrgPrintMgr2.SubmitPrint
		ThisApplication.ActiveDocument.Close(True)
		Catch
		drawBomRow = oPartListRow.ReferencedRows.Item(1)
		refDoc = drawBomRow.BOMRow.ComponentDefinitions.Item(1).Document
		FilePath = refDoc.FullFileName()
		FilePath = Left(FilePath,Len(FilePath)-3) & "idw"
		MessageBox.Show(FilePath, "File Not Found")		
		End Try
	End If
Next