Message 1 of 2
Export Document Thumbnail in Inventor 2025 (without use of Microsoft.VisualBasic.Compatibility)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'd like to know how can I export to BMP document's Thumbnail in Inventor 2025.
In Inventor 2024 and previous I used to use the code like:
AddReference "System.Drawing.dll"
AddReference "Microsoft.VisualBasic.Compatibility"
Dim doc = ThisDoc.Document ' ThisApplication.ActiveDocument
Dim thumbProp As Inventor.Property = doc.PropertySets("Inventor Summary Information")("Thumbnail")
''' Get the thumbnail image.
Dim thumbnail As IPictureDisp = thumbProp.Value
''' Convert the IPictureDisp object to an Image.
Dim img As System.Drawing.Image = Compatibility.VB6.IPictureDispToImage(thumbnail)
Dim imgMemoryStream As System.IO.MemoryStream = New System.IO.MemoryStream()
Dim imgOut As System.Drawing.Image
Dim thumbSize = 180
Try
imgOut = CType(img.GetThumbnailImage(thumbSize, thumbSize, Nothing, New IntPtr), System.Drawing.Bitmap)
Catch
MsgBox("Active document contains no Thumbnail!",,"ERROR")
EXIT SUB
End Try
imgOut.Save(imgMemoryStream, System.Drawing.Imaging.ImageFormat.Bmp)
Dim fileDlg As inventor.FileDialog = Nothing
InventorVb.Application.CreateFileDialog(fileDlg)
fileDlg.Filter = "Windows Bitmap Files (*.bmp)|*.bmp"
fileDlg.InitialDirectory = ThisDoc.WorkspacePath
fileDlg.FileName = ThisDoc.PathAndFileName(False)
fileDlg.ShowSave()
''' Catch an empty string in the input
If Err.Number <> 0 Then
Logger.Error("No File Saved (User has canceled the dialog)")
Else If fileDlg.FileName <> "" Then
imgOut.Save(fileDlg.FileName)
End If
But Inventor 2025 framework was upgraded to .Net, support of VB6 was stopped and thus Microsoft.VisualBasic.Compatibility can't be referenced anymore 😞
Please vote for Inventor-Idea Text Search within Option Names