sketchup-api-stubs 0.7.7 → 0.7.9

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