Class: Sketchup::PickHelper
- Inherits:
-
Object
- Object
- Sketchup::PickHelper
- Defined in:
- SketchUp/Sketchup/PickHelper.rb
Overview
The PickHelper class is used to pick entities that reside under the current cursor location. PickHelper and InputPoint are similar, but InputPoint also uses inferencing. You can retrieve a PickHelper object using the pick_helper method on a View object.
Entities that are picked (found under the cursor when a mouse or keyboard event occurs), are called Pick Records and are placed in an indexed list.
Constant Summary collapse
- PICK_CROSSING =
Constants
nil- PICK_INSIDE =
Stub value.
nil
Instance Method Summary collapse
-
#all_picked ⇒ Object
The all_picked method is used to get an array of entities from the active entities from all the pick paths.
-
#best_picked ⇒ Object
The best_picked method is used to retrieve the “best” entity picked (entity that you would have picked if you were using the select tool).
-
#boundingbox_pick(bounding_box, pick_type, transformation = IDENTITY) ⇒ Object
Used to pick a set of entities from a model from a BoundingBox.
-
#count ⇒ Object
The count method is used to count the number of entities picked (number of pick records).
-
#depth_at(index) ⇒ Object
The depth_at method retrieves the depth of one of the currently picked entities in the list of pick records.
-
#do_pick(x, y, aperture = 0) ⇒ Object
The do_pick method is used to perform the initial pick.
-
#element_at(index) ⇒ Object
The element_at method is used to retrieve a specific entity in the list of picked elements.
-
#init(x, y, aperture = 0) ⇒ Object
The init method is used to initialize the PickHelper for testing points.
-
#leaf_at(index) ⇒ Object
The leaf_at method retrieves the deepest thing in a pick path.
-
#path_at(index) ⇒ Object
The path_at method is used to retrieve the entire path for an entity in the pick list (as an array).
-
#pick_segment(array_or_list, x, y, aperture = 0) ⇒ Object
The pick_segment method is used to pick a segment of a polyline curve that is defined by an array of points.
-
#picked_edge ⇒ Object
The picked_edge method is used to retrieve the “best” Edge picked.
-
#picked_element(index) ⇒ Object
The picked_element method retrieves the best drawing element, that is not an edge or a face, picked.
-
#picked_face ⇒ Object
The picked_face method is used to retrieve the best face picked.
-
#test_point(point, x, y, aperture = 0) ⇒ Object
The test_point method is used to test a point to see if it would be selected using the default or given pick aperture.
-
#transformation_at(index) ⇒ Object
The transformation_at method is used to get a transformation at a specific pick path index in the pick helper.
-
#view ⇒ Object
The view method is used to get the view associated with the PickHelper.
-
#window_pick(start_point, end_point, pick_type) ⇒ Object
Used to pick a set of entities from a model based on a screen coordinate rectangular area defined by two points.
Instance Method Details
#all_picked ⇒ Object
The all_picked method is used to get an array of entities from the active entities from all the pick paths. Duplicates might occur if there are multiple pick paths for entities that ends in a group or component.
For example, if the pick hits at the border of an edge and face inside a group there will be two pick paths - one for the face and one for the edge. Since this method returns entities from the active entities it would return an array with the group two times.
41 42 |
# File 'SketchUp/Sketchup/PickHelper.rb', line 41 def all_picked end |
#best_picked ⇒ Object
The best_picked method is used to retrieve the “best” entity picked (entity that you would have picked if you were using the select tool).
Returns nil if nothing was picked. You must have called do_pick before calling this method.
58 59 |
# File 'SketchUp/Sketchup/PickHelper.rb', line 58 def best_picked end |
#boundingbox_pick(bounding_box, pick_type, transformation = IDENTITY) ⇒ Object
Used to pick a set of entities from a model from a BoundingBox. The pick criteria can be for completely-contained or partially-contained entities, similar to how the Selection tool works.
94 95 |
# File 'SketchUp/Sketchup/PickHelper.rb', line 94 def boundingbox_pick(bounding_box, pick_type, transformation = IDENTITY) end |
#count ⇒ Object
The count method is used to count the number of entities picked (number of pick records)
106 107 |
# File 'SketchUp/Sketchup/PickHelper.rb', line 106 def count end |
#depth_at(index) ⇒ Object
The depth_at method retrieves the depth of one of the currently picked entities in the list of pick records.
126 127 |
# File 'SketchUp/Sketchup/PickHelper.rb', line 126 def depth_at(index) end |
#do_pick(x, y, aperture = 0) ⇒ Object
The do_pick method is used to perform the initial pick. This method is generally called before any other methods in the PickHelper class.
Returns the number of entities picked. The x and y values are the screen coordinates of the point at which would want to do a pick.
150 151 |
# File 'SketchUp/Sketchup/PickHelper.rb', line 150 def do_pick(x, y, aperture = 0) end |
#element_at(index) ⇒ Object
The element_at method is used to retrieve a specific entity in the list of picked elements. This element will be from the active entities.
Use count() to get the number of possible pick paths.
174 175 |
# File 'SketchUp/Sketchup/PickHelper.rb', line 174 def element_at(index) end |
#init(x, y, aperture = 0) ⇒ Object
The init method is used to initialize the PickHelper for testing points.
You do not normally need to call this method, but you can use this if you want to call test_point or pick_segment on a lot of points.
If the optional aperture is given, it is given in pixels.
204 205 |
# File 'SketchUp/Sketchup/PickHelper.rb', line 204 def init(x, y, aperture = 0) end |
#leaf_at(index) ⇒ Object
The leaf_at method retrieves the deepest thing in a pick path.
For example, if you have a face that is within a component that is within another component, leaf_at returns the face.
Use count() to get the number of possible pick paths.
228 229 |
# File 'SketchUp/Sketchup/PickHelper.rb', line 228 def leaf_at(index) end |
#path_at(index) ⇒ Object
The path_at method is used to retrieve the entire path for an entity in the pick list (as an array).
If one of the pick paths end in a face nested in a group nested in a component this method will return an array of these entities. The Group will be first and the face will be last.
The first item in the array will be from the active entities and the last item will be a drawing element that is not a group, component or image.
255 256 |
# File 'SketchUp/Sketchup/PickHelper.rb', line 255 def path_at(index) end |
#pick_segment(array_or_list, x, y, aperture = 0) ⇒ Object
The pick_segment method is used to pick a segment of a polyline curve that is defined by an array of points.
If you click on a point in a polyline curve, the index of the point in the curve is returned (starting at 0). If you click on a segment in the polyline curve, the index of the segment is returned. Segments start at index -1 (for the segment connecting the first two points) and increase by a factor of -1 (for example, the segment connecting second and third point is -2).
There is no need to invoke do_pick for this and the results are unrelated.
300 301 |
# File 'SketchUp/Sketchup/PickHelper.rb', line 300 def pick_segment(array_or_list, x, y, aperture = 0) end |
#picked_edge ⇒ Object
The picked_edge method is used to retrieve the “best” Edge picked.
Returns nil if there were no edges picked. You must have called do_pick before calling this method.
316 317 |
# File 'SketchUp/Sketchup/PickHelper.rb', line 316 def picked_edge end |
#picked_element(index) ⇒ Object
The picked_element method retrieves the best drawing element, that is not an edge or a face, picked.
Returns nil if nothing was picked. You must have called do_pick before calling this method.
336 337 |
# File 'SketchUp/Sketchup/PickHelper.rb', line 336 def picked_element(index) end |
#picked_face ⇒ Object
The picked_face method is used to retrieve the best face picked.
Returns nil if there were no faces picked. You must have called do_pick before calling this method.
352 353 |
# File 'SketchUp/Sketchup/PickHelper.rb', line 352 def picked_face end |
#test_point(point, x, y, aperture = 0) ⇒ Object
The test_point method is used to test a point to see if it would be selected using the default or given pick aperture.
In the first form, you must have initialized the PickHelper using the init method. This is more efficient if you want to test a lot of points using the same screen point.
In the second and third forms, it initializes the PickHelper using a screen point and an optional pick aperture that you pass in as the 2nd-4th arguments.
There is no need to invoke do_pick for this and the results are unrelated.
392 393 |
# File 'SketchUp/Sketchup/PickHelper.rb', line 392 def test_point(point, x, y, aperture = 0) end |
#transformation_at(index) ⇒ Object
The transformation_at method is used to get a transformation at a specific pick path index in the pick helper.
The transformation combines the transformation of all groups, components and images in the pick path. This transformation can be used to transform the coordinates of the leaf entity into the coordinates of the active entities.
416 417 |
# File 'SketchUp/Sketchup/PickHelper.rb', line 416 def transformation_at(index) end |
#view ⇒ Object
The view method is used to get the view associated with the PickHelper.
427 428 |
# File 'SketchUp/Sketchup/PickHelper.rb', line 427 def view end |
#window_pick(start_point, end_point, pick_type) ⇒ Object
Used to pick a set of entities from a model based on a screen coordinate rectangular area defined by two points. The pick criteria can be for completely-contained or partially-contained entities, similar to how the Selection tool works. The z value of the points passed in are ignored.
454 455 |
# File 'SketchUp/Sketchup/PickHelper.rb', line 454 def window_pick(start_point, end_point, pick_type) end |