# draw\_text - not displaying text?

**URL:** <https://forums.sketchup.com/t/draw-text-not-displaying-text/13810>\
**Category:** Ruby API\
**Created:** [August 3, 2015, 3:54pm UTC](https://forums.sketchup.com/t/draw-text-not-displaying-text/13810 "2015-08-03T15:54:29Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Aerilius](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@Aerilius](https://forums.sketchup.com/u/Aerilius)\
**Post date:** [August 3, 2015, 4:14pm UTC](https://forums.sketchup.com/t/draw-text-not-displaying-text/13810/2 "2015-08-03T16:14:43Z")

</div>

Notice that what you draw on the screen lives only until the screen is redrawn with the next frame (camera or anything else changed). That’s why only tools have control over drawing to the viewport (mentioned in the intro of [View](http://www.sketchup.com/intl/en/developer/docs/ourdoc/view)). A tool is like the line tool and the push pull tool: only one of them can be active.

A minimal tool to draw on the viewport:

```ruby
class MyTool
  def draw(view) # SketchUp calls the method when a redraw is required, and gives it the view to draw to.
    point16 = Geom::Point3d.new(0, 0, 0)
    status = view.draw_text(point16, "This is a test")
  rescue Exception => e # Tool methods are invoked dispatched from the Ruby Console / Ruby loading, so exceptions wouldn't go to the console but stay silent and unnoticed.
    puts e.message
    puts e.backtrace
  end
end

```

Learn more about tools here:

[API Documentation: Tool class](http://www.sketchup.com/intl/en/developer/docs/ourdoc/tool)  
[Official LineTool example](http://extensions.sketchup.com/de/content/example-ruby-scripts)  
[Forum example for a tool](http://forums.sketchup.com/t/apply-changes-when-click-on-the-element/13649/2)

The SketchUcation topic mentions that the text color is a model setting (currently). It does however not suggest to modify the model setting, because that would not only upset your plugin users, but also add infinite operations to the undo stack, and trigger a viewport refresh, causing an infinite loop.

---

_[View the full topic](https://forums.sketchup.com/t/draw-text-not-displaying-text/13810)._
