×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Display bitmap preview
2

Display bitmap preview

Display bitmap preview

(OP)
Is it possible to extract and display the bitmap preview of a part or assembly from a VB6 exe program? There is some information in the SW API help but it's a bit confusing (or I don't like what it says).

RE: Display bitmap preview

Looks to me like it can't be done from an external VB executable.  It appears that it can be done with C++, though.  Perhaps someone could write an ActiveX wrapper per this info from the API help on SldWorks::PreviewDoc:

Quote:


C++ programmers can also access this bitmap image from outside SolidWorks. The bitmap was written with CArchive::Write( ) and is found in the Preview node in SolidWorks part, assembly and drawing files. The format of the Preview node is as follows: DWORD (data size) followed by continues chunk of memory of that size (data). The data being read can be cast to LPBITMAPINFO, which has all of the information required to display the bitmap.

I don't know enough about this to know if it's even possible, though.

RE: Display bitmap preview

(OP)
Is it possible to call and execute a Solid Works macro (.swp file) from an external VB executable program?

RE: Display bitmap preview

Yes, but it is a different subject from your original one.  You should have started a new post.

You can always assign keyboard shortcut keys, and send command from vb using "Sendkey" statement to execute macros.

Alex

RE: Display bitmap preview

Sure.  Just use SldWorks::RunMacro.  However, if I understand right the bitmap still won't be able to be seen by your executable program.  However, I don't think you would be able to pass any arguments to the SolidWorks macro from your VB program or return any values from the macro to your program.  In order to get the picture into your VB executable, I believe you would have to:

1. Using your VB program, write the file path from which you want to extract the bitmap to a temporary text file.
2. Call the SW macro, which reads the same text file to get the file path
3. Use the SW macro to get the bitmap (as shown in the examples) and save it to a temporary bitmap file with a SavePicture statement
4. Open the picture with your VB program from the temporary bitmap file.

This might work... smile

RE: Display bitmap preview

VB can extract bitmap previews from Solidworks models.  You do not need to run SolidWorks/Macro.

Alex

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources