# Change the model view to Wireframe with Ruby API

**URL:** <https://forums.sketchup.com/t/change-the-model-view-to-wireframe-with-ruby-api/114390>\
**Category:** Ruby API\
**Tags:** renderingoptions, rendermode\
**Created:** [January 25, 2020, 12:49am UTC](https://forums.sketchup.com/t/change-the-model-view-to-wireframe-with-ruby-api/114390 "2020-01-25T00:49:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beppe64](https://avatars.discourse-cdn.com/v4/letter/b/e99b99/32.png) [@Beppe64](https://forums.sketchup.com/u/Beppe64)\
**Post date:** [January 25, 2020, 12:49am UTC](https://forums.sketchup.com/t/change-the-model-view-to-wireframe-with-ruby-api/114390/1 "2020-01-25T00:49:40Z")

</div>

Hello everyone, before inserting into the model of SkUp, a component created with the Ruby… I would like to change the view in wireframe with code Ruby API, is possible ?  
Thank you  
Joseph.

---

<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 25, 2020, 2:04am UTC](https://forums.sketchup.com/t/change-the-model-view-to-wireframe-with-ruby-api/114390/2 "2020-01-25T02:04:25Z")

</div>

Yes … use the [`RenderingOptions`](http://ruby.sketchup.com/Sketchup/RenderingOptions.html) object.

I think the key you need to access is **`"RenderMode"`** and the value is **`0`** for Wireframe mode.

```ruby
opts = Sketchup.active_model.rendering_options
@old_mode = opts["RenderMode"]
opts["RenderMode"]= 0

```

Example methods (for a plugin module) …

```ruby
def save_render_mode
  @old_mode = Sketchup.active_model.rendering_options["RenderMode"]
end

def restore_render_mode
  Sketchup.active_model.rendering_options["RenderMode"]= @old_mode if @old_mode
end

def set_render_mode_wireframe
  save_render_mode()
  Sketchup.active_model.rendering_options["RenderMode"]= 0
end

```

---

<div class="post-metadata">

**Author:** ![Beppe64](https://avatars.discourse-cdn.com/v4/letter/b/e99b99/32.png) [@Beppe64](https://forums.sketchup.com/u/Beppe64)\
**Post date:** [January 25, 2020, 8:34am UTC](https://forums.sketchup.com/t/change-the-model-view-to-wireframe-with-ruby-api/114390/3 "2020-01-25T08:34:24Z")

</div>

Hello, thank you for your help, now I’m going to study the code…  
I tried to write the word “Wireframe” in the search field  
Ruby API’s online documentation, I didn’t get any results,  
so I asked for help in the forum…  
Thank you again

Joseph.

![Wireframe](https://global.discourse-cdn.com/sketchup/original/3X/5/1/51e45fa3eb403f6601bf057b5e6bcb8a50a681f5.png)

![Wireframe_1](https://global.discourse-cdn.com/sketchup/original/3X/2/c/2c37903ba9ffddc0bec240d9693970d9de74391f.png)

![Wireframe_2](https://global.discourse-cdn.com/sketchup/original/3X/c/7/c7e2a89dacc3b52b4d5209ebf5db4f39ed289fb1.png)

---

<div class="post-metadata">

**Author:** ![eneroth3](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/eneroth3/32/1222_2.png) [@eneroth3](https://forums.sketchup.com/u/eneroth3)\
**Post date:** [January 25, 2020, 9:56am UTC](https://forums.sketchup.com/t/change-the-model-view-to-wireframe-with-ruby-api/114390/4 "2020-01-25T09:56:07Z")

</div>

The API search only searches for classes or methods or files. It’s more of a quick navigation than a typical search. You can google “SketchUp API” + phrase to find that phrase in the API documentation.

---

<div class="post-metadata">

**Author:** ![Beppe64](https://avatars.discourse-cdn.com/v4/letter/b/e99b99/32.png) [@Beppe64](https://forums.sketchup.com/u/Beppe64)\
**Post date:** [January 25, 2020, 10:27am UTC](https://forums.sketchup.com/t/change-the-model-view-to-wireframe-with-ruby-api/114390/5 "2020-01-25T10:27:02Z")

</div>

OK…  
😜 😜  
👍 👍

---

<div class="post-metadata">

**Author:** ![Beppe64](https://avatars.discourse-cdn.com/v4/letter/b/e99b99/32.png) [@Beppe64](https://forums.sketchup.com/u/Beppe64)\
**Post date:** [January 25, 2020, 11:04am UTC](https://forums.sketchup.com/t/change-the-model-view-to-wireframe-with-ruby-api/114390/6 "2020-01-25T11:04:03Z")

</div>

Mr. DanRathbun, please, one more thing…  
but where can I find the access keys to change “RenderMode”…  
Wireframe value type = 0

Thank you

Joseph.

---

<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 25, 2020, 4:33pm UTC](https://forums.sketchup.com/t/change-the-model-view-to-wireframe-with-ruby-api/114390/7 "2020-01-25T16:33:33Z")

</div>

> [@Beppe64](#):
>
> … but where can I find the access keys to change “RenderMode”…

`"RenderMode"` **is a key** of the [`RenderingOptions`](http://ruby.sketchup.com/Sketchup/RenderingOptions.html) (hash-like) object.  
(All the **keys** are listed in the **Overview** section of the [`RenderingOptions`](http://ruby.sketchup.com/Sketchup/RenderingOptions.html) class documentation.)

I think you may mean … _‘What are the valid values for the `"RenderMode"` key"?’_

The values for enumerations (keys that have ordinal values) are not documented in the API documentation (yet.) These ordinal values are sometimes called “_magic numbers_”.

A documentation issue was opened over a year ago … ie:

> <https://github.com/SketchUp/api-issue-tracker/issues/132>
>
> This is probably suited for a separate page with more detailed explanations and …screenshots. Then referencing it into the docs for relevant classes/methods.
> 
> https://forums.sketchup.com/t/rendermode-bug/78888
> 
> Maybe add constants for the magic numbers.

* * *

Do **not** set `"RenderMode"` to 4 !! ([Crashes versions of SketchUp 2017…2019.1](https://github.com/SketchUp/api-issue-tracker/issues/133), **fixed in v2019.2**.)

`"RenderMode"` values  
`0` = Wireframe  
`1` = Hidden Line  
`2` = Shaded  
`3` = Shaded ?  
`4` = **Do not use!** obsolete ([Crashes SketchUp versions 2017.0…2019.1](https://github.com/SketchUp/api-issue-tracker/issues/133))  
`5` = Monochrome  
`6` **+**  **Do not use!** ([Crashes SketchUp versions 2017.0…2019.1](https://github.com/SketchUp/api-issue-tracker/issues/133))

`"Texture"` values  
`true` = Show textures in shaded render modes  
`false` = No textures in shaded render modes

`"DrawBackEdges"` values  
`true` = Show (hidden) Back Edges in most render modes  
`false` = Do not show (hidden) Back Edges in any render mode  
_(Hidden Back Edges have no effect for Xray or Wireframe render modes.)_

`"ModelTransparency"` (Xray) values  
`true` = Xray transparent faces in most render modes (except Wireframe mode.)  
`false` = Normal opaque faces in render modes (except Wireframe mode.)

---

<div class="post-metadata">

**Author:** ![Beppe64](https://avatars.discourse-cdn.com/v4/letter/b/e99b99/32.png) [@Beppe64](https://forums.sketchup.com/u/Beppe64)\
**Post date:** [January 25, 2020, 5:43pm UTC](https://forums.sketchup.com/t/change-the-model-view-to-wireframe-with-ruby-api/114390/8 "2020-01-25T17:43:02Z")

</div>

Thank you again

Joseph.

👍 👍
