# Redefine thumbnail on save

**URL:** <https://forums.sketchup.com/t/redefine-thumbnail-on-save/186031>\
**Category:** SketchUp SDK\
**Tags:** advice\
**Created:** [January 8, 2022, 6:32am UTC](https://forums.sketchup.com/t/redefine-thumbnail-on-save/186031 "2022-01-08T06:32:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kenchan](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/kenchan/32/124751_2.png) [@kenchan](https://forums.sketchup.com/u/kenchan)\
**Post date:** [January 8, 2022, 6:32am UTC](https://forums.sketchup.com/t/redefine-thumbnail-on-save/186031/1 "2022-01-08T06:32:04Z")

</div>

how can i set the redefine thumbnail on save flag with c api?

Thanks for any advice.

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [January 8, 2022, 9:00pm UTC](https://forums.sketchup.com/t/redefine-thumbnail-on-save/186031/2 "2022-01-08T21:00:07Z")

</div>

There is an open issue for both the C and Ruby APIs:

> <https://github.com/SketchUp/api-issue-tracker/issues/14>
>
> \# Feature Request
> 
> \## SketchUp APIs - Ruby and C
> 
> \### \*\*1. Use-case\*\*:
> 
> SK…P file thumbnail image control plugin needs to check and be sure "\*\*Redefine thumbnail on save\*\*" is \*\*\`true\`\*\* during model save (via a ModelObserver callback.)
> 
> This plugin has been "on the shelf" because of API issues (bugs and missing features) since the mid v7 days! (This is the only missing feature left preventing the plugin from release.)
> 
> \*\*NOTE: See the \[2nd post in this thread\](https://github.com/SketchUp/api-issue-tracker/issues/14#issuecomment-350183424), for comment on a possible native feature alternative.\*\*
> 
> \### \*\*2. Specific implementation and reasoning\*\*:
> 
> The GUI "RedefineThumbnailOnSave" checkbox control is located on the \*\*Model Info\*\* \> \*\*File\*\* panel.
> 
> \### \*\*Ruby\*\*
> 
> Although two other controls here on the \*\*Model Info\*\* \> \*\*File\*\* panel, (\*\*Name\*\* and \*\*Description\*\*,) are implemented as \*\*\`Sketchup::Model\`\*\* instance (getter and setter) methods, this particular "option" is best (and likely easiest) to be implemented as an \[\*\*\`OptionsProvider\`\*\*\](http://ruby.sketchup.com/Sketchup/OptionsProvider.html) of the \[\*\*\`OptionsManager\`\*\*\](http://ruby.sketchup.com/Sketchup/OptionsManager.html) interface.
> 
> Reasoning is that it's likely not often used enough to warrant the cost of implementing, documenting and maintaining as two separate getter and setter methods. A "property" of the hash-like options collection is more appropriate. 
> 
> ~~The \`"NamedOptions"\` provider is the most appropriate as this requested key does not \_exaclty\_ "fit" in any of the other providers. As a second choice, I'd suggest the \`"PageOptions"\` provider.~~
> 
> \* Add (2022-01-08): It would also be possible to add a new \*\*\`"FileOptions"\`\*\* provider \*\*rather than\*\* use the bugged \`"NamedOptions"\` provider (\_which is being removed from the APIs\_.)
> 
> Example of \*\*\_proposed\_\*\* access via Ruby:
> \`\`\`ruby
> \# Within a ModelObserver subclass object ...
> def onPreSaveModel(model)
> # switch off page transitions
> opts = model.options\["PageOptions"\]
> @pgtrans = opts\["ShowTransition"\]
> opts\["ShowTransition"\]= false if @pgtrans
> # activate thumbnail page (user has previously chosen)
> @page = model.pages.selected\_page
> thumbpage = model.pages.get\_attribute("Plugin\_Thumbnailer","Thumbnail")
> model.pages.selected\_page= model.pages\[thumbpage\]
> opts = model.options\["NamedOptions"\]
> @rtos = opts\["RedefineThumbnailOnSave"\]
> opts\["RedefineThumbnailOnSave"\]= true if !@rtos
> # callback returns and SketchUp saves the model ...
> end
> 
> def onPostSaveModel(model)
> # Restore previous page ...
> model.pages.selected\_page= @page
> opts = model.options\["PageOptions"\]
> if opts\["ShowTransition"\] != @pgtrans
> # Restore previous setting of show transitions
> opts\["ShowTransition"\]= @pgtrans
> end
> opts = model.options\["NamedOptions"\]
> if opts\["RedefineThumbnailOnSave"\] != @rtos
> # Restore previous setting of checkbox
> opts\["RedefineThumbnailOnSave"\]= @rtos
> end
> end
> \`\`\`
> 
> \### \*\*C API\*\* 
> The appropriate C functions already exist, they'd just need to be updated internally to so that a new provider (or whichever provider is extended) will respond \_correctly\_ to a \`"RedefineThumbnailOnSave"\` key:
> 
> \_See, C API online documentation\_: \[options\_provider.h\](https://extensions.sketchup.com/developers/sketchup\_c\_api/sketchup/struct\_s\_u\_options\_provider\_ref.html)
> 
> ~

---

<div class="post-metadata">

**Author:** ![kenchan](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/kenchan/32/124751_2.png) [@kenchan](https://forums.sketchup.com/u/kenchan)\
**Post date:** [January 8, 2022, 10:19pm UTC](https://forums.sketchup.com/t/redefine-thumbnail-on-save/186031/3 "2022-01-08T22:19:57Z")

</div>

Thank you Dan. I guess we have to wait until they fix it.
