How to plot all parts drawings in assembly?

How to plot all parts drawings in assembly?

mucip
Collaborator Collaborator
996 Views
6 Replies
Message 1 of 7

How to plot all parts drawings in assembly?

mucip
Collaborator
Collaborator

Hi,

Is it pssible to plot (or print) all sub assemblies or parts drawings in to  seperate pages by code?

 

I do not want to open and print every parts. One code and print all... Is it possible?

 

Regards,

Mucip:)

0 Likes
Accepted solutions (1)
997 Views
6 Replies
Replies (6)
Message 2 of 7

skyngu
Collaborator
Collaborator

it is possible but also depends on the model of printer or plotter.

Autodesk Inventor Professional 2019
0 Likes
Message 3 of 7

mucip
Collaborator
Collaborator

Dear Jcneal,

I just saw below post and apply:

 

http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/Printing-all-drawings-of-an-assembly-f...

 

I assigned to printer to CutePDF printer. But unfortuatelly when I run the code Inventor crash!...

 

I just want to create pdf file first from the all asm file in to seperate part pdf drawings...

 

My Code is:

 

Sub PrintAll()

If MsgBox("Are you sure?", vbYesNo) = vbYes Then

'Opening all associated parts

'Get the active assembly.
Dim oAsmDoc As AssemblyDocument
Set oAsmDoc = ThisApplication.ActiveDocument

'Get all of the referenced documents.
Dim oRefDocs As DocumentsEnumerator
Set oRefDocs = oAsmDoc.AllReferencedDocuments

'Iterate through the list of documents.
Dim oRefDoc As Document

For Each oRefDoc In oRefDocs

'Debug.Print oRefDoc.FullFileName

'Open iam or ipt
Dim oDoc As Document
Set oDoc = ThisApplication.Documents.Open(oRefDoc.FullFileName, True)

oDoc.SelectSet.Select oDoc.ComponentDefinition

'Get the CommandManager object
Dim oCommandMgr As CommandManager
Set oCommandMgr = ThisApplication.CommandManager

'Get control definition for the line command
'Dim oControlDef As ControlDefinition
'Set oControlDef = oCommandMgr.ControlDefinitions.Item("AIMDOpenDrawingInContextMenuInternal")

Dim oControlDef As ControlDefinition
Set oControlDef = oCommandMgr.ControlDefinitions.Item("CMxOpenDrawingCMD")

'Execute the command
Call oControlDef.Execute

'Print idw
If ThisApplication.ActiveDocument.DocumentType = kDrawingDocumentObject Then

Dim oDraw As Document
Set oDraw = ThisApplication.ActiveDocument

'MsgBox oDraw.FullFileName

Dim oDrgPrintMgr As DrawingPrintManager
Set oDrgPrintMgr = oDraw.PrintManager
'Set the printer name
oDrgPrintMgr.Printer = "CutePDF Writer"

oDrgPrintMgr.PrintRange = kPrintAllSheets

'Set the paper size and scale
On Error Resume Next

Select Case oDraw.ActiveSheet.Size
Case kA4DrawingSheetSize
oDrgPrintMgr.PaperSize = kPaperSizeA4
oDrgPrintMgr.ScaleMode = kPrintCustomScale
oDrgPrintMgr.[Scale] = 1
Case kA3DrawingSheetSize
oDrgPrintMgr.PaperSize = kPaperSizeA4
oDrgPrintMgr.ScaleMode = kPrintBestFitScale
Case kA2DrawingSheetSize
oDrgPrintMgr.PaperSize = kPaperSizeA3
oDrgPrintMgr.ScaleMode = kPrintBestFitScale
Case kA1DrawingSheetSize
oDrgPrintMgr.PaperSize = kPaperSizeA3
oDrgPrintMgr.ScaleMode = kPrintBestFitScale
Case kA0DrawingSheetSize
oDrgPrintMgr.PaperSize = kPaperSizeA3
oDrgPrintMgr.ScaleMode = kPrintBestFitScale
Case Else

'Debug.Print "ungültiges Papierformat"

End Select

'Set the paper orientation
On Error Resume Next

Select Case oDraw.ActiveSheet.Orientation
Case kLandscapePageOrientation
oDrgPrintMgr.Orientation = kLandscapeOrientation
Case kPortraitPageOrientation
oDrgPrintMgr.Orientation = kPortraitOrientation
Case Else

'Debug.Print "ungültige Orientierung"

End Select

oDrgPrintMgr.SubmitPrint

'Close idw
oDraw.Close (True)

End If

'Close iam or ipt
oDoc.Close (True)

Next

'Opening Asmdrawing in context menu

Call oControlDef.Execute

Set oDraw = ThisApplication.ActiveDocument

'MsgBox oDraw.FullFileName

'Dim oDrgPrintMgr As DrawingPrintManager
Set oDrgPrintMgr = oDraw.PrintManager
'Set the printer name
oDrgPrintMgr.Printer = "CutePDF Writer"

oDrgPrintMgr.PrintRange = kPrintAllSheets

'Set the paper size and scale
On Error Resume Next

Select Case oDraw.ActiveSheet.Size
Case kA4DrawingSheetSize
oDrgPrintMgr.PaperSize = kPaperSizeA4
oDrgPrintMgr.ScaleMode = kPrintCustomScale
oDrgPrintMgr.[Scale] = 1
Case kA3DrawingSheetSize
oDrgPrintMgr.PaperSize = kPaperSizeA4
oDrgPrintMgr.ScaleMode = kPrintBestFitScale
Case kA2DrawingSheetSize
oDrgPrintMgr.PaperSize = kPaperSizeA3
oDrgPrintMgr.ScaleMode = kPrintBestFitScale
Case kA1DrawingSheetSize
oDrgPrintMgr.PaperSize = kPaperSizeA3
oDrgPrintMgr.ScaleMode = kPrintBestFitScale
Case kA0DrawingSheetSize
oDrgPrintMgr.PaperSize = kPaperSizeA3
oDrgPrintMgr.ScaleMode = kPrintBestFitScale
Case Else

'Debug.Print "ungültiges Papierformat"

End Select

'Set the paper orientation
On Error Resume Next

Select Case oDraw.ActiveSheet.Orientation
Case kLandscapePageOrientation
oDrgPrintMgr.Orientation = kLandscapeOrientation
Case kPortraitPageOrientation
oDrgPrintMgr.Orientation = kPortraitOrientation
Case Else

'Debug.Print "ungültige Orientierung"

End Select

oDrgPrintMgr.SubmitPrint

'Close idw
oDraw.Close (True)

Else

'No

End If

End Sub

 

 

 

 

 

0 Likes
Message 4 of 7

skyngu
Collaborator
Collaborator
Accepted solution

you only want pdfs from assembly. you may check out the post below.

 

http://forums.autodesk.com/t5/Autodesk-Inventor/Printing-drawing-sheet-sets-from-assembly-BOM-Parts-...

 

good luck!

Autodesk Inventor Professional 2019
0 Likes
Message 5 of 7

mucip
Collaborator
Collaborator

Hi,

Perfect solution... Thanks... 🙂

 

Regards,

Mucip:)

0 Likes
Message 6 of 7

mucip
Collaborator
Collaborator

Hi,

I tested many times... But in some how in some files this code creating corruptud pdf files. For instance, the name of the ipt file is "PMD-01-01-01.ipt" but corrupted file name is "PMD-01-01pdf"?!... It must be "PMD-01-01-01.pdf" normally but in some files I got this error...

 

Any info?...

 

Regards,

Mucip:)

 

 

0 Likes
Message 7 of 7

skyngu
Collaborator
Collaborator
the post you read uses display name instead of filename. You may change code a liitle to suit your need
Autodesk Inventor Professional 2019
0 Likes