Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Gettting preview bitmap

Status
Not open for further replies.

ronin2307

Industrial
Mar 28, 2005
29
Is there any way to get a preview bitmap from an outside executable rather than a macro or an addin?
 
Replies continue below

Recommended for you

Can you be more specific? Sorry, I'm not understanding.

Chris
Sr. Mechanical Designer, CAD
SolidWorks 05 SP3.1 / PDMWorks 05
ctopher's home site (updated 06-21-05)
FAQ559-1100
FAQ559-716
 
solidworks provides this method
SldWorks::GetPreviewBitmap

however there is a note that it will only works if used in a macro or an add-in and not if I am using an external application.

However I need to get a preview from an outside program
 
You could always do a screen dump (hit the PrntScrn button) and edit it in a grpahics program.

SW can also 'saveas' as a jpeg
 
I don;t know if you are joking or not, but what I would like to do is have an application display the preview of the file when you highlight it in a file list.
 
SW uses MS and MS use Shade files that are built into the File itself to get the preview in SW open menu. I assume that is what you are trying for. If you know anything about that then you might be able to use that to get your preview.

Your Initial post left all of us guessing what you meant. The more information you can provide in your initial post will make the thread much more efficient as most of us don't do API.

Regards,

Scott Baugh, CSWP [pc2]
faq731-376
 
umm, no I'm not joking.

" I would like to do is have an application display the preview of the file when you highlight it in a file list"

what application, and what list?
 
what I need is somebody with API knowledge. Therefore I have not explained this issue in great detail.
I have a previously written app in VB which does many things, one of which is it's ability to display a preview of an AutoCAD drawing that a user has selected in the custom filediaog box( on the custom app). I am trying to extend this to solidworks drawings.
users who use this application use it for the most part to search for drawings. A lot of times thought the desription of the drawing provided through my custon app does not give the enduser enough information to pich the right drawing. Therefore a preview would be of immense help.
Simply highlight the filename of the desired drawing in the custom app and see the preview of it.
 
we use a custom made vb app, which shows a preview, which is a simple bmp of the file, created using the 'saveas jpeg' option.

we highlight the 'file' and we see the preview
 
can you show me some code plz. I have found only one example but it uses an unsupported method
 
The easy way to do this is to load SolidWorks in the background and use the GetPreviewBitmap method. The harder way to do this is to read the bitmap from the SW file itself. The SolidWorks files use the OLE structured storage, and the preview bitmap is in the stream called "Preview" if I remember correctly. The format is a DWORD that is the preview bitmap size and then that many more bytes of bitmap data. You should then be able to take that data and display it like a normal bitmap. I don't have any code to do this in VB, but there is an example in C++ on the SolidWorks website. Go to the API Downloads page and look for the "Retrieve SolidWorks preview bitmap and display lists" download. It has a whole lot of code that you don't need, but the main files are in the sldworks directory and are previewdib.h, previewdib.cpp, and restoredib.cpp.

Jonathan Anderson
 
1) Can you open the existing file dialog in "view thumbnails" mode? Do a google search and you will see discussions on forcing file dialogs to open in this way in VB.

2) If you need to have a listbox with a seperate bitmap preview (instead of the view thumbnails approach) do as Jonathan Anderson suggested and open SolidWorks silently so that you can use the existing tool. This is definitely the easiest solution.

3) If you haven't already done so, download the E-Drawings SDK and investigate using E-Drawings functionality in your form. The eDrawings API is implemented as an ActiveX Control, so maybe you can embed an E-Drawing interface into your form? I haven't tried this, but it has potential so you may want to investigate.

By the way, I thought the wording in the original question was fine.
 
thanks for all the replies. especially stoker. I have managed to make use of that unsupported method found in sdm.dll (extractBitMap2File). But e-drawings might be the way to go in the future. who knows

If anybody should need to look at it please let me know
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor