How to deal with thumbnails

hi guys, when you work with thumbnails, how do you go about it? Do you use Solidworks-internal methods such as GetPreviewBitmap or do you have other tools/methods?

2 Answers

2

I have used ISldWorks::GetPreviewBitmap in the past but you can also use ISwDMDocument10::GetPreviewBitmap. Both return a pointer to IPictureDisp object which you will have to convert to System.Drawing.Image before you can save or use the image. I think none of the methods work in stand alone application. They only work in either macro or add-in. Here is the example for your reference: Get Preview Bitmap of Drawing Sheet Example (C#) - 2025 - SOLIDWORKS API Help

I tried with ISldWorks::GetPreviewBitmap but its crashed due to a fatal COM error - even though it's an add-in... For usage of SwDmDocument you need a separate license key, right?

Yes, you will need Document Manager API key for SwDmDocument to work but you will probably still get the error. You can try using IModelDoc2::SaveBMP method as @liuning has mentioned.

  1. I use SaveBMP()
    SaveBMP Method (IModelDoc2) - 2019 - SOLIDWORKS API Help
  2. Get images of files in a folder