Class: Sketchup::Selection
- Inherits:
-
Object
- Object
- Sketchup::Selection
- Includes:
- Enumerable
- Defined in:
- lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb
Overview
A set of the currently selected entities. Use the Model.selection method to get a Selection object. Note that the order of entities (selection[0]
, selection[1]
and so on) in the set is in no particular order and should not be assumed to be in the same order as the user selected the entities.
Instance Method Summary collapse
- #[](index) ⇒ Sketchup::Entity?
-
#add(*args) ⇒ Integer
The add method is used to add entities to the selection.
-
#add_observer(observer) ⇒ Boolean
The add_observer method is used to add an observer to the selection object.
- #at(index) ⇒ Sketchup::Entity?
-
#clear ⇒ nil
The clear method is used to clear the selection.
-
#contains?(entity) ⇒ Boolean
The #contains? method is and alias of #include?.
- #count ⇒ Integer
-
#each {|entity| ... } ⇒ nil
The #each method is used to iterate through all of the selected entities.
-
#empty? ⇒ Boolean
The empty? method is used to determine if there are entities in the selection.
-
#first ⇒ Sketchup::Entity
The first method is used to retrieve the first selected entity.
- #include?(entity) ⇒ Boolean
-
#invert ⇒ nil
The #invert method is used to invert the selection.
-
#is_curve? ⇒ Boolean
The is_curve? method is used to determine if the selection contains all edges that belong to a single curve.
-
#is_surface? ⇒ Boolean
The is_surface? method is used to determine if the selection contains only all of the faces that are part of a single curved surface.
-
#length ⇒ Integer
The #length method is used to retrieve the number of selected entities.
-
#model ⇒ Sketchup::Model
The model method retrieves the model for the selection.
- #nitems ⇒ Integer
-
#remove(*args) ⇒ Integer
The remove method is used to remove entities from the selection.
-
#remove_observer(observer) ⇒ Boolean
The remove_observer method is used to remove an observer from the selection object.
-
#shift ⇒ Sketchup::Entity
The shift method is used to remove the first entity from the selection and returns it.
-
#single_object? ⇒ Boolean
The single_object? method is used to determine if the selection contains a single object.
- #size ⇒ Integer
-
#toggle(*args) ⇒ Integer
The toggle method is used to change whether an entity is part of the selection.
Instance Method Details
#[](index) ⇒ Sketchup::Entity?
46 47 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 46 def [](index) end |
#add(entities) ⇒ Integer #add(*entities) ⇒ Integer
The add method is used to add entities to the selection. Entities that are added to the Selection are visually indicated by the selection bounding box.
You can pass it individual Entities or an Array of Entities: Note that the add, remove, and toggle methods are all aliases for one another. So if you call remove on an entity that is not selected, it will be toggled to be selected, not removed! Be cautious when writing your code to not make the assumption about the currently selected state of a given entity.
81 82 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 81 def add(*args) end |
#add_observer(observer) ⇒ Boolean
The add_observer method is used to add an observer to the selection object.
96 97 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 96 def add_observer(observer) end |
#at(index) ⇒ Sketchup::Entity?
116 117 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 116 def at(index) end |
#clear ⇒ nil
The clear method is used to clear the selection.
130 131 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 130 def clear end |
#contains?(entity) ⇒ Boolean
The #contains? method is and alias of #include?.
149 150 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 149 def contains?(entity) end |
#count ⇒ Integer
166 167 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 166 def count end |
#each {|entity| ... } ⇒ nil
Don’t remove content from this collection while iterating over it with #each. This would change the size of the collection and cause elemnts 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 selected entities.
If you want to do something with all of the selected Entities, this is more efficient than using #[].
187 188 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 187 def each end |
#empty? ⇒ Boolean
The empty? method is used to determine if there are entities in the selection.
200 201 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 200 def empty? end |
#first ⇒ Sketchup::Entity
The first method is used to retrieve the first selected entity
Returns nil if nothing is selected. This method is useful when you know that only a single entity is selected, or you are only interested in the first selected entity.
216 217 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 216 def first end |
#include?(entity) ⇒ Boolean
236 237 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 236 def include?(entity) end |
#invert ⇒ nil
The #invert method is used to invert the selection.
257 258 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 257 def invert end |
#is_curve? ⇒ Boolean
The is_curve? method is used to determine if the selection contains all edges that belong to a single curve.
270 271 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 270 def is_curve? end |
#is_surface? ⇒ Boolean
The is_surface? method is used to determine if the selection contains only all of the faces that are part of a single curved surface.
283 284 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 283 def is_surface? end |
#length ⇒ Integer
The #length method is used to retrieve the number of selected entities.
299 300 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 299 def length end |
#model ⇒ Sketchup::Model
The model method retrieves the model for the selection.
311 312 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 311 def model end |
#nitems ⇒ Integer
325 326 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 325 def nitems end |
#remove(entities) ⇒ Integer #remove(*entities) ⇒ Integer
The remove method is used to remove entities from the selection.
You can pass it individual Entities or an Array of Entities: Note that the add, remove, and toggle methods are all aliases for one another. So if you call remove on an entity that is not selected, it will be toggled to be selected, not removed! Be cautious when writing your code to not make the assumption about the currently selected state of a given entity.
359 360 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 359 def remove(*args) end |
#remove_observer(observer) ⇒ Boolean
The remove_observer method is used to remove an observer from the selection object.
375 376 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 375 def remove_observer(observer) end |
#shift ⇒ Sketchup::Entity
The shift method is used to remove the first entity from the selection and returns it.
390 391 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 390 def shift end |
#single_object? ⇒ Boolean
The single_object? method is used to determine if the selection contains a single object.
It can either be a single Entity or a group of Entities for which is_curve? or is_surface? will return true.
405 406 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 405 def single_object? end |
#size ⇒ Integer
419 420 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 419 def size end |
#toggle(entities) ⇒ Integer #toggle(*entities) ⇒ Integer
The toggle method is used to change whether an entity is part of the selection. Entities that are not already selected are added. Entities that are already selected are removed.
You can pass it individual Entities or an Array of Entities: Note that the add, remove, and toggle methods are all aliases for one another. So if you call remove on an entity that is not selected, it will be toggled to be selected, not removed! Be cautious when writing your code to not make the assumption about the currently selected state of a given entity.
455 456 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb', line 455 def toggle(*args) end |