Solved! Go to Solution.
Solved by dg2405. Go to Solution.
Here is a code that will do this....works for me It was posted on the Inventor Customization forum by Brendan Henderson. The idw name has to be the same as the referenced file in order for this to work.
Below is a copy of his post in case the link later fails.
Here is a macro I use that prints all of the IDW's related to an assembly. This macro is run from the assembly model. There are 4 caveats :-
1. The IDW of the assembly the macro is run from does not print (so print it manually)
2. The IDW's do not print in perfect order
3. It is coded to print to a specific printer, A3 and in landscape
4. It strips the file extension from the file name so file extensions must be visible in Windows Explorer.
Function fileExists(fname) As Boolean
If Dir(fname) <> "" Then fileExists = True Else fileExists = False
End Function
Public Sub PrintRefIDWs()
Dim oAsmDoc As AssemblyDocument
Set oAsmDoc = ThisApplication.ActiveDocument
If ThisApplication.ActiveDocument.DocumentType <> kAssemblyDocumentObject Then
MsgBox "This is NOT an assembly document!", vbExclamation
Exit Sub
End If
Dim oPrintMgr As PrintManager
Set oPrintMgr = ThisApplication.ActiveDocument.PrintManager
If MsgBox("Using default printer """ & oPrintMgr.Printer & """ Do you want to continue?", vbYesNo + vbQuestion) = vbNo Then
Exit Sub
End If
Dim oDrgPrintMgr As DrawingPrintManager
MsgBox "Using printer " & oPrintMgr.Printer & ", printing 1 copy, A3 paper, landscape."
dirPath = Left(oAsmDoc.FullFileName, Len(oAsmDoc.FullFileName) - Len(oAsmDoc.DisplayName))
Dim oRefDocs As DocumentsEnumerator
Set oRefDocs = oAsmDoc.AllReferencedDocuments
Dim oRefDoc As Document
numFiles = 0
For Each oRefDoc In oRefDocs
idwPathName = Left(oRefDoc.FullDocumentName, Len(oRefDoc.FullDocumentName) - 3) & "idw"
If fileExists(idwPathName) Then
numFiles = numFiles + 1
'If numFiles = 10 Then Exit Sub
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.Documents.Open(idwPathName, True)
oDrawDoc.Activate
Set oDrawDoc = ThisApplication.ActiveDocument
Set oDrgPrintMgr = oDrawDoc.PrintManager
oDrgPrintMgr.AllColorsAsBlack = True
oDrgPrintMgr.ScaleMode = kPrintBestFitScale
Set oPrintMgr = ThisApplication.ActiveDocument.PrintManager
' Printer setup, default printer
oPrintMgr.ColorMode = kPrintDefaultColorMode ' Set to default
oPrintMgr.NumberOfCopies = 1 ' Set to print one copies.
oPrintMgr.Orientation = kLandscapeOrientation ' Set to print using landscape orientation.
oPrintMgr.PaperSize = kPaperSizeA3 'Set the paper size.
oPrintMgr.SubmitPrint ' Submit the print.
oDrawDoc.Close (True)
End If
Next
MsgBox "There are " & numFiles & " sent to printer."
End Sub
You can use the Multi-sheet Plot wizard to plot multiple drawing sheets that include drawings of various sizes. You can select IDW, 2D DWF, and DWG files.
From the Start menu, click Programs Autodesk Autodesk Inventor 2012 [version] Autodesk Multi-sheet Plot to open the Multi-sheet Plot wizard.
Manuela,
That is true. I have used the Multi-Sheet Plot tool several times. You still have to know what idw's you want to print, then weed through directories and add the ones you want to the list. You cant save the list, so if you want to generate the prints again, you have to go through the same routine. With this macro you dont have to do that. Here is how this works.
1. Set your default printer via Windows start menu.
2. Open an iam in Inventor.
3. Run the macro.
This will print EVERY idw that exists for all parts in this iam. I have mine set up to print to pdf's in a temp directory so I can easily bundle all the idws into a single package. This is a HUGE timesaver for me.
Fully agree with your explanation. Inventor Multi-Sheet Plot its a little poor...for example is not possible to specify in advance that A3 go to X printer and A4 goes to Z printer...and so on...
Some time ago i found Inventor Plot addin from http://www.inventortools.net/ and works very well with Inventor 2010 but unfortunately no longer works with 2012...
Would there be a way to make it search in the following directories for drawings? We don't put the drawing files in the same folder as the parts and assembly.
We usually go like this C:/Project/Job No/Part1.ipt
the drawing would be : C:/Project/Job No/Details/Part1.idw
PS: Sorry for bringing that old post up...
Not a problem bringing up this old post.
It shouldnt be a problem if you are always using the same subfolder for the details. The way this code was written it assumes that the idw is in the same location as the iam (you figured this out already). I'm sure someone here can edit one line of code and get this working for you. If not, try the customization group. Someone over there should be able to help.
Post back when you figure it out.
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?
Yannick,
I think what you are referring to is the "Drawing Porter". Here's the link. It allows you to batch print, but it does not add the QTY required of each to the print.
Right now, I add this manually. I have a custom iProperty that I use to store the qty required. I have this iproperty in a sketch symbol that puts that information on the idw. Of course, its a manual thingy, but it works for now. I reuse some of the same parts on some of my projects, so I have to update the idws for each release. That's the only way I know how to do it. An app to add this to each idw would be awesome.
Kirk
Yannick,
I thought Steve was asking about adding part QTY..... not the number of sheets to print. My bad.
I will check out the Quantity tool you mentioned.
Thanks.
Karther1,
You are correct, I want the qty required to print on the drawing. From the screen shots I do not see that ability in Drawing Porter. I downloaded and installed Drawing Porter to check but it will not run.
Steve
I had the same problem. They sent me a new build. Install the attached one.
As for as adding the QTY to the print.... I tried the Quantity tool that Yannick mentioned. It works pretty well. Basically does what I was doing manually. It adds a custom iproperty to each part in the assembly. You will have to make a stamp that includes the custom iproperty and place that on your idw.
Kirk
karthur1,
I uninstalled my version on Drawing Porter and installed yours. This time it ran but is faulted out saying that it could not open Inventor. I have a 64bit Win 8.1 machine running Inventor 2014. I also tried it on a 64bit Win7 machine running Inventor 2012 and had the same fault.
Any ideas?