Getting the part/assembly thumbnail

Getting the part/assembly thumbnail

Jef_E
Collaborator Collaborator
1,580 Views
2 Replies
Message 1 of 3

Getting the part/assembly thumbnail

Jef_E
Collaborator
Collaborator

Hi,

 

I'm making a program to clean my workspace ( inventor files ) but I would like to be able to see the thumbnail image of the file. How can I access it from outside Inventor?

 

I could use apprentice if required or can it be done without apprentice? For example how can I get the image shown by the windows explorer?



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
0 Likes
1,581 Views
2 Replies
Replies (2)
Message 2 of 3

YuhanZhang
Autodesk
Autodesk

You can use Apprentice to view the thumbnail of Inventor documents, and I attached an Excel with VBA sample to preview the Inventor documents' thumbnail in a folder, when you run the UserForm1 in the VBA(change the folder path if necessary), and you can see below form, and the preview of an Inventor document, click on the image area it will continue to display next:

Preview.png

 

Hope this helps.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes
Message 3 of 3

Owner2229
Advisor
Advisor

Here's a function you can use to read it:

 

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
Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes