Create SOLIDWORKS BOM with thumbnail preview

Export SOLIDWORKS BOM to Excel with thumbnail preview – SOLIDWORKS MACRO

  1. This macro exports a selected SOLIDWORKS BOM to Excel.
    A thumbnail preview is created for each of the BOM components.
  2. You must have Excel installed.
  3. This macro works with parts-only BOM.

Problems running the macro? Report a bug here.

Amen is a SOLIDWORKS API Developer. He enjoys helping the community by answering questions in the SOLIDWORKS API forums as well as writing enterprise-grade applications for the CAD industry for customers across the globe.

Technologies and frameworks he likes to work with: C#, WPF MVVM, EntityFramework, SQLSERVER, SOLIDWORKS API, JS (ThreeJs).

Posted in Uncategorized.

17 Comments

  1. Hello, Mr. Amen,

    first of all I would like to say briefly that I am glad that there are such persons as you. I am very interested in your solution regarding the parts list with preview. If all this works with the BOM I will try your PDM solution. Is it possible to get step by step instructions for the parts list? I always get an error message (You have not selected any bill of materials). I’d love to get it done, but I’m not getting any further. I’m always grateful for help.

    With kind regards

    Ilyas Zorla

    • Thanks for your comment Ilyas. I appreciate your interaction.
      If you are getting that message, it means that you have not selected a bill of materials.
      Follow these steps:
      – Open you SOLIDWORKS assembly document
      – Insert a bill of materials
      – Select the bill of materials in the three 3D space
      – Run the macro

  2. Hello Amen,

    This script works very well and as intended for assemblies with a small number of parts (less than 30 to 40) but for an assembly with larger number of parts I’m having Solid Works crash. I had a hunch and it seems that Solid Works is hitting the GDI limit of 10k. I can up the limit to about 16k but that will only delay the crash. It seems that when opening and closing each part the GDI keeps climbing and is not being let go after each part is closed.

    Any way to make this work on larger assemblies? Ideas?

    Sincerely,

    Gord Evans

  3. Hi
    There is error in this line!
    Set swTableAnnotation = swSelectionManager.GetSelectedObject6(i, -1)
    Macro is not working?!

    Regards,
    Mucip:)

  4. Hi Amen,

    Thanks for your code it works fine and generate image preview in excel sheet but saving the excel sheet i can only see the latest thumbnail image in all the rows, Any suggestions ?

      • I have the same issue. It only saves the last reverenced thumbnail. I believe that the code overwrites the previous image, and doesn’t create a new one. Any suggestions on how to modify the code so that it creates a new unique file name?

          • Even when I run it as an administrator, it still only remembers the last image. When I look in the temp folder for the image, it only has one file there isn’t a temp image with multiple numbers, so when the Excel file is opened after saving it references that single image and only shows that thumbnail.

            When you run the Marco it works and shows all the images, its just when you save it and reopen it, that it shows the last thumbnail.

  5. I have tried to use this macro. I have run into a few problems. If I run it from the assembly, it exports the BOM but with no thumbnails. If I run it from the drawing of the assembly it only exports a few of the thumbnail.

    Any suggestions would be appreciated.

  6. Amen,

    you are the best. Thank you very much for this marvellous work. I have learned a lot from your code, also how to handle an Excel document.

    Cheers, Miro

  7. Can you make it close the part file when its finished with the part entry? Mine crashes around 20 parts after solidworks runs out of resources.

Leave a Reply

Your email address will not be published. Required fields are marked *