Setting thumbnail image via ilogic

Setting thumbnail image via ilogic

ust25238
Contributor Contributor
1,047 Views
2 Replies
Message 1 of 3

Setting thumbnail image via ilogic

ust25238
Contributor
Contributor

I am trying to write some iLogic that process' a library directory and sets the thumbnail to a custom image. I have searched the web and have only found VBA (32 bit) answers. When I tried to use the converted  VBA code from https://modthemachine.typepad.com/my_weblog/2010/06/accessing-thumbnail-images.html.

Sub WriteThumbnail(ByVal FileName As String)
	' Get the Summary Information property set.
    ' Get the thumbnail property.  When using VBA, this will
    'dsPSet is = "Inventor Summary Information"
    Dim thumbProp As Inventor.Property
    thumbProp = dsPSet.Item("Thumbnail")

    ' Get the thumbnail image.
    Dim thumbnail As stdole.IPictureDisp
    thumbnail = thumbProp.Value

    ' Check that an image was returned.  It's possible for a
    ' file to not have a thumbnail.
	    If Not thumbnail Is Nothing Then
	        ' Write the thumbnail to disk.
	        SavePicture(thumbnail, FileName)
		End If
	End Sub

 

I get a 'SavePicture' is not declared. It may be inaccessible due to its protection level.". I have stdole referenced and Imported. Any help would be appreciated.

Thanks.

0 Likes
1,048 Views
2 Replies
Replies (2)
Message 2 of 3

a.majewski83MYF
Explorer
Explorer
0 Likes
Message 3 of 3

ust25238
Contributor
Contributor

I found this code that works well for me

 

If IO.File.Exists(ThumbNailPath) Then
PartDoc.SetThumbnailSaveOption(ThumbnailSaveOptionEnum.kImportFromFile, ThumbNailPath)
Else
Debug.Print(ThumbNailPath)
End If

0 Likes