You can get the preview bitmap through GetPreviewBitmap, either in SW or using the Document Manager API. https://forum.solidworks.com/message/85484#85484
As far as getting a large .jpg like from SaveAs4, I can see how that would not be possible. SW doesn't actually generate the graphics for a document unless that document is visible. If you really want a large SaveAs4, I believe you will have to activate the document.
Thanks. I've tried GetPreviewBitmapFile but I get large size tri-colour images of actual red green and blue (and white). My concern with this method (if I coudl get it working) would be that sometimes SolidWorks doesnt' generate a bitmap preview at all, and I haven't found a way to force it to yet.
Public Sub pv(ByVal filePath As String )
Dim pic as System.Drawing.Bitmap
Dim pvf As wpfPreviewFlowControl.wpfThumbnailCreator
pvf = New wpfPreviewFlowControl.wpfThumbnailCreator()
Dim size As System.Drawing.Size
size.Width = 200 ' SIZE OF PREVIEW
size.Height = 200 ' SIZE OF PREVIEW
pvf.DesiredSize = Size
pic = pvf.GetThumbNail(filePath)
add reference C:\Program Files (x86)\SolidWorks\SolidWorks Explorer 2008\wpfPreviewFlowControl.dll
need SolidWorks Explorer 2008
if this is the wrong Lang. or need help add reference let me now
What program are you using (SW Macro,Visual Studio,Other)
I have the same problem as the topic starter.
I tried to use the GetPreviewBitmapFile method, but BMP-files aren't good at all after this.
Could you tell me how to add a reference to this DLL-file (wpfPreviewFlowControl.dll)? I have a nasty massage “Can't add a reference to the specified file” after trying. The file is located in the directory: "C:\Program Files (x86)\SolidWorks Corp\SolidWorks Explorer\SolidWorks Explorer 2012\"
I’m using Win 7x64, VBA (6.5), SW2012.
Run CMD Command
cd "Program Files (x86)\SolidWorks Corp\SolidWorks Explorer\SolidWorks Explorer 2012\"
your path should be
C:\Program Files (x86)\SolidWorks Corp\SolidWorks Explorer\SolidWorks Explorer 2012>
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe wpfPreviewFlowControl.dll /tlb: wpfPreviewFlowControl.tlb
.net lower then 4
c:\Windows\Microsoft.NET\Framework64\v2.0.50727\RegAsm.exe wpfPreviewFlowControl.dll /tlb: wpfPreviewFlowControl.tlb
now add wpfPreviewFlowControl.tlb as a refrence
Thanks a lot!
I finally did it. Now I am able to add a reference to “wpfPreviewFlowControl.tlb.”
But unfortunately I can’t make the VBA understand the 'System' namespace classes so the structure ‘System.Drawing.Bitmap’, which you had used in your example doesn’t work for me.
try using just the Bitmap from solidworks
if that does not work try adding the system.drawing.tlb this file is found
then just seach for the file