Class: Sketchup::OverlaysManager

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb

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]

Version:

  • SketchUp 2023.0



41
42
# File 'lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb', line 41

def [](index)
end

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

Raises:

  • (ArgumentError)

    If the overlay is already added to a model.

Version:

  • SketchUp 2023.0



63
64
# File 'lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb', line 63

def add(service)
end

#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



79
80
# File 'lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb', line 79

def each
end

#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



100
101
# File 'lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb', line 100

def remove(service)
end

#sizeInteger Also known as: length

Examples:

num_overlays = Sketchup.active_model.overlays.size

Version:

  • SketchUp 2023.0



112
113
# File 'lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb', line 112

def size
end