My favorites | English | Sign in

Faster apps faster - GWT 2.0 with Speed Tracer New!

Google SketchUp Ruby API

EntityObserver

interface

Parent: Object

Introduction

SketchUp 6.0+

This observer interface is implemented to react to entity events. To implement this observer, create a Ruby class of this type, override the desired methods, and add an instance of the observer to the entity of interests.

     # This is an example of an observer that watches an entity for deletion
     # and shows a messagebox.
     class MyEntityObserver < Sketchup::EntityObserver
       def onEraseEntity(entity)
         UI.messagebox("onEraseEntity: " + entity.to_s)
       end
     end

     # Attach the observer. (Assumes there is an entity in the model.)
     Sketchup.active_model.entities[0].add_observer(MyEntityObserver.new)

Methods

EntityObserver.onChangeEntitySketchUp 6.0+

The onEraseEntity method is invoked when your entity is modified.

Arguments:

entity
An Entity object.

Returns:

nil
 def onChangeEntity(entity)
   UI.messagebox("onChangeEntity: " + entity.to_s)

EntityObserver.onEraseEntitySketchUp 6.0+

The onEraseEntity method is invoked when your entity is erased.

Arguments:

entity
An Entity object.

Returns:

nil
 def onEraseEntity(entity)
   UI.messagebox("onEraseEntity: " + entity.to_s)