Class: ModraUp::Selection
- Inherits:
-
Object
- Object
- ModraUp::Selection
- Includes:
- Enumerable
Overview
The current selection. Includes Enumerable. Clearing the selection triggers the cleared callback rather than the bulk-change callback.
Instance Method Summary # collapse
-
#[] ⇒ ModraUp::Face, ModraUp::Edge, ModraUp::Vertex, ModraUp::Group, ModraUp::ComponentInstance, nil
Retrieve the selected item by index; out-of-bounds returns nil. Order is undefined.
-
#at(index) ⇒ ModraUp::Face, ModraUp::Edge, ModraUp::Vertex, ModraUp::Group, ModraUp::ComponentInstance, nil
Alias for #[].
-
#first ⇒ ModraUp::Face, ModraUp::Edge, ModraUp::Vertex, ModraUp::Group, ModraUp::ComponentInstance, nil
First item; an empty selection is nil.
-
#each ⇒ self, Enumerator
Iterate over the selected items.
-
#length ⇒ Integer
Number of selected entities.
-
#size ⇒ Integer
Alias for #length.
-
#nitems ⇒ Integer
Alias for #length.
-
#count ⇒ Integer
Alias for #length.
-
#empty? ⇒ Boolean
Returns whether the collection or path is empty.
-
#include?(entity) ⇒ Boolean
Does the drawing element belong to the selection set.
-
#contains?(entity) ⇒ Boolean
Alias for #include?.
-
#add(*entities) ⇒ Integer
Add to Selection (parameters can also be an array). Returns the new count.
-
#remove(*entities) ⇒ Integer
Remove from selection. Returns the new count.
-
#toggle(*entities) ⇒ Integer
Toggle the members in the selection set.
-
#clear ⇒ nil
Clear the selection. Observers receive onSelectionCleared, not Bulk.
-
#invert ⇒ nil
Inverts the selection in the current ModraUp::Model#active_entities.
-
#shift ⇒ ModraUp::Face, ModraUp::Edge, ModraUp::Vertex, ModraUp::Group, ModraUp::ComponentInstance, nil
Remove and return the first item; return nil if empty.
-
#is_curve? ⇒ Boolean
Does the current selection form a curve (a sequence of connected edges).
-
#is_surface? ⇒ Boolean
Does the currently selected face constitute a surface. Only check the selected faces.
-
#single_object? ⇒ Boolean
Returns true if only one object (a group/component or a connected edge/face) is selected.
-
#model ⇒ ModraUp::Model
The model it belongs to.
-
#add_observer(observer) ⇒ Boolean
Register a selection observer. Adding the same object a second time returns false.
-
#remove_observer(observer) ⇒ Boolean
Removes the observer. Returns false if it was absent.
Instance Method Details
selection[index] ⇒ Entity
Retrieve the selected item by index; out-of-bounds returns nil. Order is undefined.
selection.at(index) ⇒ Entity
Alias for #[].
selection.first ⇒ Entity
First item; an empty selection is nil.
selection.each {|entity| } ⇒ selfselection.each ⇒ Enumerator
Iterate over the selected items.
selection.length ⇒ Integer
Number of selected entities.
selection.size ⇒ Integer
Alias for #length.
selection.nitems ⇒ Integer
Alias for #length.
selection.count ⇒ Integer
Alias for #length.
selection.empty? ⇒ Boolean
Returns whether the collection or path is empty.
selection.include?(entity) ⇒ Boolean
Does the drawing element belong to the selection set.
selection.contains?(entity) ⇒ Boolean
Alias for #include?.
selection.add(*entities) ⇒ Integer
Add to Selection (parameters can also be an array). Returns the new count.
selection.remove(*entities) ⇒ Integer
Remove from selection. Returns the new count.
selection.toggle(*entities) ⇒ Integer
Toggle the members in the selection set.
selection.clear ⇒ nil
Clear the selection. Observers receive onSelectionCleared, not Bulk.
selection.invert ⇒ nil
Inverts the selection in the current ModraUp::Model#active_entities.
selection.shift ⇒ Entity
Remove and return the first item; return nil if empty.
selection.is_curve? ⇒ Boolean
Does the current selection form a curve (a sequence of connected edges).
selection.is_surface? ⇒ Boolean
Does the currently selected face constitute a surface. Only check the selected faces.
selection.single_object? ⇒ Boolean
Returns true if only one object (a group/component or a connected edge/face) is selected.
selection.model ⇒ ModraUp::Model
The model it belongs to.
selection.add_observer(observer) ⇒ Boolean
Register a selection observer. Adding the same object a second time returns false.
selection.remove_observer(observer) ⇒ Boolean
Removes the observer. Returns false if it was absent.