Where is the path and filename of thumbnail preview bitmaps stored in the database?
I don't know if this is what you are referring to but this link has everything you need to get the preview bitmap. I've been reliably using this method for a while now.
2019 SOLIDWORKS API Help - Write Parasolid Partition Stream to File Example (C#)
Thanks for the sample code, but I need to figure out how to retrieve the path and filename of the thumbnail associated a given part (or BOM if that's the Solidworks word for the operational unit).
Not sure where to find the library referenced in the sample code USING SOLIDWORKS...
It is my understanding that the preview bitmap is stored within the actual file and the link that I provided shows how to extract it. After you extract it, you can manipulate it as needed. What language are you programming in?
C#. The sample code assumes I know the location of the file. I want to return a thumbnail image along with related textual info. I'm able to retrieve the textual info from the database. I'm assuming somewhere in the database is either the image itself (so I want to know the table and column name) or the path and filename pointing to a file stored external to the database (again, what table and column names for path and filename). If the latter, I would pass the path and file name for a given part to the C# routine which retrieves the thumbnail image. If the former, I would retrieve the image of the part and figure out some code on how to display it.
Do you mean PDM database? I do not think preview is cached in DB, here is an example how you can extract preview from file: Extract PNG preview image from active configuration using SOLIDWORKS Document Manager API
The database name is prefixed by our company acronym followed by a suffix of VAULT, but I suppose it might be PDM by default. I am the database developer in my company but have barely been involved with the Solidworks database, so I suppose you can take what I'm saying with a grain of salt.
Anyhow, I've been charged with retrieving a variety of data fields associated with parts that make up a BOM. I have been able to figure out how to retrieve all the data fields except for the thumbnail image.
I appreciate people trying to help, but I don't understand why my question seems to be misunderstood. It is all well and good to know to call an API to retrieve some data (a thumbnail image in this instance) given a parameter being provided. The issue is the parameter is a variable. I am guessing the thumbnail image is associated with a part either by being stored directly in a column in a table in the database or the image is stored external to the database, but the filename and path is stored somewhere in the database. Either way, the file or image has to be retrieved based on which part one is interested in.
My principal question is where is that image information stored in the database (either directly stored as a graphic or indirectly by filename/path pointer to an external location).
My secondary question is what file do I need access to add as a reference in my C# program so the USING SOLIDWORKS... declaration works.
Thanks in advance.
Rob Feldleit wrote: My principal question is where is that image information stored in the database (either directly stored as a graphic or indirectly by filename/path pointer to an external location).
Rob Feldleit wrote:
It isn't stored in the database at all. There is no image file anywhere.
To access the thumbnail, you need to use either the Document Manager API, or the SOLIDWORKS API. Since it is pretty clearly that PDM is being used, you would also need the SOLIDWORKS PDM API. If you have no knowledge of SOLIDWORKS or what PDM is or how it works, you are going to have a difficult time. The thumbnail image is embedded in the SOLIDWORKS document. PDM adds a wrinkle since there are multiple versions of the document stored. Which thumbnail do you want? The thumbnail for the version of the file that user A has on their machine, or the thumbnail for the version of the file that user B has on their machine, or the latest version available in the system, etc....
You may think you are making a simple request, but it is much more complicated than you think.
You should find all the references you need here, I've highlighted the ones that "I" most commonly use.
SW stores the thumbnail of the file as it was the last time it was saved, this is part of the file and you will need a file path to get it. I know you mention that it’s a variable but IF you know before-hand that your application will be looking for information at a specific location you might be able to pre-fetch the thumbnails and merge it with the other data before presenting anything to the end user.
Maybe my confusion is when you say pre-fetch the thumbnail information from a specific location, I'm thinking you are referring to something that is unique to that part/document/whatever, which doesn't make sense to me since I don't know how to identify the specific location until I know which part/document/whatever is being asked for. It's as if you're telling me to find a fiction book on a library shelf which is not sorted alphabetically by author name.
Just to jump in on this conversation.
If you want to get the thumbnail from a PDM Professional vault by using the official method, you should use the PDM API.
IEdmFile15 has a GetThumbnail2 method.
However, if you are using PDM Standard, that doesn't have an API and you will have to access the file in the Vault folder (using the Document Manager API as mentioned above). The Vault store is broken down into subfolders which are the hexadecimal numbers for the DocumentId field in the Documents table in the database. The file will be called something like 000001.sldprt (it renames it when you ask for a local copy)
PDM also stores an image file of the SOLIDWORKS file in that same folder on the archive server that Simon mentioned. The file name will start with Thumb plus a long hex number and .img extension. I don't have PDM Standard, but would guess that it is like Professional.
I found using DM to be the best way to get a file's thumbnail.
Here is what I use. I keep this in a text file that I can reference whenever the need arrives. This is for using Visual Studio with the NuGet Package Manager.
The example is in VB.Net but it should be easy enough to convert to C#.
Retrieving data ...