sketchup-api-stubs 0.7.4 → 0.7.8

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