Class: Sketchup::OverlaysManager

Inherits:
Object
  • Object
show all
Includes:
Enumerable

Overview

An overlay added to a model is invalidated once it's removed from the model. It cannot be re-added or added to another model. Create another unique instance for that.

Contains the registered overlays for a model along with methods to manage them.

A model can not have multiple overlays with the same id.

Examples:

Sketchup.active_model.overlays.each { |overlay|
  puts "#{overlay.name} (#{overlay.overlay_id}) Enabled: #{overlay.enabled?}"
}

See Also:

Version:

  • SketchUp 2023.0

Instance Method Summary # collapse

Instance Method Details

↑ #[](index) ⇒ Sketchup::Overlay Also known as: at

Examples:

overlay = Sketchup.active_model.overlays[0]

Returns:

Version:

  • SketchUp 2023.0

↑ #add(service) ⇒ Boolean

Returns false if an overlay with the same id already exists.

Examples:

class ExampleOverlay < Sketchup::Overlay
  def initialize
    super('example_inc.my_overlay', 'Example Overlay')
  end
end

overlay = ExampleOverlay.new
Sketchup.active_model.overlays.add(overlay)

Returns:

  • (Boolean) —

    false if an overlay with the same id already exists.

Raises:

  • (ArgumentError) —

    If the overlay is already added to a model.

Version:

  • SketchUp 2023.0

↑ #each {|overlay| ... } ⇒ nil

Examples:

Sketchup.active_model.overlays.each { |overlay|
  puts "#{overlay.name} (#{overlay.overlay_id}) Enabled: #{overlay.enabled?}"
}

Yield Parameters:

Returns:

  • (nil)

Version:

  • SketchUp 2023.0

↑ #remove(service) ⇒ Boolean

Examples:

class ExampleOverlay < Sketchup::Overlay
  def initialize
    super('example_inc.my_overlay', 'Example Overlay')
  end
end

overlay = ExampleOverlay.new
Sketchup.active_model.overlays.add(overlay)

Sketchup.active_model.overlays.remove(overlay)

Returns:

  • (Boolean)

Version:

  • SketchUp 2023.0

↑ #size ⇒ Integer Also known as: length

Examples:

num_overlays = Sketchup.active_model.overlays.size

Returns:

  • (Integer)

Version:

  • SketchUp 2023.0