2 Replies Latest reply on Mar 12, 2018 8:41 PM by Checkcheck Master

    Image from SolidWorks file?

    Checkcheck Master

      Hi there,

       

      I've build a kind off explorer for SW files as an add in with a ribbon above where I display the pictures of the SW documents, see picture.

      The question I've got is regarding how to get the pictures from the SW documents, is there a better method available as what I use now?

       

      For now I fill a DataGridView with the SW files from a certain folder and collect a BitMap for each file.

      It's a piece of code in C# called 'WindowsThumbnailProvider ' which I put in a DLL and is called in the VB net code with a given path name.

      It's works fine, the quality of the images is enough, however when the amount of files increases it will became slower, it takes more time to collect the images.

      What I am looking for is a method which reach the performance from the 'open document' window inside SW.

      For example, when 'Extra Large Icons' is selected in the 'open document' window, the images from the files appear quite fast and smoothly, you can scroll trough them easily etc., how do they do that?

       

      Anyone?

       

      Greetings!

        • Re: Image from SolidWorks file?
          Artem Taturevych

          Have you tried SldWorks::GetPreviewBitmap? or from Document Manager: SwDMConfiguration9::GetPreviewBitmapBytes.

            • Re: Image from SolidWorks file?
              Checkcheck Master

              Thanks for your reaction Artem,

               

              For SldWorks::GetPreviewBitmap the file has to be opened by SW I thought, am I right ?

              In that case it's not effective enough.

              SwDMConfiguration9::GetPreviewBitmapBytes says the the class is not licensed for use.

               

              I've checked my key, looks like it's a general key.

              I've read in a post that there are, or where, different keys with restricted functionality, is that still the case?

              Is it a know bug?

               

              Anyhow I find this:

              https://stackoverflow.com/questions/18268955/load-image-in-picturebox-quickly

              It's works similar as the code I've already had in C#, I checked the performance and it looks like it does the job, checking 45 SW files, a 200ms slower then my existing code. Approx 1600ms for the 'old' C# code and 1800ms for the VB net one.

               

              I keep wondering how SW in combination with Windows handle this.

              Where do they get the images from?

              Is SW using thumb.db to store the images?

              I've checked with a thumb.db viewer without result for SW folders.

               

              Anyone?