Parts List with Thumbnail Image

There was a recent question in the customization newsgroup about creating a parts list in Word or Excel that contained the thumbnail image for each part.  This seemed like an interesting problem to tackle.  Since a parts list is a table, Excel was the obvious first choice.  However, after playing with it a bit I found that Excel doesn’t support inserting pictures into cells and from what I found online is an enhancement coming in Office 2010.  I also found out that Word does allow you to insert pictures into table cells so that’s what I decided to use.

Below is an example of the result using one of the sample files that comes with Inventor.

PartListThumbResult

My initial code for this was a VBA macro but it was found to have a problem on 64-bit machines.  I’m leaving the original VBA version described below because it’s simpler and easier to understand the what’s going on.  It isn’t fancy but mostly does the job.  The new version is an add-in and will work on 32 and 64-bit machines.

Add-In Version 
To use this version download this zip file.  Inside the zip is a .exe and another zip file.  The .exe is an installer and running it will install the add-in.  It creates a new button on the Tools tab of the drawing ribbon.  If you’re using the classic UI then it adds a new button to the annotation panel bar.  The add-in is compatible with Inventor 2010.  The zip file contains the source code for the add-in, in case you’re interested in that.  It was written using Visual Basic Express 2008.

VBA Version
You can To use the program you need to copy and paste the source code into VBA.  I would recommend pasting it into your VBA application project, as shown below.

PasteMacroVBA

Since this program uses Word and drives it through the Word API, you need to add a reference to the Word Object Library.  You do this by using the References… command in the Tools menu within VBA.  You need to check the box next to “Microsoft Word 12.0 Object Library” as shown below.  (I received some feedback on the newsgroup that this will also work with Word 2002 with some small changes to the code, which I’ve made the linked source code.  There’s also a change so that it’s tolerant of files that don’t have a thumbnail.  Thanks to Cadfish1 from the autodesk.inventor.customization newsgroup for his input.)

ReferenceWord

Now you’re all set.  You need to have a drawing open and the parts list selected that you want to write out and then you can run the program.  You run the program using the Macros command on the Tools tab of Inventor (which you can also access using Alt-F8).  Once it’s finished you should have a new Word document that contains the parts list table.


Comments

25 responses to “Parts List with Thumbnail Image”

  1. Kent Boettger Avatar
    Kent Boettger

    Hello,
    This is really cool, but is there any way to do the same from the Assembly bom view.
    Like it is right now you have to do It from a Drawing and select a bom .
    How can you export the assembly BOM into word without a Drawing present?
    Regards.
    Kent boettger.

  2. Hi
    I tried your code, the list is created but without the previews.
    Could not we be able to print, also in PDF from the assembly as the bill was structured?
    Thanks
    Marco

  3. Dennis M Koch Avatar
    Dennis M Koch

    Anyone know if this has been able to work on 64-bit systems yet?

  4. Dennis M Koch Avatar
    Dennis M Koch

    I have 64-bit… i have gotten it to where it will start to pop up messages… however, i cannot get past the msg that says (an active drawing must be open) or something like that… is there a direct email or phone # that i could talk to someone about getting this to work? OR is this a 64 bit issue…

  5. It works great .
    Thanks

  6. Doesn’t work under Russian AI2010x64.
    It says “A part list must exist on the active sheet”. The Part list does exist. In Russian it is Спецификация. It is probably due to another term used in localised ver?

  7. Dennis M Koch Avatar
    Dennis M Koch

    It works perfectly on 64 bit.

  8. Sam Nicarry Avatar
    Sam Nicarry

    Woks great! Inventor 2010 64bit.
    (Thanks for the code too.)
    snicarry

  9. Harm van de Wetering Avatar
    Harm van de Wetering

    Hello,
    It works great on my work computer with word 2003, but at home with word 2007 the previews are not displayed. Am I doing something wrong?
    Kind regards,
    Harm van de Wetering

  10. Harm van de Wetering Avatar
    Harm van de Wetering

    Hello, me again,
    If I use the Add-in it works also great with word 2007. So there is not realy a problem.
    Kind regards,
    Harm van de Wetering

  11. Hello,
    in case you don’t follow it, I posted a ‘cry for help’ on the ‘Export PartList with thumbnail’ Autodesk Discussion Groups thread
    http://discussion.autodesk.com/forums/message.jspa?messageID=6386877#6386877
    The main question is: AI2008 does not support the DrawingBOMs object. Is there a workaround in AI2008 API to refer to the part document only from object PartList?
    Any idea on how to achieve this would be very appreciated.
    Best Regards,
    Gonçalo Ferreira

  12. Hi Gonçalo,
    You should be able to use the ReferencedFiles property of the PartsListRow object. It’s a hidden property that was retired when the DrawingBOM functionality was added. It still works to allow for backward compatibility.
    -Brian

  13. I tried your code, it creates the list but not the previews. Can not we be able to print, also in PDF format of the assembly as the bill was structured?

  14. There was a recent question in the customization newsgroup on the creation of a parts list in Word or Excel which contains the thumbnail image for each part.

  15. I tried your code, it creates the list but not the previews. Can not we be able to print, also in PDF format of the assembly as the bill was structured?
    http://rapidpig.com

  16. I have 64-bit… i have gotten it to where it will start to pop up messages… however, i cannot get past the msg that says (an active drawing must be open) or something like that… is there a direct email or phone # that i could talk to someone about getting this to work? OR is this a 64 bit issue…
    http://www.mediafiretorrent.com

  17. Brain,
    I have a drawing with an assembly. That drawing also has a detail drawing a part from the assembly. But the part for the detail drawing has been opened by separately so is not a part of the assembly. Therefore if I attached a balloon to the part it shows 1. I am looking for a solution where I would be able to attach the balloon for the part from the assembly parts list.
    Thus I am looking for a code like:
    1. record a path (folders/sub-folders) of parts from the parts list or the assembly with the item numbers from the parts list
    2. check if the part (that opened individually but the same drawing) does much with the records list
    3. if yes attach the balloon with number from the assembly part list.
    So I am looking for a vba code or similar code to modify…
    if you could help mi please with it
    many thanks
    Wojciech

  18. Thomas Vandenberghe Avatar
    Thomas Vandenberghe

    Hi,
    It works great on our Inventor 2011 x64.
    But we only get the partlist on first level.
    Is there a way to get the full partlist (hierarchical)?
    Thanks!
    Thomas.

  19. Brian,
    Thanks a bunch. This is just what We’ve been looking for. We’re on INV2011 x64 with Word2010 and no issues at all. Didn’t have to make any changes in Word.

  20. Maria Manuela Avatar
    Maria Manuela

    Great Job! Thanks for sharing Brian!

  21. Varinder Avatar
    Varinder

    Hi,
    Do you have similar add-in for Inventor 2012.

  22. Kirk Arthur Avatar
    Kirk Arthur

    Installed the Add-In version on 2011×64. Installed without issues. When I opened the iam, there was not a button on the Tools ribbon. I was able to add it, but it is greyed out, thus will not work. the add-in shows to be loaded.
    Uninstall/reinstalled… problem persists

  23. Therefore if I attached a balloon to the part it shows 1. I am looking for a solution where I would be able to attach the balloon for the part from the assembly parts list.

  24. Janice Chunn

    Awesome blog article.Much thanks again. Great.

  25. […] you’ve seen the program from a previous post that creates a parts list with thumbnail images you might think that it’s breaking some of these […]

Leave a Reply to Brick patio designsCancel reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading