©2009 Google -
Code Home -
Terms of Service -
Privacy Policy -
Site Directory
Google Code offered in:
English -
Español -
日本語 -
한국어 -
Português -
Pусский -
中文(简体) -
中文(繁體)
This observer interface is implemented to react to Entities collection 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 objects of interests.
# This is an example of an observer that watches the entities collection
# new added elements and shows a messagbox.
class MyEntitiesObserver < Sketchup::EntitiesObserver
def onElementAdded(entities, entity)
UI.messagebox("onElementAdded: " + entity.to_s)
end
end
# Attach the observer
Sketchup.active_model.entities.add_observer(MyEntitiesObserver.new)The onContentsModified method is invoked whenever one or more elements in the collection are modified.
Arguments:
Returns:
def onContentsModified(entities)
UI.messagebox("onContentsModified: " + entity.to_s)
endThe onElementRemoved method is invoked when a single element is added to the Entities collection.
Arguments:
Returns:
def onElementAdded(entities, entity)
UI.messagebox("onElementAdded: " + entity.to_s)
endThe onElementRemoved method is invoked when a single element is removed from the Entities collection.
Arguments:
Returns:
def onElementRemoved(entities, entity)
UI.messagebox("onElementRemoved: " + entity.to_s)
endThe onEraseEntities method is invoked when one or more entities are erased.
Arguments:
Returns:
def onEraseEntities(entities)
UI.messagebox("onEraseEntities: " + entities.to_s)
end