123456789_123456789_123456789_123456789_123456789_

Class: Sketchup::OverlaysManager

Relationships
Super Chains via Extension / Inclusion / Inheritance
Instance Chain:
self, Enumerable
Inherits: Object

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

Instance Method Details

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

Examples:

overlay = Sketchup.active_model.overlays[0]

Version:

  • SketchUp 2023.0

#add(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)

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

#at(index)

Alias for #[].

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

Examples:

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

Yield Parameters:

Version:

  • SketchUp 2023.0

#length

Alias for #size.

#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)

Version:

  • SketchUp 2023.0

#sizeInteger Also known as: #length

Examples:

num_overlays = Sketchup.active_model.overlays.size

Version:

  • SketchUp 2023.0