03-17-2022
08:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
03-17-2022
08:49 AM
iLogic, how to get a Thumbnail to an Excel document?
This should work, but I get errors:
https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/getting-the-part-assembly-thumbnail/...
Type 'stdole.IPictureDisp' is not defined.
'Compatibility' has not been declared. It may be inaccessible due to its protection level.
See screenshot.
Public Function iThumbnail(FilePath As String) As System.Drawing.Image
If Not System.IO.File.Exists(FilePath) Then Return Nothing
Dim oImg As System.Drawing.Image = Nothing
Try
Dim iApp As New Inventor.ApprenticeServerComponent
Dim oDoc As Inventor.ApprenticeServerDocument = iApp.Open(FilePath)
Dim SummaryInfo As Inventor.PropertySet = oDoc.PropertySets.Item("Inventor Summary Information")
Dim ThumbProp As Inventor.Property = SummaryInfo.Item("Thumbnail")
Dim Thumbnail As stdole.IPictureDisp = CType(ThumbProp.Value, stdole.IPictureDisp)
If Not Thumbnail Is Nothing Then
oImg = Compatibility.VB6.IPictureDispToImage(Thumbnail)
End If
oDoc.Close()
iApp.Close()
Catch Ex As Exception
MsgBox(ex.Message)
End Try
Return oImg
End Function