Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Printing drawing sheet sets from assembly BOM Parts list

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
Adrian010
5254 Views, 11 Replies

Printing drawing sheet sets from assembly BOM Parts list

Here is my question,

I have created an assembly that has a parts list, and in this parts list I have up to 100 mono detail drawings. I would like to know if there is a way to print all of these drawing from that list in a massive plot.

At my previous company we had something like this in AutoCAD where a script was created to look at the drawings and print all drawings mentioned in the assembly BOM and subsequent sub-assemblies, it worked beautifully.

I find that I have to print all drawings to paper or PDF individually.

It would be fantastic If someone would comes up with an App to solve this problem.

 

Cheers.

11 REPLIES 11
Message 2 of 12

Hi Adrian010,

 

There is a VBA example for batch printing from the assembly here:

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

 

 

And here is an ilogic rule to batch output PDF files for each component in the assembly. This rule assumes that the component drawings share the same name and location of the component.

 

For example: C:\Temp\widget-450.ipt has a drawing: C:\Temp\widget-450.idw

If the drawing file is not found, then it simply moves on and looks at the next component.

 

I've not tested this rule very extensively, so it might contain flaws.

 

This rule may not work for everyone, but it should provide a starting point from which it can be modified as needed.

 

You can refer to this link to see how a basic rule is created, if iLogic is new to you:

http://inventortrenches.blogspot.com/2012/01/creating-basic-ilogic-rule-with-event.html

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

If you get errors from copying the code below, you can use the attached *.txt file instead.

 

'define the active document as an assembly file
Dim oAsmDoc As AssemblyDocument
oAsmDoc = ThisApplication.ActiveDocument
oAsmName = Left(oAsmDoc.DisplayName, Len(oAsmDoc.DisplayName) -4)

'check that the active document is an assembly file
If ThisApplication.ActiveDocument.DocumentType <> kAssemblyDocumentObject Then
MessageBox.Show("Please run this rule from the assembly file.", "iLogic")
Exit Sub
End If

'get user input
RUsure = MessageBox.Show ( _
"This will create a PDF file for all of the asembly components that have drawings files." _
& vblf & "This rule expects that the drawing file shares the same name and location as the component." _
& vblf & " " _
& vblf & "Are you sure you want to create PDF Drawings for all of the assembly components?" _
& vblf & "This could take a while.", "iLogic  - Batch Output PDFs ",MessageBoxButtons.YesNo)

If RUsure = vbNo Then
Return
Else
End If

'- - - - - - - - - - - - -PDF setup - - - - - - - - - - - -
oPath = ThisDoc.Path
PDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

If PDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
'oOptions.Value("All_Color_AS_Black") = 0
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
End If

'get PDF target folder path
oFolder = oPath & "\" & oAsmName & " PDF Files"

'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
'- - - - - - - - - - - - -

'- - - - - - - - - - - - -Component Drawings - - - - - - - - - - - -
'look at the files referenced by the assembly
Dim oRefDocs As DocumentsEnumerator
oRefDocs = oAsmDoc.AllReferencedDocuments
Dim oRefDoc As Document

'work the the drawing files for the referenced models
'this expects that the model has a drawing of the same path and name
For Each oRefDoc In oRefDocs
idwPathName = Left(oRefDoc.FullDocumentName, Len(oRefDoc.FullDocumentName) - 3) & "idw"
'check to see that the model has a drawing of the same path and name
If(System.IO.File.Exists(idwPathName)) Then
        Dim oDrawDoc As DrawingDocument
    oDrawDoc = ThisApplication.Documents.Open(idwPathName, True)
    oFileName = Left(oRefDoc.DisplayName, Len(oRefDoc.DisplayName) -3)

    On error Resume Next ' if PDF exists and is open or read only, resume next
     'Set the PDF target file name
    oDataMedium.FileName = oFolder & "\" & oFileName & "pdf"
    'Write out the PDF
    Call PDFAddIn.SaveCopyAs(oDrawDoc, oContext, oOptions, oDataMedium)
    'close the file
    oDrawDoc.Close
Else
'If the model has no drawing of the same path and name - do nothing
End If
Next
'- - - - - - - - - - - - -

'- - - - - - - - - - - - -Top Level Drawing - - - - - - - - - - - -
oAsmDrawing = ThisDoc.ChangeExtension(".idw")
oAsmDrawingDoc = ThisApplication.Documents.Open(oAsmDrawing, True)
oAsmDrawingName = Left(oAsmDrawingDoc.DisplayName, Len(oAsmDrawingDoc.DisplayName) -3)
'write out the PDF for the Top Level Assembly Drawing file
On error Resume Next ' if PDF exists and is open or read only, resume next
 'Set the PDF target file name
oDataMedium.FileName = oFolder & "\" & oAsmDrawingName & "pdf"
'Write out the PDF
Call PDFAddIn.SaveCopyAs(oAsmDrawingDoc, oContext, oOptions, oDataMedium)
'Close the top level drawing
oAsmDrawingDoc.Close
'- - - - - - - - - - - - -

MessageBox.Show("New Files Created in: " & vblf & oFolder, "iLogic")
'open the folder where the new ffiles are saved
Shell("explorer.exe " & oFolder,vbNormalFocus)

 

 

Message 3 of 12
danny
in reply to: Curtis_Waguespack

Hi Curtis,

 

Like this, it is the next step after using your code for creating the PDF's to a subfolder.

 

I tried to use it on my Assembly, but  it gave the next error:

System.ArgumentException: De parameter is onjuist. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
   at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
   at Inventor.Documents.Open(String FullDocumentName, Boolean OpenVisible)
   at LmiRuleScript.Main()
   at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
   at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

Is that because my drawings are of the type .dwg?

Regards
Danny

Inventor 2014 sp1 | Vault basic 2014 | HP Elitebook 8670W | win7 64b | 8Gb | GMT +1
Message 4 of 12
danny
in reply to: danny

Hi Again,

 

I changed the .idw in the code to .dwg and it works like a charm...

 

 

Regards
Danny

Inventor 2014 sp1 | Vault basic 2014 | HP Elitebook 8670W | win7 64b | 8Gb | GMT +1
Message 5 of 12

Curtis,

I was trying to modify this code so that it would save the idw BEFORE it prints it to PDF.  I have another iLogic rule that fires off on the save event. I figured since it already has the idw open, why not save it..... then print it.

 

I tried placing the command "ThisDoc.Save" into your code, but the best I could get it to do was to save the top-most assembly file.

 

Can you show me what to do to get this code to save each idw?

 

Thanks,

Kirk

Message 6 of 12
Greek2Me
in reply to: Adrian010

You could make a sheet set for your part assembly, import your 100 or so part drawings, and then plot the whole thing with a few clicks, either as one massive pdf or as individual sheets.

 

Maranatha

 

"Always remember: nothing difficult is ever easy."
Message 7 of 12
karthur1
in reply to: Greek2Me

Maranatha,

Curious how you make a "sheet set" in Inventor.

 

Kirk

Message 8 of 12
Anonymous
in reply to: Adrian010

I am looking for some added functionality.  When printing the PDF, I would also like to have the QTY required to be printed on each drawing.  Is that something that can be done easily?

Message 9 of 12
dunnamin
in reply to: karthur1

Kirk or Maranatha,

 

Is it possible to make sheet sets with inventor files yet?  I am addicted to sheet sets and am making a purchase (ok, subscription), decision.

 

Currently, I use all the functionality of sheet sets in AutoCAD, not just organizing sheets, but placing views on the sheets using the Sheet Set Manager and managing all of the linked callouts with the sheet set.

 

If Inventor can give me the functionality of AutoCAD Sheet Sets, then my decision is made for Inventor over anything else, in a heartbeat.

 

Thanks,

   -- Dunn

Message 10 of 12
karthur1
in reply to: dunnamin

Dunn,

Inventor does not have anything like the Acad Sheet Set Manager.  You can have multiple sheets inside one idw, buts that has its own issues when working with a large number of files. However, if you will save the files as an Inventor DWG rather than an IDW, then you can use the Acad Sheet Set manager to manage the files.  Curtis W.has written about it here.  I included it as a PDF below as well.

 

It would be good if they would put a sheet set manager inside Inventor.

 

Kirk

Message 11 of 12

Hi all,

i've just a problem: a try to 'past&copy' the rule of the attached file.

It seems to work but the folder where the new file are created is empty.

Anyone could help me? Smiley Happy

Message 12 of 12

I assume that you are using the code posted by Curtis W. in post #2 above.  If so, you must not hide the filename extensions in Windows Explorer.  TO change this setting, go to Windows Explorer and make sure this is unchecked.

 

Kirk

 

 

2017-07-27_0730.png

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report