Class: Sketchup::Layers
- Includes:
- Enumerable
- Defined in:
- lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb
Overview
As of SketchUp 2020 “Layers” were renamed to “Tags” in the UI. The API retains the use of “Layer” for compatibility and is synonymous with “Tag”.
The Layers collection allows you to see and manage all of the layers in a model. You get a pointer to the Layers object from within the Model.
Instance Method Summary collapse
-
#[](index_or_name) ⇒ Sketchup::Layer?
The #[] method is used to retrieve a layer by index or name.
-
#add(layer_name) ⇒ Sketchup::Layer
(also: #add_layer)
The #add method is used to add a new layer.
-
#add_folder(arg) ⇒ Sketchup::LayerFolder
The #add_folder method adds or moves a layer folder.
-
#add_observer(observer) ⇒ Boolean
The #add_observer method is used to add an observer to the layers collection.
- #at(index_or_name) ⇒ Sketchup::Layer?
-
#count ⇒ Object
Integer - the number of layers in the collection.
-
#count_folders ⇒ Integer
The #count_folders method counts the number of folders which are direct children of the layer manager.
-
#count_layers ⇒ Integer
The #count_layers method retrieves the number of layers not in a folder.
-
#each {|layer| ... } ⇒ Object
The #each method is used to iterate through all of the layers in the model.
-
#each_folder {|folder| ... } ⇒ Object
The #each_folder method is used to iterate through the folders that are direct children to the layer manager.
-
#each_layer {|layer| ... } ⇒ Object
The #each_layer method is used to iterate through the layers that are not inside a layer folder.
-
#folders ⇒ Array<Sketchup::LayerFolder>
The #folders method returns the folders of the layer manager.
-
#layers ⇒ Array<Sketchup::Layer>
The #layers method retrieves the layers not in a folder.
-
#length ⇒ Integer
The #length method retrieves the number of layers.
-
#purge_unused ⇒ Integer
(also: #purge_unused_layers)
The #purge_unused method is used to remove unused layers.
-
#purge_unused_folders {|folder| ... } ⇒ Object
The #purge_unused_folders method is used to remove all layer folder with no children.
-
#remove(layer, remove_geometry = false) ⇒ Boolean
(also: #remove_layer)
Remove the given layer from the model, optionally removing the geometry.
-
#remove_folder(folder) ⇒ nil
The #remove_folder method removes the folder from the model.
-
#remove_observer(observer) ⇒ Boolean
The #remove_observer method is used to remove an observer from the current object.
- #size ⇒ Integer
-
#unique_name(*args) ⇒ Object
The #unique_name method can be used to get a string that will be a unique layer name inside this collection.
Methods inherited from Entity
#attribute_dictionaries, #attribute_dictionary, #delete_attribute, #deleted?, #entityID, #get_attribute, #inspect, #model, #parent, #persistent_id, #set_attribute, #to_s, #typename, #valid?
Instance Method Details
#[](index_or_name) ⇒ Sketchup::Layer?
The #[] method is used to retrieve a layer by index or name.
42 43 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb', line 42 def [](index_or_name) end |
#add(layer_name) ⇒ Sketchup::Layer Also known as: add_layer
The #add method is used to add a new layer.
If you give the name of a Layer that is already defined, it will return the existing Layer rather than adding a new one.
60 61 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb', line 60 def add(layer_name) end |
#add_folder(name) ⇒ Sketchup::LayerFolder #add_folder(folder) ⇒ Sketchup::LayerFolder
The #add_folder method adds or moves a layer folder.
91 92 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb', line 91 def add_folder(arg) end |
#add_observer(observer) ⇒ Boolean
The #add_observer method is used to add an observer to the layers collection.
106 107 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb', line 106 def add_observer(observer) end |
#at(index_or_name) ⇒ Sketchup::Layer?
123 124 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb', line 123 def at(index_or_name) end |
#count ⇒ Object
140 141 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb', line 140 def count end |
#count_folders ⇒ Integer
The #count_folders method counts the number of folders which are direct children of the layer manager.
156 157 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb', line 156 def count_folders end |
#count_layers ⇒ Integer
The #count_layers method retrieves the number of layers not in a folder.
174 175 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb', line 174 def count_layers end |
#each {|layer| ... } ⇒ Object
Don’t remove content from this collection while iterating over it with #each. This would change the size of the collection and cause elements to be skipped as the indices change. Instead copy the current collection to an array using to_a
and then use each
on the array, when removing content.
The #each method is used to iterate through all of the layers in the model. This include layers that are nested inside folders.
196 197 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb', line 196 def each end |
#each_folder {|folder| ... } ⇒ Object
The #each_folder method is used to iterate through the folders that are direct children to the layer manager.
217 218 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb', line 217 def each_folder end |
#each_layer {|layer| ... } ⇒ Object
The #each_layer method is used to iterate through the layers that are not inside a layer folder.
236 237 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb', line 236 def each_layer end |
#folders ⇒ Array<Sketchup::LayerFolder>
This does not return all the folders in the model, only those that are direct children of the layer manager.
The #folders method returns the folders of the layer manager.
255 256 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb', line 255 def folders end |
#layers ⇒ Array<Sketchup::Layer>
The #layers method retrieves the layers not in a folder.
269 270 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb', line 269 def layers end |
#length ⇒ Integer
The #length method retrieves the number of layers.
283 284 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb', line 283 def length end |
#purge_unused ⇒ Integer Also known as: purge_unused_layers
The #purge_unused method is used to remove unused layers.
297 298 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb', line 297 def purge_unused end |
#purge_unused_folders {|folder| ... } ⇒ Object
The #purge_unused_folders method is used to remove all layer folder with no children.
317 318 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb', line 317 def purge_unused_folders end |
#remove(layer, remove_geometry = false) ⇒ Boolean Also known as: remove_layer
Remove the given layer from the model, optionally removing the geometry.
349 350 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb', line 349 def remove(layer, remove_geometry = false) end |
#remove_folder(folder) ⇒ nil
The #remove_folder method removes the folder from the model. All children are preserved, but moved up one level.
370 371 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb', line 370 def remove_folder(folder) end |
#remove_observer(observer) ⇒ Boolean
The #remove_observer method is used to remove an observer from the current object.
385 386 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb', line 385 def remove_observer(observer) end |
#size ⇒ Integer
399 400 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb', line 399 def size end |
#unique_name ⇒ String #unique_name(base_name) ⇒ String
The #unique_name method can be used to get a string that will be a unique layer name inside this collection.
424 425 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb', line 424 def unique_name(*args) end |