.swp macro

Save Preview Image: capture SOLIDWORKS thumbnails

Captures a bitmap of the open document. Works on parts, assemblies and drawings — on a drawing it captures the active sheet.

Export

PRT PartsASM AssembliesDRW Drawings

Download Save Preview Image.swp Get SwMacroFlow

Put the downloaded file in this folder, then open SwMacroFlow and choose it from the library.

%LOCALAPPDATA%\SwMacroFlow\macros

Runs per file — point the scope at a folder and it writes one image per document.

Built for ERP and catalogue thumbnails, where a folder of images named after the part number is all the downstream system needs.

Inputs

FieldPurpose
OutputFolderWhere the image goes. Blank saves it beside the document. Created if missing.
OutputNameFile name without an extension. Blank uses the document's own name. {Property} placeholders work, so {PartNumber} names each image after the part number.
WidthImage width in pixels. Defaults to 1920.
HeightImage height in pixels. Defaults to 1080.
ZoomToFitOn by default. Zooms to fit and redraws before capturing, so the model fills the frame.
OverwriteOn by default. Clear it to skip documents whose image already exists.

Results

Reports the path and the pixel size it wrote.

SaveBMP returns only true or false — it reports no error code at all, so there is nothing to decode on failure. Rather than printing "SaveBMP returned False", the macro names the causes worth checking: a read-only or locked target file, or a folder that could not be created.

Notes

Leave ZoomToFit on for a batch. The capture is of the graphics area as it stands, so a model left zoomed in by an earlier macro in the chain would be captured that way.

Width and Height are pixels, not a scale. Blank falls back to 1920×1080 rather than to zero: SaveBMP is not documented to treat zero as "use the current window", so the macro supplies a real size instead of guessing at one.

The output is a .bmp. That is what the SOLIDWORKS API writes; converting to PNG or JPEG is a job for whatever consumes the folder.

Chaining

Safe anywhere in a chain, with one caveat: it changes the view when ZoomToFit is on. That affects nothing on disk, but a later macro that captures or prints the view will see the zoomed-to-fit state. It does not save, rebuild or close the document.