Hello,
I have a code to shows a thumbnail of inventor drawings and it works in inventor 2012 but gives an error in inventor 2014 (trail)
It shows a thumbnail of inventor drawings and I used the examples on this website:
http://modthemachine.typepad.com/my_weblog/2010/06/accessing-thumbnail-images.html
The filelocation of the document is correct (i checked the error message with catch)
Try
Dim doc As Document = oApp.Documents.Open(FileDir & "\" & DisplayItem & ".idw", False)
Dim thumbnail As stdole.IPictureDisp = doc.Thumbnail
Dim img As Image = Compatibility.VB6.IPictureDispToImage(thumbnail)
Me.PictureBox1.Image = img
Catch
MsgBox(FileDir & "\" & DisplayItem & ".idw")
End Try
Is there a change in the way stdole.IPictureDisp or Compatibility.VB6.IPictureDispToImage(thumbnail) works?
Perhaps a change in how inventor handles thumbnails?
Thx in advance,
Arnold
Hi,
Since Compatibility.VB6 is obsolete, I'd recommend the AxHost. I tested with Inventor 2014, it works well.
Imports System.IO Imports System.Windows.Forms Imports System.Drawing Public Class Form1 Public invApp As Inventor.Application Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim doc As Inventor.Document = invApp.Documents.Open("c:\xx.idw", False) Dim oObj As Object = doc.Thumbnail PictureBox1.Image = AxHostConverter.PictureDispToImage(doc.Thumbnail) End Sub End Class ''from http://blogs.msdn.com/b/andreww/archive/2007/07/30/converting-between-ipicturedisp-and-system-drawin... Friend Class AxHostConverter Inherits AxHost Private Sub New() MyBase.New("") End Sub Public Shared Function ImageToPictureDisp(image As Image) As stdole.IPictureDisp Return DirectCast(GetIPictureDispFromPicture(image), stdole.IPictureDisp) End Function Public Shared Function PictureDispToImage(pictureDisp As stdole.IPictureDisp) As Image Return GetPictureFromIPicture(pictureDisp) End Function End Class
I'm using the exact code "Axhost" but am getting an error "Generic error occurred in GDI+" when diplaying multiple thumbnails.
The list of events are as follows:
I have a single form, with a list view of all drawings. I load the thumbnail of each when it's selected. It works for the first one but usually throws the error i mentioned above for any after that?
Anyone else getting this problem?