Renew thumbnail of document

By Xiaodong Liang

When a document is saved, Inventor will follow [File Save Options] to save the thumbnail. in default, it is always ISO component  view.

image

API also provides the relevant method:

Document.SetThumbnailSaveOption(
  SaveOption As ThumbnailSaveOptionEnum,   [ImageFullFileName] As String )

  • kActiveComponentIsoViewOnSave
      The isometric view of the document is set as thumbnail on save.

  • kActiveWindow
      The currently active view is immediately set as thumbnail.

  • kActiveWindowOnSave
      The active view of the document is set as thumbnail on save.

  • kImportFromFile
      The specified image file is set as thumbnail.

  • kNoThumbnail
      No thumbnail is set.

So to renew the thumbnail, you could change the camera to the view you desired and call Document.Save. You can even use external image as thumbnail, using SaveOption = kImportFromFile.

Sub test()
    Dim oDoc As PartDocument
    Set oDoc = ThisApplication.activeDocument
    ‘ change the current view
    Dim view As view
    Set view = ThisApplication.ActiveView
    Dim camera As camera
    Set camera = view.camera
    camera.ViewOrientationType = kRightViewOrientation
    camera.Fit
    camera.Apply
    ‘ set save option
    oDoc.SetThumbnailSaveOption kActiveWindowOnSave
    ‘call saving
    oDoc.Save
End Sub


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading