sketchup-api-stubs 0.7.8 → 0.7.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sketchup-api-stubs/sketchup.rb +151 -148
- data/lib/sketchup-api-stubs/stubs/Array.rb +741 -741
- data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +322 -322
- data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +172 -172
- data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +126 -126
- data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
- data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +400 -400
- data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +661 -661
- data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +509 -523
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +476 -478
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +263 -263
- data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +141 -141
- data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +522 -522
- data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +693 -693
- data/lib/sketchup-api-stubs/stubs/Geom.rb +351 -351
- data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +93 -93
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +595 -595
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +747 -698
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +183 -183
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +517 -516
- data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
- data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +148 -148
- data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +354 -354
- data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -311
- data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
- data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -91
- data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +370 -370
- data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +218 -218
- data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +128 -128
- data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +225 -225
- data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +567 -567
- data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +10 -10
- data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +11 -11
- data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +183 -183
- data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +387 -387
- data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +209 -209
- data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +344 -344
- data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +174 -174
- data/lib/sketchup-api-stubs/stubs/Layout/ReferenceEntity.rb +82 -0
- data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +692 -692
- data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1519 -1519
- data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
- data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
- data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
- data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
- data/lib/sketchup-api-stubs/stubs/Length.rb +278 -278
- data/lib/sketchup-api-stubs/stubs/Numeric.rb +249 -249
- data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +144 -144
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +169 -169
- data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +209 -209
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +150 -152
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +281 -286
- data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +302 -302
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +478 -478
- data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
- data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +121 -122
- data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +294 -294
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +659 -619
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +593 -593
- data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +257 -257
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
- data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +201 -201
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +449 -426
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +74 -74
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +104 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +165 -165
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +306 -306
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +42 -42
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
- data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +406 -396
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +397 -502
- data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1239 -1205
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +261 -272
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -127
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +545 -545
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -60
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +125 -126
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +937 -937
- data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +102 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +750 -750
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +282 -292
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +62 -62
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
- data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +468 -468
- data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +266 -266
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +189 -189
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +406 -407
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +84 -84
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +306 -306
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +326 -326
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +422 -422
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +427 -427
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +249 -249
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +48 -48
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +114 -112
- data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +414 -414
- data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +317 -318
- data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +93 -93
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1652 -1651
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +357 -357
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +130 -131
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +271 -284
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
- data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +490 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +116 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +797 -797
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +361 -363
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -77
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +478 -477
- data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +361 -364
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +45 -45
- data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +458 -459
- data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
- data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +212 -212
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +255 -260
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +59 -59
- data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -40
- data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +69 -69
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +217 -217
- data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +262 -262
- data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +217 -217
- data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +834 -837
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +156 -156
- data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +75 -75
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1311 -1317
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +45 -45
- data/lib/sketchup-api-stubs/stubs/Sketchup.rb +1377 -1360
- data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/String.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +389 -389
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +494 -496
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +269 -269
- data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +241 -240
- data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +635 -635
- data/lib/sketchup-api-stubs/stubs/UI.rb +683 -683
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +303 -311
- data/lib/sketchup-api-stubs.rb +1 -1
- metadata +10 -7
@@ -1,407 +1,406 @@
|
|
1
|
-
# Copyright:: Copyright
|
2
|
-
# License:: The MIT License (MIT)
|
3
|
-
|
4
|
-
# The {Sketchup::InputPoint} class is used to pick 3d points and/or entities
|
5
|
-
# that reside under the current cursor location, similar to native Line tool
|
6
|
-
# and other drawing tools. Unlike {Sketchup::PickHelper},
|
7
|
-
# {Sketchup::InputPoint} uses inference, i.e. "snaps" to vertices and other
|
8
|
-
# entities when the cursor is close to them.
|
9
|
-
#
|
10
|
-
# Only {Sketchup::Tool}s react to cursor location and most of these methods are
|
11
|
-
# only useful in the context of a tool. For example, if you want to determine
|
12
|
-
# the 3d point you just moved the cursor over, you would use
|
13
|
-
# {#pick} from within your {Sketchup::Tool#onMouseMove} method.
|
14
|
-
# {Sketchup::InputPoints} are best picked from mouse move, as you want them to
|
15
|
-
# draw them to the view.
|
16
|
-
#
|
17
|
-
# For an example, see
|
18
|
-
# {Tool
|
19
|
-
# Example}[https://github.com/SketchUp/sketchup-ruby-api-tutorials/tree/main/examples/02_custom_tool].
|
20
|
-
#
|
21
|
-
# To lock inference similar to native SketchUp tools, see
|
22
|
-
# {View#lock_inference}.
|
23
|
-
#
|
24
|
-
# @version SketchUp 6.0
|
25
|
-
class Sketchup::InputPoint
|
26
|
-
|
27
|
-
# Instance Methods
|
28
|
-
|
29
|
-
# The == method is used to determine if two input points are the same.
|
30
|
-
#
|
31
|
-
# @example
|
32
|
-
# view = Sketchup.active_model.active_view
|
33
|
-
# x = 100
|
34
|
-
# y = 100
|
35
|
-
# ip1 = Sketchup::InputPoint.new
|
36
|
-
# ip2 = view.inputpoint x,y
|
37
|
-
# # Copy the contents of inputpoint2 into inputpoint1
|
38
|
-
# ip1.copy! ip2
|
39
|
-
# # Returns true
|
40
|
-
# status = ip1 == ip2
|
41
|
-
#
|
42
|
-
# @param inputpoint2
|
43
|
-
# The second input point in the comparison.
|
44
|
-
#
|
45
|
-
# @return status - true if the InputPoint objects are the same
|
46
|
-
# object. False if the objects are not the same.
|
47
|
-
#
|
48
|
-
# @version SketchUp 6.0
|
49
|
-
def ==(inputpoint2)
|
50
|
-
end
|
51
|
-
|
52
|
-
# The clear method is used to clear the input point.
|
53
|
-
#
|
54
|
-
# This sets it to an empty state. After calling this, valid? will return
|
55
|
-
# false.
|
56
|
-
#
|
57
|
-
# @example
|
58
|
-
# view = Sketchup.active_model.active_view
|
59
|
-
# x = 100
|
60
|
-
# y = 100
|
61
|
-
# ip1 = view.inputpoint x,y
|
62
|
-
# # Returns true
|
63
|
-
# ip = ip1.clear
|
64
|
-
#
|
65
|
-
# @return inputpoint - the cleared (empty) input point if this
|
66
|
-
# successful
|
67
|
-
#
|
68
|
-
# @version SketchUp 6.0
|
69
|
-
def clear
|
70
|
-
end
|
71
|
-
|
72
|
-
# The copy! method is used to copy the data from a second input point into
|
73
|
-
# this input point.
|
74
|
-
#
|
75
|
-
# @example
|
76
|
-
# view = Sketchup.active_model.active_view
|
77
|
-
# x = 100
|
78
|
-
# y = 100
|
79
|
-
# ip1 = Sketchup::InputPoint.new
|
80
|
-
# ip2 = view.inputpoint x,y
|
81
|
-
# # Copy the contents of inputpoint2 into inputpoint1
|
82
|
-
# ip = ip1.copy! ip2
|
83
|
-
#
|
84
|
-
# @param inputpoint
|
85
|
-
# The second input point.
|
86
|
-
#
|
87
|
-
# @return inputpoint - the new input point that received the copy
|
88
|
-
# if successful
|
89
|
-
#
|
90
|
-
# @version SketchUp 6.0
|
91
|
-
def copy!(inputpoint)
|
92
|
-
end
|
93
|
-
|
94
|
-
# The degrees_of_freedom method retrieves the number of degrees of freedom
|
95
|
-
# there are for an input point.
|
96
|
-
#
|
97
|
-
# If you are just getting a point in space, then the degrees_of_freedom will
|
98
|
-
# be 3 - meaning that there is nothing about the point that would constrain
|
99
|
-
# its position.
|
100
|
-
#
|
101
|
-
# If you are on a face, then the degrees_of_freedom will be 2
|
102
|
-
# meaning that you can only move on the plane of the face.
|
103
|
-
#
|
104
|
-
# If you are on an Edge or an axis, then the degrees_of_freedom will be 1
|
105
|
-
# meaning that you can only move in the direction of the edge or axis.
|
106
|
-
#
|
107
|
-
# If you get an end point of an Edge, or an intersection point, then the
|
108
|
-
# degrees_of_freedom will be 0.
|
109
|
-
#
|
110
|
-
# @example
|
111
|
-
# view = Sketchup.active_model.active_view
|
112
|
-
# x = 100
|
113
|
-
# y = 100
|
114
|
-
# ip1 = view.inputpoint x,y
|
115
|
-
# dof = ip1.degrees_of_freedom
|
116
|
-
#
|
117
|
-
# @return degrees_of_freedom - see comments.
|
118
|
-
#
|
119
|
-
# @version SketchUp 6.0
|
120
|
-
def degrees_of_freedom
|
121
|
-
end
|
122
|
-
|
123
|
-
# The depth method retrieves the depth of an inference if it is coming from a
|
124
|
-
# component.
|
125
|
-
#
|
126
|
-
# If the InputPoint is not getting a position from inside a component, this
|
127
|
-
# method will return 0. Otherwise it returns the depth of the entity in a
|
128
|
-
# nested component that is providing the position.
|
129
|
-
#
|
130
|
-
# @example
|
131
|
-
# view = Sketchup.active_model.active_view
|
132
|
-
# x = 100
|
133
|
-
# y = 100
|
134
|
-
# ip1 = view.inputpoint x,y
|
135
|
-
# d = ip1.depth
|
136
|
-
#
|
137
|
-
# @return depth - a number representing the depth of the
|
138
|
-
# inputpoint (inside groups and components) if successful
|
139
|
-
#
|
140
|
-
# @version SketchUp 6.0
|
141
|
-
def depth
|
142
|
-
end
|
143
|
-
|
144
|
-
# The display? method is used to determine if the input point has anything to
|
145
|
-
# draw.
|
146
|
-
#
|
147
|
-
# If the method returns true, then the draw method will draw something.
|
148
|
-
#
|
149
|
-
# @example
|
150
|
-
# view = Sketchup.active_model.active_view
|
151
|
-
# x = 100
|
152
|
-
# y = 100
|
153
|
-
# ip1 = view.inputpoint x,y
|
154
|
-
# status = ip1.display
|
155
|
-
#
|
156
|
-
# @return [Boolean] status - true if the draw method will draw something,
|
157
|
-
# false if the draw method has nothing to draw
|
158
|
-
#
|
159
|
-
# @version SketchUp 6.0
|
160
|
-
def display?
|
161
|
-
end
|
162
|
-
|
163
|
-
# The draw method is used to draw the input point.
|
164
|
-
#
|
165
|
-
# This is useful for showing an InputPoint from within the draw method of a
|
166
|
-
# tool that you have implemented in Ruby. Additional examples are available in
|
167
|
-
# the Plugins/examples directory.
|
168
|
-
#
|
169
|
-
# @example
|
170
|
-
# view = Sketchup.active_model.active_view
|
171
|
-
# x = 100
|
172
|
-
# y = 100
|
173
|
-
# ip1 = view.inputpoint x,y
|
174
|
-
# ip = ip1.draw view
|
175
|
-
#
|
176
|
-
# @param view
|
177
|
-
# The current view.
|
178
|
-
#
|
179
|
-
# @return view
|
180
|
-
#
|
181
|
-
# @version SketchUp 6.0
|
182
|
-
def draw(view)
|
183
|
-
end
|
184
|
-
|
185
|
-
# The edge method is used to retrieve the edge if the input point is getting
|
186
|
-
# its position from a point on an Edge.
|
187
|
-
#
|
188
|
-
# @example
|
189
|
-
# view = Sketchup.active_model.active_view
|
190
|
-
# x = 100
|
191
|
-
# y = 100
|
192
|
-
# ip1 = view.inputpoint x,y
|
193
|
-
# e = ip1.edge
|
194
|
-
#
|
195
|
-
# @return edge - an Edge object if successful, or nil if
|
196
|
-
# unsuccessful
|
197
|
-
#
|
198
|
-
# @version SketchUp 6.0
|
199
|
-
def edge
|
200
|
-
end
|
201
|
-
|
202
|
-
# The face method retrieves the face at or behind the input point. This can be
|
203
|
-
# used to determine a plane, similar to what native Rotate tool does.
|
204
|
-
#
|
205
|
-
# @example
|
206
|
-
# view = Sketchup.active_model.active_view
|
207
|
-
# x = 100
|
208
|
-
# y = 100
|
209
|
-
# ip1 = view.inputpoint x,y
|
210
|
-
# f = ip1.face
|
211
|
-
#
|
212
|
-
# @note The InputPoint doesn't necessarily lie on the face, but can be e.g. on
|
213
|
-
# an edge in front of the face.
|
214
|
-
#
|
215
|
-
# @return [Sketchup::Face, nil]
|
216
|
-
#
|
217
|
-
# @version SketchUp 6.0
|
218
|
-
def face
|
219
|
-
end
|
220
|
-
|
221
|
-
# The new method is used to create a new InputPoint object.
|
222
|
-
#
|
223
|
-
# @example
|
224
|
-
# ip1 = Sketchup::InputPoint.new
|
225
|
-
#
|
226
|
-
# # Or you can construct it at an arbitrary location.
|
227
|
-
# starting_point = Geom::Point3d.new(100, 200, 300)
|
228
|
-
# ip2 = Sketchup::InputPoint.new(starting_point)
|
229
|
-
#
|
230
|
-
# @note Prior to SketchUp 2019 it was not possible to
|
231
|
-
# sub-class {Sketchup::InputPoint} due to a bug in how SketchUp initialized
|
232
|
-
# the class.
|
233
|
-
#
|
234
|
-
# @overload initialize()
|
235
|
-
#
|
236
|
-
# @return [Sketchup::InputPoint]
|
237
|
-
#
|
238
|
-
# @overload initialize(pt_or_vertex)
|
239
|
-
#
|
240
|
-
# @param pt_or_vertex [Geom::Point3d, Sketchup::Vertex] An optional Point3d
|
241
|
-
# or Vertex where the new InputPoint should be created.
|
242
|
-
# @return [Sketchup::InputPoint]
|
243
|
-
#
|
244
|
-
# @version SketchUp 6.0
|
245
|
-
def initialize(*args)
|
246
|
-
end
|
247
|
-
|
248
|
-
# The {#instance_path} method retrieves the instance path for the picked point.
|
249
|
-
#
|
250
|
-
# The returned instance_path is a copy of what the input point is holding on to
|
251
|
-
# at the moment you access it. Your copy will not update if you make new picks
|
252
|
-
# with the input point.
|
253
|
-
#
|
254
|
-
# If there has been no valid pick it will return `nil`.
|
255
|
-
#
|
256
|
-
# @example
|
257
|
-
# view = Sketchup.active_model.active_view
|
258
|
-
# x = 100
|
259
|
-
# y = 100
|
260
|
-
# ip = view.inputpoint(x, y)
|
261
|
-
# instance_path = ip.instance_path
|
262
|
-
#
|
263
|
-
# @return [Sketchup::InstancePath, nil]
|
264
|
-
#
|
265
|
-
# @version SketchUp 2017
|
266
|
-
def instance_path
|
267
|
-
end
|
268
|
-
|
269
|
-
# The pick method is used to get
|
270
|
-
# position.
|
271
|
-
#
|
272
|
-
#
|
273
|
-
#
|
274
|
-
#
|
275
|
-
#
|
276
|
-
#
|
277
|
-
#
|
278
|
-
#
|
279
|
-
#
|
280
|
-
#
|
281
|
-
#
|
282
|
-
#
|
283
|
-
#
|
284
|
-
#
|
285
|
-
#
|
286
|
-
#
|
287
|
-
#
|
288
|
-
#
|
289
|
-
#
|
290
|
-
#
|
291
|
-
#
|
292
|
-
#
|
293
|
-
#
|
294
|
-
#
|
295
|
-
#
|
296
|
-
#
|
297
|
-
#
|
298
|
-
#
|
299
|
-
#
|
300
|
-
#
|
301
|
-
#
|
302
|
-
#
|
303
|
-
#
|
304
|
-
#
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
#
|
310
|
-
#
|
311
|
-
#
|
312
|
-
#
|
313
|
-
#
|
314
|
-
#
|
315
|
-
#
|
316
|
-
#
|
317
|
-
#
|
318
|
-
#
|
319
|
-
#
|
320
|
-
#
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
#
|
326
|
-
#
|
327
|
-
#
|
328
|
-
#
|
329
|
-
#
|
330
|
-
#
|
331
|
-
#
|
332
|
-
#
|
333
|
-
#
|
334
|
-
#
|
335
|
-
#
|
336
|
-
#
|
337
|
-
#
|
338
|
-
#
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
#
|
344
|
-
#
|
345
|
-
#
|
346
|
-
#
|
347
|
-
#
|
348
|
-
#
|
349
|
-
#
|
350
|
-
#
|
351
|
-
#
|
352
|
-
# method
|
353
|
-
#
|
354
|
-
#
|
355
|
-
#
|
356
|
-
#
|
357
|
-
#
|
358
|
-
#
|
359
|
-
#
|
360
|
-
#
|
361
|
-
#
|
362
|
-
#
|
363
|
-
#
|
364
|
-
#
|
365
|
-
#
|
366
|
-
#
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
#
|
372
|
-
#
|
373
|
-
#
|
374
|
-
#
|
375
|
-
#
|
376
|
-
#
|
377
|
-
#
|
378
|
-
#
|
379
|
-
#
|
380
|
-
#
|
381
|
-
#
|
382
|
-
#
|
383
|
-
#
|
384
|
-
#
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
#
|
390
|
-
# InputPoint
|
391
|
-
#
|
392
|
-
#
|
393
|
-
#
|
394
|
-
#
|
395
|
-
#
|
396
|
-
#
|
397
|
-
#
|
398
|
-
#
|
399
|
-
#
|
400
|
-
#
|
401
|
-
#
|
402
|
-
#
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
end
|
1
|
+
# Copyright:: Copyright 2023 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The {Sketchup::InputPoint} class is used to pick 3d points and/or entities
|
5
|
+
# that reside under the current cursor location, similar to native Line tool
|
6
|
+
# and other drawing tools. Unlike {Sketchup::PickHelper},
|
7
|
+
# {Sketchup::InputPoint} uses inference, i.e. "snaps" to vertices and other
|
8
|
+
# entities when the cursor is close to them.
|
9
|
+
#
|
10
|
+
# Only {Sketchup::Tool}s react to cursor location and most of these methods are
|
11
|
+
# only useful in the context of a tool. For example, if you want to determine
|
12
|
+
# the 3d point you just moved the cursor over, you would use
|
13
|
+
# {#pick} from within your {Sketchup::Tool#onMouseMove} method.
|
14
|
+
# {Sketchup::InputPoints} are best picked from mouse move, as you want them to
|
15
|
+
# draw them to the view.
|
16
|
+
#
|
17
|
+
# For an example, see
|
18
|
+
# {Tool
|
19
|
+
# Example}[https://github.com/SketchUp/sketchup-ruby-api-tutorials/tree/main/examples/02_custom_tool].
|
20
|
+
#
|
21
|
+
# To lock inference similar to native SketchUp tools, see
|
22
|
+
# {View#lock_inference}.
|
23
|
+
#
|
24
|
+
# @version SketchUp 6.0
|
25
|
+
class Sketchup::InputPoint
|
26
|
+
|
27
|
+
# Instance Methods
|
28
|
+
|
29
|
+
# The == method is used to determine if two input points are the same.
|
30
|
+
#
|
31
|
+
# @example
|
32
|
+
# view = Sketchup.active_model.active_view
|
33
|
+
# x = 100
|
34
|
+
# y = 100
|
35
|
+
# ip1 = Sketchup::InputPoint.new
|
36
|
+
# ip2 = view.inputpoint x,y
|
37
|
+
# # Copy the contents of inputpoint2 into inputpoint1
|
38
|
+
# ip1.copy! ip2
|
39
|
+
# # Returns true
|
40
|
+
# status = ip1 == ip2
|
41
|
+
#
|
42
|
+
# @param inputpoint2
|
43
|
+
# The second input point in the comparison.
|
44
|
+
#
|
45
|
+
# @return status - true if the InputPoint objects are the same
|
46
|
+
# object. False if the objects are not the same.
|
47
|
+
#
|
48
|
+
# @version SketchUp 6.0
|
49
|
+
def ==(inputpoint2)
|
50
|
+
end
|
51
|
+
|
52
|
+
# The clear method is used to clear the input point.
|
53
|
+
#
|
54
|
+
# This sets it to an empty state. After calling this, valid? will return
|
55
|
+
# false.
|
56
|
+
#
|
57
|
+
# @example
|
58
|
+
# view = Sketchup.active_model.active_view
|
59
|
+
# x = 100
|
60
|
+
# y = 100
|
61
|
+
# ip1 = view.inputpoint x,y
|
62
|
+
# # Returns true
|
63
|
+
# ip = ip1.clear
|
64
|
+
#
|
65
|
+
# @return inputpoint - the cleared (empty) input point if this
|
66
|
+
# successful
|
67
|
+
#
|
68
|
+
# @version SketchUp 6.0
|
69
|
+
def clear
|
70
|
+
end
|
71
|
+
|
72
|
+
# The copy! method is used to copy the data from a second input point into
|
73
|
+
# this input point.
|
74
|
+
#
|
75
|
+
# @example
|
76
|
+
# view = Sketchup.active_model.active_view
|
77
|
+
# x = 100
|
78
|
+
# y = 100
|
79
|
+
# ip1 = Sketchup::InputPoint.new
|
80
|
+
# ip2 = view.inputpoint x,y
|
81
|
+
# # Copy the contents of inputpoint2 into inputpoint1
|
82
|
+
# ip = ip1.copy! ip2
|
83
|
+
#
|
84
|
+
# @param inputpoint
|
85
|
+
# The second input point.
|
86
|
+
#
|
87
|
+
# @return inputpoint - the new input point that received the copy
|
88
|
+
# if successful
|
89
|
+
#
|
90
|
+
# @version SketchUp 6.0
|
91
|
+
def copy!(inputpoint)
|
92
|
+
end
|
93
|
+
|
94
|
+
# The degrees_of_freedom method retrieves the number of degrees of freedom
|
95
|
+
# there are for an input point.
|
96
|
+
#
|
97
|
+
# If you are just getting a point in space, then the degrees_of_freedom will
|
98
|
+
# be 3 - meaning that there is nothing about the point that would constrain
|
99
|
+
# its position.
|
100
|
+
#
|
101
|
+
# If you are on a face, then the degrees_of_freedom will be 2
|
102
|
+
# meaning that you can only move on the plane of the face.
|
103
|
+
#
|
104
|
+
# If you are on an Edge or an axis, then the degrees_of_freedom will be 1
|
105
|
+
# meaning that you can only move in the direction of the edge or axis.
|
106
|
+
#
|
107
|
+
# If you get an end point of an Edge, or an intersection point, then the
|
108
|
+
# degrees_of_freedom will be 0.
|
109
|
+
#
|
110
|
+
# @example
|
111
|
+
# view = Sketchup.active_model.active_view
|
112
|
+
# x = 100
|
113
|
+
# y = 100
|
114
|
+
# ip1 = view.inputpoint x,y
|
115
|
+
# dof = ip1.degrees_of_freedom
|
116
|
+
#
|
117
|
+
# @return degrees_of_freedom - see comments.
|
118
|
+
#
|
119
|
+
# @version SketchUp 6.0
|
120
|
+
def degrees_of_freedom
|
121
|
+
end
|
122
|
+
|
123
|
+
# The depth method retrieves the depth of an inference if it is coming from a
|
124
|
+
# component.
|
125
|
+
#
|
126
|
+
# If the InputPoint is not getting a position from inside a component, this
|
127
|
+
# method will return 0. Otherwise it returns the depth of the entity in a
|
128
|
+
# nested component that is providing the position.
|
129
|
+
#
|
130
|
+
# @example
|
131
|
+
# view = Sketchup.active_model.active_view
|
132
|
+
# x = 100
|
133
|
+
# y = 100
|
134
|
+
# ip1 = view.inputpoint x,y
|
135
|
+
# d = ip1.depth
|
136
|
+
#
|
137
|
+
# @return depth - a number representing the depth of the
|
138
|
+
# inputpoint (inside groups and components) if successful
|
139
|
+
#
|
140
|
+
# @version SketchUp 6.0
|
141
|
+
def depth
|
142
|
+
end
|
143
|
+
|
144
|
+
# The display? method is used to determine if the input point has anything to
|
145
|
+
# draw.
|
146
|
+
#
|
147
|
+
# If the method returns true, then the draw method will draw something.
|
148
|
+
#
|
149
|
+
# @example
|
150
|
+
# view = Sketchup.active_model.active_view
|
151
|
+
# x = 100
|
152
|
+
# y = 100
|
153
|
+
# ip1 = view.inputpoint x,y
|
154
|
+
# status = ip1.display
|
155
|
+
#
|
156
|
+
# @return [Boolean] status - true if the draw method will draw something,
|
157
|
+
# false if the draw method has nothing to draw
|
158
|
+
#
|
159
|
+
# @version SketchUp 6.0
|
160
|
+
def display?
|
161
|
+
end
|
162
|
+
|
163
|
+
# The draw method is used to draw the input point.
|
164
|
+
#
|
165
|
+
# This is useful for showing an InputPoint from within the draw method of a
|
166
|
+
# tool that you have implemented in Ruby. Additional examples are available in
|
167
|
+
# the Plugins/examples directory.
|
168
|
+
#
|
169
|
+
# @example
|
170
|
+
# view = Sketchup.active_model.active_view
|
171
|
+
# x = 100
|
172
|
+
# y = 100
|
173
|
+
# ip1 = view.inputpoint x,y
|
174
|
+
# ip = ip1.draw view
|
175
|
+
#
|
176
|
+
# @param view
|
177
|
+
# The current view.
|
178
|
+
#
|
179
|
+
# @return view
|
180
|
+
#
|
181
|
+
# @version SketchUp 6.0
|
182
|
+
def draw(view)
|
183
|
+
end
|
184
|
+
|
185
|
+
# The edge method is used to retrieve the edge if the input point is getting
|
186
|
+
# its position from a point on an Edge.
|
187
|
+
#
|
188
|
+
# @example
|
189
|
+
# view = Sketchup.active_model.active_view
|
190
|
+
# x = 100
|
191
|
+
# y = 100
|
192
|
+
# ip1 = view.inputpoint x,y
|
193
|
+
# e = ip1.edge
|
194
|
+
#
|
195
|
+
# @return edge - an Edge object if successful, or nil if
|
196
|
+
# unsuccessful
|
197
|
+
#
|
198
|
+
# @version SketchUp 6.0
|
199
|
+
def edge
|
200
|
+
end
|
201
|
+
|
202
|
+
# The face method retrieves the face at or behind the input point. This can be
|
203
|
+
# used to determine a plane, similar to what native Rotate tool does.
|
204
|
+
#
|
205
|
+
# @example
|
206
|
+
# view = Sketchup.active_model.active_view
|
207
|
+
# x = 100
|
208
|
+
# y = 100
|
209
|
+
# ip1 = view.inputpoint x,y
|
210
|
+
# f = ip1.face
|
211
|
+
#
|
212
|
+
# @note The InputPoint doesn't necessarily lie on the face, but can be e.g. on
|
213
|
+
# an edge in front of the face.
|
214
|
+
#
|
215
|
+
# @return [Sketchup::Face, nil]
|
216
|
+
#
|
217
|
+
# @version SketchUp 6.0
|
218
|
+
def face
|
219
|
+
end
|
220
|
+
|
221
|
+
# The new method is used to create a new InputPoint object.
|
222
|
+
#
|
223
|
+
# @example
|
224
|
+
# ip1 = Sketchup::InputPoint.new
|
225
|
+
#
|
226
|
+
# # Or you can construct it at an arbitrary location.
|
227
|
+
# starting_point = Geom::Point3d.new(100, 200, 300)
|
228
|
+
# ip2 = Sketchup::InputPoint.new(starting_point)
|
229
|
+
#
|
230
|
+
# @note Prior to SketchUp 2019 it was not possible to
|
231
|
+
# sub-class {Sketchup::InputPoint} due to a bug in how SketchUp initialized
|
232
|
+
# the class.
|
233
|
+
#
|
234
|
+
# @overload initialize()
|
235
|
+
#
|
236
|
+
# @return [Sketchup::InputPoint]
|
237
|
+
#
|
238
|
+
# @overload initialize(pt_or_vertex)
|
239
|
+
#
|
240
|
+
# @param pt_or_vertex [Geom::Point3d, Sketchup::Vertex] An optional Point3d
|
241
|
+
# or Vertex where the new InputPoint should be created.
|
242
|
+
# @return [Sketchup::InputPoint]
|
243
|
+
#
|
244
|
+
# @version SketchUp 6.0
|
245
|
+
def initialize(*args)
|
246
|
+
end
|
247
|
+
|
248
|
+
# The {#instance_path} method retrieves the instance path for the picked point.
|
249
|
+
#
|
250
|
+
# The returned instance_path is a copy of what the input point is holding on to
|
251
|
+
# at the moment you access it. Your copy will not update if you make new picks
|
252
|
+
# with the input point.
|
253
|
+
#
|
254
|
+
# If there has been no valid pick it will return `nil`.
|
255
|
+
#
|
256
|
+
# @example
|
257
|
+
# view = Sketchup.active_model.active_view
|
258
|
+
# x = 100
|
259
|
+
# y = 100
|
260
|
+
# ip = view.inputpoint(x, y)
|
261
|
+
# instance_path = ip.instance_path
|
262
|
+
#
|
263
|
+
# @return [Sketchup::InstancePath, nil]
|
264
|
+
#
|
265
|
+
# @version SketchUp 2017
|
266
|
+
def instance_path
|
267
|
+
end
|
268
|
+
|
269
|
+
# The {#pick} method is used to get a input point at a specific screen
|
270
|
+
# position.
|
271
|
+
#
|
272
|
+
# @example
|
273
|
+
# view = Sketchup.active_model.active_view
|
274
|
+
# x = 100
|
275
|
+
# y = 100
|
276
|
+
# inputpoint = view.inputpoint(x, y)
|
277
|
+
# inputpoint2 = Sketchup::InputPoint.new(Geom::Point3d.new(100, 200, 300))
|
278
|
+
# inputpoint.pick(view, x, y)
|
279
|
+
# inputpoint.pick(view, x, y, inputpoint2)
|
280
|
+
#
|
281
|
+
# @overload pick(view, x, y)
|
282
|
+
#
|
283
|
+
# The first form just uses the screen position to compute the InputPoint. It
|
284
|
+
# is used when you don't want the InputPoint to be dependent on another
|
285
|
+
# InputPoint.
|
286
|
+
# @param [Sketchup::View] view
|
287
|
+
# @param [Integer] x
|
288
|
+
# @param [Integer] y
|
289
|
+
#
|
290
|
+
# @overload pick(view, x, y, inputpoint)
|
291
|
+
#
|
292
|
+
# The second form uses the screen position and another InputPoint. It will
|
293
|
+
# find additional inferences such as along one of the axis directions from the
|
294
|
+
# first point.
|
295
|
+
# @param [Sketchup::View] view
|
296
|
+
# @param [Integer] x
|
297
|
+
# @param [Integer] y
|
298
|
+
# @param [Sketchup::InputPoint] inputpoint
|
299
|
+
# A second input point used as a reference for the pick.
|
300
|
+
#
|
301
|
+
# @return [Boolean] +true+ if a valid input point was picked and it
|
302
|
+
# is different than it was before.
|
303
|
+
#
|
304
|
+
# @version SketchUp 6.0
|
305
|
+
def pick(*args)
|
306
|
+
end
|
307
|
+
|
308
|
+
# The position method is used to get the 3D point from the input point.
|
309
|
+
#
|
310
|
+
# @example
|
311
|
+
# view = Sketchup.active_model.active_view
|
312
|
+
# x = 100
|
313
|
+
# y = 100
|
314
|
+
# ip1 = view.inputpoint x,y
|
315
|
+
# point = ip1.position
|
316
|
+
#
|
317
|
+
# @return point - a Point3d object position for the input point
|
318
|
+
# if successful
|
319
|
+
#
|
320
|
+
# @version SketchUp 6.0
|
321
|
+
def position
|
322
|
+
end
|
323
|
+
|
324
|
+
# The tooltip method is used to retrieve the string that is the tool tip to
|
325
|
+
# display for the input point.
|
326
|
+
#
|
327
|
+
# @example
|
328
|
+
# view = Sketchup.active_model.active_view
|
329
|
+
# x = 100
|
330
|
+
# y = 100
|
331
|
+
# ip1 = view.inputpoint x,y
|
332
|
+
# # Click on a face and you get "On Face"
|
333
|
+
# tip = ip1.tooltip
|
334
|
+
#
|
335
|
+
# @return tip - a string tooltip or an empty string (if the input
|
336
|
+
# point doesn't provide a tooltip).
|
337
|
+
#
|
338
|
+
# @version SketchUp 6.0
|
339
|
+
def tooltip
|
340
|
+
end
|
341
|
+
|
342
|
+
# The transformation method retrieves the Transformation object for the input
|
343
|
+
# point.
|
344
|
+
#
|
345
|
+
# If the InputPoint object is getting its position from something inside of a
|
346
|
+
# component instance, this method returns the Transformation of the component
|
347
|
+
# instance. Otherwise it returns the identity Transformation.
|
348
|
+
#
|
349
|
+
# Note that the position method on a input point always returns a point that is
|
350
|
+
# transformed into model space. If you are using the edge, face or vertex
|
351
|
+
# method on the InputPoint though, you will probably need to use the
|
352
|
+
# transformation method to transform the data that you get back from the
|
353
|
+
# selected entity.
|
354
|
+
#
|
355
|
+
# @example
|
356
|
+
# view = Sketchup.active_model.active_view
|
357
|
+
# x = 100
|
358
|
+
# y = 100
|
359
|
+
# ip1 = view.inputpoint x,y
|
360
|
+
# # In this case, returning the identity transformation
|
361
|
+
# tform = ip1.transformation
|
362
|
+
#
|
363
|
+
# @return transformation - the Transformation for the input point
|
364
|
+
# if successful
|
365
|
+
#
|
366
|
+
# @version SketchUp 6.0
|
367
|
+
def transformation
|
368
|
+
end
|
369
|
+
|
370
|
+
# The valid? method is used to determine if an input point has valid data.
|
371
|
+
#
|
372
|
+
# You must have called the pick method to set the data before it is valid.
|
373
|
+
#
|
374
|
+
# @example
|
375
|
+
# view = Sketchup.active_model.active_view
|
376
|
+
# x = 100
|
377
|
+
# y = 100
|
378
|
+
# ip1 = view.inputpoint x,y
|
379
|
+
# status = ip1.valid?
|
380
|
+
#
|
381
|
+
# @return [Boolean] status - true if the input point has valid data, false
|
382
|
+
# if it does not have valid data.
|
383
|
+
#
|
384
|
+
# @version SketchUp 6.0
|
385
|
+
def valid?
|
386
|
+
end
|
387
|
+
|
388
|
+
# The vertex method returns a Vertex associated with the InputPoint. If the
|
389
|
+
# InputPoint is on the end of a line, then it will return the Vertex. If the
|
390
|
+
# InputPoint does not select any vertices this method returns nil.
|
391
|
+
#
|
392
|
+
# @example
|
393
|
+
# view = Sketchup.active_model.active_view
|
394
|
+
# x = 100
|
395
|
+
# y = 100
|
396
|
+
# ip1 = view.inputpoint x,y
|
397
|
+
# # Click on a face and you get "On Face"
|
398
|
+
# tip = ip1.vertex
|
399
|
+
#
|
400
|
+
# @return vertex - The associated vertex
|
401
|
+
#
|
402
|
+
# @version SketchUp 6.0
|
403
|
+
def vertex
|
404
|
+
end
|
405
|
+
|
406
|
+
end
|