Class: Sketchup::InputPoint
- Inherits:
-
Object
- Object
- Sketchup::InputPoint
- Defined in:
- lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb
Overview
The InputPoint class is used to pick 3d points and/or entities that reside under the current cursor location, similar to native Line tool and other drawing tools. Unlike PickHelper, InputPoint uses inference, i.e. “snaps” to vertices and other entities when the cursor is close to them.
Only Tools react to cursor location and most of these methods are only useful in the context of a tool. For example, if you want to determine the 3d point you just moved the cursor over, you would use #pick from within your Tool#onMouseMove method. InputPoints are best picked from mouse move, as you want them to draw them to the view.
For an example, see Tool Example.
To lock inference similar to native SketchUp tools, see View#lock_inference.
Instance Method Summary collapse
-
#==(inputpoint2) ⇒ Object
The == method is used to determine if two input points are the same.
-
#clear ⇒ Object
The clear method is used to clear the input point.
-
#copy!(inputpoint) ⇒ Object
The copy! method is used to copy the data from a second input point into this input point.
-
#degrees_of_freedom ⇒ Object
The degrees_of_freedom method retrieves the number of degrees of freedom there are for an input point.
-
#depth ⇒ Object
The depth method retrieves the depth of an inference if it is coming from a component.
-
#display? ⇒ Boolean
The display? method is used to determine if the input point has anything to draw.
-
#draw(view) ⇒ Object
The draw method is used to draw the input point.
-
#edge ⇒ Object
The edge method is used to retrieve the edge if the input point is getting its position from a point on an Edge.
-
#face ⇒ Sketchup::Face?
The face method retrieves the face at or behind the input point.
-
#initialize(*args) ⇒ InputPoint
constructor
The new method is used to create a new InputPoint object.
-
#instance_path ⇒ Sketchup::InstancePath?
The #instance_path method retrieves the instance path for the picked point.
-
#pick(*args) ⇒ Boolean
The #pick method is used to get a input point at a specific screen position.
-
#position ⇒ Object
The position method is used to get the 3D point from the input point.
-
#tooltip ⇒ Object
The tooltip method is used to retrieve the string that is the tool tip to display for the input point.
-
#transformation ⇒ Object
The transformation method retrieves the Transformation object for the input point.
-
#valid? ⇒ Boolean
The valid? method is used to determine if an input point has valid data.
-
#vertex ⇒ Object
The vertex method returns a Vertex associated with the InputPoint.
Constructor Details
#initialize ⇒ Sketchup::InputPoint #initialize(pt_or_vertex) ⇒ Sketchup::InputPoint
Prior to SketchUp 2019 it was not possible to sub-class Sketchup::InputPoint due to a bug in how SketchUp initialized the class.
The new method is used to create a new InputPoint object.
245 246 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb', line 245 def initialize(*args) end |
Instance Method Details
#==(inputpoint2) ⇒ Object
The == method is used to determine if two input points are the same.
49 50 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb', line 49 def ==(inputpoint2) end |
#clear ⇒ Object
The clear method is used to clear the input point.
This sets it to an empty state. After calling this, valid? will return false.
69 70 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb', line 69 def clear end |
#copy!(inputpoint) ⇒ Object
The copy! method is used to copy the data from a second input point into this input point.
91 92 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb', line 91 def copy!(inputpoint) end |
#degrees_of_freedom ⇒ Object
The degrees_of_freedom method retrieves the number of degrees of freedom there are for an input point.
If you are just getting a point in space, then the degrees_of_freedom will be 3 - meaning that there is nothing about the point that would constrain its position.
If you are on a face, then the degrees_of_freedom will be 2 meaning that you can only move on the plane of the face.
If you are on an Edge or an axis, then the degrees_of_freedom will be 1 meaning that you can only move in the direction of the edge or axis.
If you get an end point of an Edge, or an intersection point, then the degrees_of_freedom will be 0.
120 121 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb', line 120 def degrees_of_freedom end |
#depth ⇒ Object
The depth method retrieves the depth of an inference if it is coming from a component.
If the InputPoint is not getting a position from inside a component, this method will return 0. Otherwise it returns the depth of the entity in a nested component that is providing the position.
141 142 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb', line 141 def depth end |
#display? ⇒ Boolean
The display? method is used to determine if the input point has anything to draw.
If the method returns true, then the draw method will draw something.
160 161 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb', line 160 def display? end |
#draw(view) ⇒ Object
The draw method is used to draw the input point.
This is useful for showing an InputPoint from within the draw method of a tool that you have implemented in Ruby. Additional examples are available in the Plugins/examples directory.
182 183 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb', line 182 def draw(view) end |
#edge ⇒ Object
The edge method is used to retrieve the edge if the input point is getting its position from a point on an Edge.
199 200 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb', line 199 def edge end |
#face ⇒ Sketchup::Face?
The InputPoint doesn’t necessarily lie on the face, but can be e.g. on an edge in front of the face.
The face method retrieves the face at or behind the input point. This can be used to determine a plane, similar to what native Rotate tool does.
218 219 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb', line 218 def face end |
#instance_path ⇒ Sketchup::InstancePath?
The #instance_path method retrieves the instance path for the picked point.
The returned instance_path is a copy of what the input point is holding on to at the moment you access it. Your copy will not update if you make new picks with the input point.
If there has been no valid pick it will return ‘nil`.
266 267 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb', line 266 def instance_path end |
#pick(view, x, y) ⇒ Boolean #pick(view, x, y, inputpoint) ⇒ Boolean
The #pick method is used to get a input point at a specific screen position.
305 306 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb', line 305 def pick(*args) end |
#position ⇒ Object
The position method is used to get the 3D point from the input point.
321 322 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb', line 321 def position end |
#tooltip ⇒ Object
The tooltip method is used to retrieve the string that is the tool tip to display for the input point.
339 340 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb', line 339 def tooltip end |
#transformation ⇒ Object
The transformation method retrieves the Transformation object for the input point.
If the InputPoint object is getting its position from something inside of a component instance, this method returns the Transformation of the component instance. Otherwise it returns the identity Transformation.
Note that the position method on a input point always returns a point that is transformed into model space. If you are using the edge, face or vertex method on the InputPoint though, you will probably need to use the transformation method to transform the data that you get back from the selected entity.
367 368 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb', line 367 def transformation end |
#valid? ⇒ Boolean
The valid? method is used to determine if an input point has valid data.
You must have called the pick method to set the data before it is valid.
385 386 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb', line 385 def valid? end |
#vertex ⇒ Object
The vertex method returns a Vertex associated with the InputPoint. If the InputPoint is on the end of a line, then it will return the Vertex. If the InputPoint does not select any vertices this method returns nil.
403 404 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb', line 403 def vertex end |