123456789_123456789_123456789_123456789_123456789_

Class: Sketchup::DefinitionsObserver Abstract

Relationships
Inherits: Object

Overview

This class is abstract.

To implement this observer, create a Ruby class of this type, override the desired methods, and add an instance of the observer to the collection of interest.

This observer interface is implemented to react to events on a definitions collection.

Examples:

class MyDefinitionsObserver < Sketchup::DefinitionsObserver
  def onComponentAdded(definitions, definition)
    puts "onComponentAdded: #{definition.name}"
  end
end

Sketchup.active_model.definitions.add_observer(MyDefinitionsObserver.new)

Version:

  • SketchUp 6.0

Instance Method Summary

Instance Method Details

#onComponentAdded(definitions, definition) ⇒ nil

The #onComponentAdded method is called whenever a definition is added to the definitions collection.

Examples:

def onComponentAdded(definitions, definition)
  puts "onComponentAdded: #{definition}"
end

Parameters:

Version:

  • SketchUp 6.0

#onComponentPropertiesChanged(definitions, definition) ⇒ nil

The #onComponentPropertiesChanged method is called whenever a definition’s name or description are changed.

This does not fire when “Glue To”, “Cuts Opening”, or “Face Camera” settings are changed.

Examples:

def onComponentPropertiesChanged(definitions, definition)
  puts "onComponentPropertiesChanged: #{definition}"
end

Parameters:

Version:

  • SketchUp 6.0

#onComponentRemoved(definitions, definition) ⇒ nil

Note:

This methods fires twice for each Component/Group erased.

The #onComponentAdded method is called whenever a definition is removed from the definitions collection.

Examples:

def onComponentRemoved(definitions, definition)
  puts "onComponentRemoved: #{definition}"
end

Parameters:

Version:

  • SketchUp 6.0

#onComponentTypeChanged(definitions, definition) ⇒ nil

The #onComponentTypeChanged event is fired when a component is converted to a group or vice versa. (In the underlying implementation, Groups are just a special kind of definition that is allowed to only have a single instance.)

Examples:

def onComponentTypeChanged(definitions, definition)
  puts "onComponentTypeChanged: #{definition}"
end

Parameters:

Version:

  • SketchUp 6.0