sketchup-api-stubs 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/SketchUp/Geom/BoundingBox.rb +335 -0
- data/SketchUp/Geom/LatLong.rb +123 -0
- data/SketchUp/Geom/Point3d.rb +643 -0
- data/SketchUp/Geom/PolygonMesh.rb +478 -0
- data/SketchUp/Geom/Transformation.rb +476 -0
- data/SketchUp/Geom/UTM.rb +135 -0
- data/SketchUp/Geom/Vector3d.rb +684 -0
- data/SketchUp/Sketchup/Animation.rb +137 -0
- data/SketchUp/Sketchup/AppObserver.rb +157 -0
- data/SketchUp/Sketchup/ArcCurve.rb +209 -0
- data/SketchUp/Sketchup/AttributeDictionaries.rb +146 -0
- data/SketchUp/Sketchup/AttributeDictionary.rb +280 -0
- data/SketchUp/Sketchup/Axes.rb +149 -0
- data/SketchUp/Sketchup/Behavior.rb +338 -0
- data/SketchUp/Sketchup/Camera.rb +594 -0
- data/SketchUp/Sketchup/ClassificationSchema.rb +63 -0
- data/SketchUp/Sketchup/Classifications.rb +118 -0
- data/SketchUp/Sketchup/Color.rb +291 -0
- data/SketchUp/Sketchup/ComponentDefinition.rb +562 -0
- data/SketchUp/Sketchup/ComponentInstance.rb +597 -0
- data/SketchUp/Sketchup/Console.rb +78 -0
- data/SketchUp/Sketchup/ConstructionLine.rb +257 -0
- data/SketchUp/Sketchup/ConstructionPoint.rb +32 -0
- data/SketchUp/Sketchup/Curve.rb +196 -0
- data/SketchUp/Sketchup/DefinitionList.rb +312 -0
- data/SketchUp/Sketchup/DefinitionObserver.rb +73 -0
- data/SketchUp/Sketchup/DefinitionsObserver.rb +102 -0
- data/SketchUp/Sketchup/Dimension.rb +167 -0
- data/SketchUp/Sketchup/DimensionLinear.rb +232 -0
- data/SketchUp/Sketchup/DimensionObserver.rb +38 -0
- data/SketchUp/Sketchup/DimensionRadial.rb +87 -0
- data/SketchUp/Sketchup/Drawingelement.rb +400 -0
- data/SketchUp/Sketchup/Edge.rb +517 -0
- data/SketchUp/Sketchup/EdgeUse.rb +213 -0
- data/SketchUp/Sketchup/Entities.rb +1011 -0
- data/SketchUp/Sketchup/EntitiesObserver.rb +125 -0
- data/SketchUp/Sketchup/Entity.rb +522 -0
- data/SketchUp/Sketchup/EntityObserver.rb +59 -0
- data/SketchUp/Sketchup/ExtensionsManager.rb +129 -0
- data/SketchUp/Sketchup/Face.rb +737 -0
- data/SketchUp/Sketchup/FrameChangeObserver.rb +104 -0
- data/SketchUp/Sketchup/Group.rb +705 -0
- data/SketchUp/Sketchup/Http.rb +27 -0
- data/SketchUp/Sketchup/Http/Request.rb +285 -0
- data/SketchUp/Sketchup/Http/Response.rb +62 -0
- data/SketchUp/Sketchup/Image.rb +393 -0
- data/SketchUp/Sketchup/Importer.rb +192 -0
- data/SketchUp/Sketchup/InputPoint.rb +393 -0
- data/SketchUp/Sketchup/InstanceObserver.rb +82 -0
- data/SketchUp/Sketchup/InstancePath.rb +297 -0
- data/SketchUp/Sketchup/Layer.rb +240 -0
- data/SketchUp/Sketchup/Layers.rb +235 -0
- data/SketchUp/Sketchup/LayersObserver.rb +136 -0
- data/SketchUp/Sketchup/Licensing.rb +47 -0
- data/SketchUp/Sketchup/Licensing/ExtensionLicense.rb +88 -0
- data/SketchUp/Sketchup/Loop.rb +141 -0
- data/SketchUp/Sketchup/Material.rb +384 -0
- data/SketchUp/Sketchup/Materials.rb +283 -0
- data/SketchUp/Sketchup/MaterialsObserver.rb +141 -0
- data/SketchUp/Sketchup/Menu.rb +97 -0
- data/SketchUp/Sketchup/Model.rb +1459 -0
- data/SketchUp/Sketchup/ModelObserver.rb +356 -0
- data/SketchUp/Sketchup/OptionsManager.rb +135 -0
- data/SketchUp/Sketchup/OptionsProvider.rb +277 -0
- data/SketchUp/Sketchup/OptionsProviderObserver.rb +58 -0
- data/SketchUp/Sketchup/Page.rb +636 -0
- data/SketchUp/Sketchup/Pages.rb +349 -0
- data/SketchUp/Sketchup/PagesObserver.rb +76 -0
- data/SketchUp/Sketchup/PickHelper.rb +457 -0
- data/SketchUp/Sketchup/RegionalSettings.rb +43 -0
- data/SketchUp/Sketchup/RenderingOptions.rb +337 -0
- data/SketchUp/Sketchup/RenderingOptionsObserver.rb +44 -0
- data/SketchUp/Sketchup/SectionPlane.rb +88 -0
- data/SketchUp/Sketchup/Selection.rb +470 -0
- data/SketchUp/Sketchup/SelectionObserver.rb +115 -0
- data/SketchUp/Sketchup/Set.rb +253 -0
- data/SketchUp/Sketchup/ShadowInfo.rb +257 -0
- data/SketchUp/Sketchup/ShadowInfoObserver.rb +57 -0
- data/SketchUp/Sketchup/Style.rb +77 -0
- data/SketchUp/Sketchup/Styles.rb +204 -0
- data/SketchUp/Sketchup/Text.rb +241 -0
- data/SketchUp/Sketchup/Texture.rb +211 -0
- data/SketchUp/Sketchup/TextureWriter.rb +237 -0
- data/SketchUp/Sketchup/Tool.rb +808 -0
- data/SketchUp/Sketchup/Tools.rb +120 -0
- data/SketchUp/Sketchup/ToolsObserver.rb +154 -0
- data/SketchUp/Sketchup/UVHelper.rb +61 -0
- data/SketchUp/Sketchup/Vertex.rb +143 -0
- data/SketchUp/Sketchup/View.rb +965 -0
- data/SketchUp/Sketchup/ViewObserver.rb +40 -0
- data/SketchUp/UI/Command.rb +307 -0
- data/SketchUp/UI/HtmlDialog.rb +346 -0
- data/SketchUp/UI/Notification.rb +229 -0
- data/SketchUp/UI/Toolbar.rb +243 -0
- data/SketchUp/UI/WebDialog.rb +623 -0
- data/SketchUp/_top_level.rb +193 -0
- data/SketchUp/array.rb +593 -0
- data/SketchUp/geom.rb +231 -0
- data/SketchUp/languagehandler.rb +92 -0
- data/SketchUp/length.rb +210 -0
- data/SketchUp/numeric.rb +249 -0
- data/SketchUp/sketchup.rb +1290 -0
- data/SketchUp/sketchupextension.rb +355 -0
- data/SketchUp/string.rb +24 -0
- data/SketchUp/ui.rb +637 -0
- metadata +176 -0
@@ -0,0 +1,349 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The Pages class contains methods for manipulating a collection of Pages
|
5
|
+
# (scenes) in a model.
|
6
|
+
#
|
7
|
+
# You get a handle to this collection by calling Model.pages.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# model = Sketchup.active_model
|
11
|
+
# pages = model.pages
|
12
|
+
#
|
13
|
+
# @version SketchUp 6.0
|
14
|
+
class Sketchup::Pages < Sketchup::Entity
|
15
|
+
|
16
|
+
# Includes
|
17
|
+
|
18
|
+
include Enumerable
|
19
|
+
|
20
|
+
# Class Methods
|
21
|
+
|
22
|
+
# The {.add_frame_change_observer} method is used to add a new frame change
|
23
|
+
# observer that is called with each frame of an animation, meaning the
|
24
|
+
# end user has clicked on a Scene tab (aka Page) inside SketchUp and
|
25
|
+
# the camera is animating to that scene.
|
26
|
+
#
|
27
|
+
# The method returns an integer id that can be stored and later used to remove
|
28
|
+
# the observer with the {Sketchup::Pages.remove_frame_change_observer} method.
|
29
|
+
#
|
30
|
+
# @example
|
31
|
+
# class MyFrameChangeObserver
|
32
|
+
# def frameChange(from_page, to_page, percent_done)
|
33
|
+
# puts "From page #{from_page.name} to #{to_page.name} (#{percent_done * 100}%)"
|
34
|
+
# end
|
35
|
+
# end
|
36
|
+
# id = Sketchup::Pages.add_frame_change_observer(MyFrameChangeObserver.new)
|
37
|
+
#
|
38
|
+
# @param [#frameChange] object
|
39
|
+
# An object that implements the
|
40
|
+
# {Sketchup::FrameChangeObserver#frameChange} method.
|
41
|
+
#
|
42
|
+
# @return [Integer] A unique id of the observer
|
43
|
+
#
|
44
|
+
# @see Sketchup::FrameChangeObserver#frameChange
|
45
|
+
#
|
46
|
+
# @version SketchUp 6.0
|
47
|
+
def self.add_frame_change_observer(object)
|
48
|
+
end
|
49
|
+
|
50
|
+
# The #{remove_frame_change_observer} method is used to remove a frame change
|
51
|
+
# observer
|
52
|
+
#
|
53
|
+
# @example
|
54
|
+
# Sketchup::Pages.remove_frame_change_observer(id)
|
55
|
+
#
|
56
|
+
# @param [Integer] observer_id
|
57
|
+
# The unique id returned by {.add_frame_change_observer}
|
58
|
+
#
|
59
|
+
# @return [Boolean]
|
60
|
+
#
|
61
|
+
# @version SketchUp 6.0
|
62
|
+
def self.remove_frame_change_observer(observer_id)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Instance Methods
|
66
|
+
|
67
|
+
# The [] method retrieves a page by either name or index.
|
68
|
+
#
|
69
|
+
# @example
|
70
|
+
# model = Sketchup.active_model
|
71
|
+
# pages = model.pages
|
72
|
+
# status = pages.add "Page 1"
|
73
|
+
# status = pages.add "Page 2"
|
74
|
+
# page = pages["Page 2"]
|
75
|
+
# if (page)
|
76
|
+
# UI.messagebox page
|
77
|
+
# else
|
78
|
+
# UI.messagebox "Failure"
|
79
|
+
# end
|
80
|
+
#
|
81
|
+
# @param index_or_name
|
82
|
+
# The index or the string name of the specific page.
|
83
|
+
#
|
84
|
+
# @return page - a Page object if successful
|
85
|
+
#
|
86
|
+
# @version SketchUp 6.0
|
87
|
+
def [](index_or_name)
|
88
|
+
end
|
89
|
+
|
90
|
+
# The add method is used to add an empty Page object to the collection.
|
91
|
+
#
|
92
|
+
# If no name is given, then a new name is generated using the default name for
|
93
|
+
# new Pages. If a name is given, then a new Page with that name is
|
94
|
+
# added.
|
95
|
+
#
|
96
|
+
# If the flags parameter is given, it controls which properties are saved with
|
97
|
+
# the Page. See the Page.update method for a description of the flags that can
|
98
|
+
# be set.
|
99
|
+
#
|
100
|
+
# If index is given, it specifies the position in the page list that the new
|
101
|
+
# page is added. Otherwise the new page is added to the end.
|
102
|
+
#
|
103
|
+
# @example
|
104
|
+
# model = Sketchup.active_model
|
105
|
+
# pages = model.pages
|
106
|
+
# status = pages.add "Page 1"
|
107
|
+
# status = pages.add "Page 2"
|
108
|
+
# if (status)
|
109
|
+
# UI.messagebox status
|
110
|
+
# else
|
111
|
+
# UI.messagebox "Failure"
|
112
|
+
# end
|
113
|
+
#
|
114
|
+
# @param name
|
115
|
+
# The name of the specific page.
|
116
|
+
#
|
117
|
+
# @param [optional] flags
|
118
|
+
# Bit flags in integer form.
|
119
|
+
#
|
120
|
+
# @param [optional] index
|
121
|
+
# Index of where to inset.
|
122
|
+
#
|
123
|
+
# @return nil
|
124
|
+
#
|
125
|
+
# @version SketchUp 6.0
|
126
|
+
def add(name, flags, index)
|
127
|
+
end
|
128
|
+
|
129
|
+
# The add_matchphoto_page method is used to add a photomatch page to the
|
130
|
+
# model. This is an advanced feature that was added to support internal
|
131
|
+
# SketchUp work, so it is unlikely to be useful to you.
|
132
|
+
#
|
133
|
+
# @example
|
134
|
+
# pages = Sketchup.active_model.pages
|
135
|
+
# page = pages.add_matchphoto_page "Test"
|
136
|
+
#
|
137
|
+
# @param image_name
|
138
|
+
# String image name.
|
139
|
+
#
|
140
|
+
# @param [optional] camera
|
141
|
+
# Camera object.
|
142
|
+
#
|
143
|
+
# @param [optional] page_name
|
144
|
+
# String page name.
|
145
|
+
#
|
146
|
+
# @return page - the new photomatch page.
|
147
|
+
#
|
148
|
+
# @version SketchUp 7.0
|
149
|
+
def add_matchphoto_page(image_name, camera, page_name)
|
150
|
+
end
|
151
|
+
|
152
|
+
# The add_observer method is used to add an observer to the Pages object.
|
153
|
+
# See the PagesObserver interface for more details.
|
154
|
+
#
|
155
|
+
# @example
|
156
|
+
# pages = Sketchup.active_model.pages
|
157
|
+
# status = pages.add_observer observer
|
158
|
+
#
|
159
|
+
# @param observer
|
160
|
+
# An observer.
|
161
|
+
#
|
162
|
+
# @return true if successful, false if unsuccessful.
|
163
|
+
#
|
164
|
+
# @version SketchUp 6.0
|
165
|
+
def add_observer(observer)
|
166
|
+
end
|
167
|
+
|
168
|
+
#
|
169
|
+
# @example
|
170
|
+
# pages = Sketchup.active_model.pages
|
171
|
+
# pages.add('Page 1')
|
172
|
+
# pages.add('Page 2')
|
173
|
+
# number = pages.count
|
174
|
+
#
|
175
|
+
# @note Since SketchUp 2014 the count method is inherited from Ruby's
|
176
|
+
# +Enumable+ mix-in module. Prior to that the {#count} method is an alias
|
177
|
+
# for {#length}.
|
178
|
+
#
|
179
|
+
# @return integer - the number of pages if successful
|
180
|
+
#
|
181
|
+
# @see #length
|
182
|
+
#
|
183
|
+
# @version SketchUp 6.0
|
184
|
+
def count
|
185
|
+
end
|
186
|
+
|
187
|
+
# The each method is used to iterate through pages.
|
188
|
+
#
|
189
|
+
# @example
|
190
|
+
# model = Sketchup.active_model
|
191
|
+
# pages = model.pages
|
192
|
+
# status = pages.add "Page 1"
|
193
|
+
# status = pages.add "Page 2"
|
194
|
+
# pages.each {|page| UI.messagebox page}
|
195
|
+
#
|
196
|
+
# @return nil
|
197
|
+
#
|
198
|
+
# @version SketchUp 6.0
|
199
|
+
#
|
200
|
+
# @yield [page] Variables that will hold each page as it is found.
|
201
|
+
def each
|
202
|
+
end
|
203
|
+
|
204
|
+
# The erase method is used to remove a page from the collection.
|
205
|
+
#
|
206
|
+
# @example
|
207
|
+
# page = Sketchup.active_model.pages.add('Hello World')
|
208
|
+
# Sketchup.active_model.pages.erase(page)
|
209
|
+
#
|
210
|
+
# @param page
|
211
|
+
# The page you wish to delete.
|
212
|
+
#
|
213
|
+
# @return true if successful, false if unsuccessful.
|
214
|
+
#
|
215
|
+
# @version SketchUp 6.0
|
216
|
+
def erase(page)
|
217
|
+
end
|
218
|
+
|
219
|
+
# The {#size} method is used to retrieve the number of pages.
|
220
|
+
#
|
221
|
+
# The {#length} method is an alias for {#size}.
|
222
|
+
#
|
223
|
+
# @example
|
224
|
+
# pages = Sketchup.active_model.pages
|
225
|
+
# pages.add('Page 1')
|
226
|
+
# pages.add('Page 2')
|
227
|
+
# number = pages.size
|
228
|
+
#
|
229
|
+
# @return integer - the number of pages if successful
|
230
|
+
#
|
231
|
+
# @version SketchUp 6.0
|
232
|
+
def length
|
233
|
+
end
|
234
|
+
|
235
|
+
# The parent method is used to determine the model for the Pages collection.
|
236
|
+
#
|
237
|
+
# @example
|
238
|
+
# model = Sketchup.active_model
|
239
|
+
# pages = model.pages
|
240
|
+
# status = pages.add "Page 1"
|
241
|
+
# status = pages.add "Page 2"
|
242
|
+
# model = pages.parent
|
243
|
+
#
|
244
|
+
# @return model - the model that contains the pages if successful
|
245
|
+
#
|
246
|
+
# @version SketchUp 6.0
|
247
|
+
def parent
|
248
|
+
end
|
249
|
+
|
250
|
+
# The remove_observer method is used to remove an observer from the current
|
251
|
+
# object. See the PagesObserver interface for more details.
|
252
|
+
#
|
253
|
+
# @example
|
254
|
+
# pages = Sketchup.active_model.pages
|
255
|
+
# status = pages.remove_observer observer
|
256
|
+
#
|
257
|
+
# @param observer
|
258
|
+
# An observer.
|
259
|
+
#
|
260
|
+
# @return true if successful, false if unsuccessful.
|
261
|
+
#
|
262
|
+
# @version SketchUp 6.0
|
263
|
+
def remove_observer(observer)
|
264
|
+
end
|
265
|
+
|
266
|
+
# The selected_page method is used to retrieve the currently selected page.
|
267
|
+
#
|
268
|
+
# @example
|
269
|
+
# model = Sketchup.active_model
|
270
|
+
# pages = model.pages
|
271
|
+
# status = pages.add "Page 1"
|
272
|
+
# status = pages.add "Page 2"
|
273
|
+
# page = pages.selected_page
|
274
|
+
#
|
275
|
+
# @return page - the currently selected Page object if successful
|
276
|
+
#
|
277
|
+
# @version SketchUp 6.0
|
278
|
+
def selected_page
|
279
|
+
end
|
280
|
+
|
281
|
+
# The selected_page method is used to set the currently selected page. Once
|
282
|
+
# you set this, SketchUp will animate to that page as if the user had clicked
|
283
|
+
# on its scene tab.
|
284
|
+
#
|
285
|
+
# @example
|
286
|
+
# model = Sketchup.active_model
|
287
|
+
# pages = model.pages
|
288
|
+
# status = pages.add "Page 1"
|
289
|
+
# status = pages.add "Page 2"
|
290
|
+
# pages.selected_page = model.pages[1]
|
291
|
+
#
|
292
|
+
# @param [Sketchup::Page] page
|
293
|
+
#
|
294
|
+
# @return status - true if successful
|
295
|
+
#
|
296
|
+
# @version SketchUp 6.0
|
297
|
+
def selected_page=(page)
|
298
|
+
end
|
299
|
+
|
300
|
+
# The show_frame_at method is used to show a frame in animation (of the slide
|
301
|
+
# show) at a given time in seconds.
|
302
|
+
#
|
303
|
+
# @example
|
304
|
+
# model = Sketchup.active_model
|
305
|
+
# pages = model.pages
|
306
|
+
# status = pages.add "Page 1"
|
307
|
+
# status = pages.add "Page 2"
|
308
|
+
# status = pages.show_frame_at 10
|
309
|
+
#
|
310
|
+
# @param seconds
|
311
|
+
# The time in seconds.
|
312
|
+
#
|
313
|
+
# @return nil
|
314
|
+
#
|
315
|
+
# @version SketchUp 6.0
|
316
|
+
def show_frame_at(seconds)
|
317
|
+
end
|
318
|
+
|
319
|
+
# The {#size} method is used to retrieve the number of pages.
|
320
|
+
#
|
321
|
+
# The {#length} method is an alias for {#size}.
|
322
|
+
#
|
323
|
+
# @example
|
324
|
+
# pages = Sketchup.active_model.pages
|
325
|
+
# pages.add('Page 1')
|
326
|
+
# pages.add('Page 2')
|
327
|
+
# number = pages.size
|
328
|
+
#
|
329
|
+
# @return integer - the number of pages if successful
|
330
|
+
#
|
331
|
+
# @version SketchUp 6.0
|
332
|
+
def size
|
333
|
+
end
|
334
|
+
|
335
|
+
# The slideshow_time method is used to get the amount of time that a slideshow
|
336
|
+
# of all of the pages will take. This takes into account the transition time
|
337
|
+
# for each Page and the amount of time that each Page is displayed.
|
338
|
+
#
|
339
|
+
# @example
|
340
|
+
# pages = Sketchup.active_model.pages
|
341
|
+
# time = pages.slideshow_time
|
342
|
+
#
|
343
|
+
# @return status - true if successful
|
344
|
+
#
|
345
|
+
# @version SketchUp 6.0
|
346
|
+
def slideshow_time
|
347
|
+
end
|
348
|
+
|
349
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# This observer interface is implemented to react to pages events. To
|
5
|
+
# implement this observer, create a Ruby class of this type, override the
|
6
|
+
# desired methods, and add an instance of the observer to the objects of
|
7
|
+
# interests.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# # This is an example of an observer that watches the pages for new ones.
|
11
|
+
# class MyPagesObserver < Sketchup::PagesObserver
|
12
|
+
# def onElementAdded(pages, page)
|
13
|
+
# puts "onElementAdded: #{page}"
|
14
|
+
# end
|
15
|
+
# end
|
16
|
+
#
|
17
|
+
# # Attach the observer.
|
18
|
+
# Sketchup.active_model.pages.add_observer(MyPagesObserver.new)
|
19
|
+
#
|
20
|
+
# @version SketchUp 6.0
|
21
|
+
class Sketchup::PagesObserver < Sketchup::EntitiesObserver
|
22
|
+
|
23
|
+
# Instance Methods
|
24
|
+
|
25
|
+
# The {#onContentsModified} method is invoked whenever the pages change.
|
26
|
+
#
|
27
|
+
# @example
|
28
|
+
# def onContentsModified(pages)
|
29
|
+
# puts "onContentsModified: #{pages}"
|
30
|
+
# end
|
31
|
+
#
|
32
|
+
# @param [Sketchup::Pages] pages
|
33
|
+
#
|
34
|
+
# @return [nil]
|
35
|
+
#
|
36
|
+
# @version SketchUp 6.0
|
37
|
+
def onContentsModified(pages)
|
38
|
+
end
|
39
|
+
|
40
|
+
# The {#onElementAdded} method is invoked when an element is added to a
|
41
|
+
# {Sketchup::Pages} object.
|
42
|
+
#
|
43
|
+
# @example
|
44
|
+
# def onElementAdded(pages, page)
|
45
|
+
# puts "onElementAdded: #{page}"
|
46
|
+
# end
|
47
|
+
#
|
48
|
+
# @param [Sketchup::Pages] pages
|
49
|
+
#
|
50
|
+
# @param [Sketchup::Page] page
|
51
|
+
#
|
52
|
+
# @return [nil]
|
53
|
+
#
|
54
|
+
# @version SketchUp 6.0
|
55
|
+
def onElementAdded(pages, page)
|
56
|
+
end
|
57
|
+
|
58
|
+
# The {#onElementRemoved} method is invoked when an element is removed from a
|
59
|
+
# {Sketchup::Pages} object.
|
60
|
+
#
|
61
|
+
# @example
|
62
|
+
# def onElementRemoved(pages, page)
|
63
|
+
# puts "onElementRemoved: #{page}"
|
64
|
+
# end
|
65
|
+
#
|
66
|
+
# @param [Sketchup::Pages] pages
|
67
|
+
#
|
68
|
+
# @param [Sketchup::Page] page
|
69
|
+
#
|
70
|
+
# @return [nil]
|
71
|
+
#
|
72
|
+
# @version SketchUp 6.0
|
73
|
+
def onElementRemoved(pages, page)
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
@@ -0,0 +1,457 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The PickHelper class is used to pick entities that reside under the current
|
5
|
+
# cursor location. PickHelper and InputPoint are similar, but InputPoint also
|
6
|
+
# uses inferencing. You can retrieve a PickHelper object using the pick_helper
|
7
|
+
# method on a View object.
|
8
|
+
#
|
9
|
+
# Entities that are picked (found under the
|
10
|
+
# cursor when a mouse or keyboard event occurs), are called Pick Records and
|
11
|
+
# are placed in an indexed list.
|
12
|
+
#
|
13
|
+
# @version SketchUp 6.0
|
14
|
+
class Sketchup::PickHelper
|
15
|
+
|
16
|
+
# Constants
|
17
|
+
|
18
|
+
PICK_CROSSING = nil # Stub value.
|
19
|
+
PICK_INSIDE = nil # Stub value.
|
20
|
+
|
21
|
+
# Instance Methods
|
22
|
+
|
23
|
+
# The all_picked method is used to get an array of entities from the
|
24
|
+
# active entities from all the pick paths. Duplicates might occur if
|
25
|
+
# there are multiple pick paths for entities that ends in a group or
|
26
|
+
# component.
|
27
|
+
#
|
28
|
+
# For example, if the pick hits at the border of an edge and face
|
29
|
+
# inside a group there will be two pick paths - one for the face and
|
30
|
+
# one for the edge. Since this method returns entities from the active
|
31
|
+
# entities it would return an array with the group two times.
|
32
|
+
#
|
33
|
+
# @example
|
34
|
+
# ph = view.pick_helper
|
35
|
+
# ph.do_pick(x, y)
|
36
|
+
# entities = ph.all_picked
|
37
|
+
#
|
38
|
+
# @return elements - the array of elements in the pick.
|
39
|
+
#
|
40
|
+
# @version SketchUp 6.0
|
41
|
+
def all_picked
|
42
|
+
end
|
43
|
+
|
44
|
+
# The best_picked method is used to retrieve the "best" entity picked (entity
|
45
|
+
# that you would have picked if you were using the select tool).
|
46
|
+
#
|
47
|
+
# Returns nil if nothing was picked. You must have called do_pick
|
48
|
+
# before calling this method.
|
49
|
+
#
|
50
|
+
# @example
|
51
|
+
# ph = view.pick_helper
|
52
|
+
# ph.do_pick(x, y)
|
53
|
+
# best_entity = ph.best_picked
|
54
|
+
#
|
55
|
+
# @return entity - the best picked entity
|
56
|
+
#
|
57
|
+
# @version SketchUp 6.0
|
58
|
+
def best_picked
|
59
|
+
end
|
60
|
+
|
61
|
+
# Used to pick a set of entities from a model from a BoundingBox. The pick
|
62
|
+
# criteria can be for completely-contained or partially-contained entities,
|
63
|
+
# similar to how the Selection tool works.
|
64
|
+
#
|
65
|
+
# @example
|
66
|
+
# boundingbox = Geom::BoundingBox.new
|
67
|
+
# boundingbox.add([1, 1, 1], [100, 100, 100])
|
68
|
+
# ph = Sketchup.active_model.active_view.pick_helper
|
69
|
+
#
|
70
|
+
# # Rotate the box 45' around the z-axis
|
71
|
+
# angle = 45
|
72
|
+
# transformation = Geom::Transformation.new(ORIGIN, Z_AXIS, angle)
|
73
|
+
#
|
74
|
+
# num_picked = ph.boundingbox_pick(boundingbox, Sketchup::PickHelper::PICK_CROSSING, transformation)
|
75
|
+
# if num_picked > 0
|
76
|
+
# Sketchup.active_model.selection.add(ph.all_picked)
|
77
|
+
# end
|
78
|
+
#
|
79
|
+
# @param bounding_box
|
80
|
+
# BoundingBox object defining the volume to use for picking
|
81
|
+
#
|
82
|
+
# @param pick_type
|
83
|
+
# PICK_INSIDE to select entities completely contained or
|
84
|
+
# PICK_CROSSING to select entities partially contained.
|
85
|
+
#
|
86
|
+
# @param [optional] transformation
|
87
|
+
# Transformation that will be applied to the
|
88
|
+
# volume defined by the BoundingBox that allows for a
|
89
|
+
# rotation.
|
90
|
+
#
|
91
|
+
# @return The number of Entity objects picked
|
92
|
+
#
|
93
|
+
# @version SketchUp 2016
|
94
|
+
def boundingbox_pick(bounding_box, pick_type, transformation = IDENTITY)
|
95
|
+
end
|
96
|
+
|
97
|
+
# The count method is used to count the number of entities picked (number of
|
98
|
+
# pick records)
|
99
|
+
#
|
100
|
+
# @example
|
101
|
+
# number = pickhelper.count
|
102
|
+
#
|
103
|
+
# @return number - the number of entities picked
|
104
|
+
#
|
105
|
+
# @version SketchUp 6.0
|
106
|
+
def count
|
107
|
+
end
|
108
|
+
|
109
|
+
# The depth_at method retrieves the depth of one of the currently picked
|
110
|
+
# entities in the list of pick records.
|
111
|
+
#
|
112
|
+
# @example
|
113
|
+
# ph = view.pick_helper
|
114
|
+
# ph.do_pick(x, y)
|
115
|
+
# # Iterate all pick-routes:
|
116
|
+
# pickhelper.count.times { |pick_path_index|
|
117
|
+
# puts pickhelper.depth_at(pick_path_index)
|
118
|
+
# }
|
119
|
+
#
|
120
|
+
# @param index
|
121
|
+
# A number from 0 to number of items picked minus one.
|
122
|
+
#
|
123
|
+
# @return integer - the depth of the entity if successful
|
124
|
+
#
|
125
|
+
# @version SketchUp 6.0
|
126
|
+
def depth_at(index)
|
127
|
+
end
|
128
|
+
|
129
|
+
# The do_pick method is used to perform the initial pick. This method is
|
130
|
+
# generally called before any other methods in the PickHelper class.
|
131
|
+
#
|
132
|
+
# Returns the number of entities picked. The x and y values are the screen
|
133
|
+
# coordinates of the point at which would want to do a pick.
|
134
|
+
#
|
135
|
+
# @example
|
136
|
+
# ph = view.pick_helpernum = ph.do_pick(x, y)
|
137
|
+
#
|
138
|
+
# @param x
|
139
|
+
# X screen coordinate for the pick.
|
140
|
+
#
|
141
|
+
# @param y
|
142
|
+
# Y screen coordinate for the pick.
|
143
|
+
#
|
144
|
+
# @param aperture
|
145
|
+
# The size of the pick-aperture.
|
146
|
+
#
|
147
|
+
# @return Integer - The number of Entity objects picked
|
148
|
+
#
|
149
|
+
# @version SketchUp 6.0
|
150
|
+
def do_pick(x, y, aperture = 0)
|
151
|
+
end
|
152
|
+
|
153
|
+
# The element_at method is used to retrieve a specific entity in the list of
|
154
|
+
# picked elements. This element will be from the active entities.
|
155
|
+
#
|
156
|
+
# Use count() to get the number of possible pick paths.
|
157
|
+
#
|
158
|
+
# @example
|
159
|
+
# ph = view.pick_helper
|
160
|
+
# ph.do_pick(x, y)
|
161
|
+
# # Iterate all pick-routes:
|
162
|
+
# pickhelper.count.times { |pick_path_index|
|
163
|
+
# puts pickhelper.element_at(pick_path_index)
|
164
|
+
# }
|
165
|
+
# # You would iterate the same elements in all_picked.
|
166
|
+
#
|
167
|
+
# @param index
|
168
|
+
# A number from 0 to number of items picked minus one.
|
169
|
+
#
|
170
|
+
# @return entity - the entity at the index position in the list
|
171
|
+
# of picked entities.
|
172
|
+
#
|
173
|
+
# @version SketchUp 6.0
|
174
|
+
def element_at(index)
|
175
|
+
end
|
176
|
+
|
177
|
+
# The init method is used to initialize the PickHelper for testing points.
|
178
|
+
#
|
179
|
+
# You do not normally need to call this method, but you can use this if you
|
180
|
+
# want to call test_point or pick_segment on a lot of points.
|
181
|
+
#
|
182
|
+
# If the optional aperture is given, it is given in pixels.
|
183
|
+
#
|
184
|
+
# @example
|
185
|
+
# ph = view.pick_helper
|
186
|
+
# ph.init(x, y, 5)
|
187
|
+
# # Find all points picked by the screen click.
|
188
|
+
# selected = points.select { |point|
|
189
|
+
# ph.test_point(point)
|
190
|
+
# }
|
191
|
+
#
|
192
|
+
# @param x
|
193
|
+
# X screen coordinate for the pick.
|
194
|
+
#
|
195
|
+
# @param y
|
196
|
+
# Y screen coordinate for the pick.
|
197
|
+
#
|
198
|
+
# @param [optional] aperture
|
199
|
+
# aperture in pixels.
|
200
|
+
#
|
201
|
+
# @return p - the (receiver) PickHelper Object
|
202
|
+
#
|
203
|
+
# @version SketchUp 6.0
|
204
|
+
def init(x, y, aperture = 0)
|
205
|
+
end
|
206
|
+
|
207
|
+
# The leaf_at method retrieves the deepest thing in a pick path.
|
208
|
+
#
|
209
|
+
# For example, if you have a face that is within a component that is within
|
210
|
+
# another component, leaf_at returns the face.
|
211
|
+
#
|
212
|
+
# Use count() to get the number of possible pick paths.
|
213
|
+
#
|
214
|
+
# @example
|
215
|
+
# ph = view.pick_helper
|
216
|
+
# ph.do_pick(x, y)
|
217
|
+
# # Iterate all pick-routes:
|
218
|
+
# pickhelper.count.times { |pick_path_index|
|
219
|
+
# p pickhelper.leaf_at(pick_path_index)
|
220
|
+
# }
|
221
|
+
#
|
222
|
+
# @param index
|
223
|
+
# A number from 0 to number of items picked minus one.
|
224
|
+
#
|
225
|
+
# @return entity - the leaf entity
|
226
|
+
#
|
227
|
+
# @version SketchUp 6.0
|
228
|
+
def leaf_at(index)
|
229
|
+
end
|
230
|
+
|
231
|
+
# The path_at method is used to retrieve the entire path for an entity in the
|
232
|
+
# pick list (as an array).
|
233
|
+
#
|
234
|
+
# If one of the pick paths end in a face nested in a group nested in a
|
235
|
+
# component this method will return an array of these entities. The Group
|
236
|
+
# will be first and the face will be last.
|
237
|
+
#
|
238
|
+
# The first item in the array will be from the active entities and the last
|
239
|
+
# item will be a drawing element that is not a group, component or image.
|
240
|
+
#
|
241
|
+
# @example
|
242
|
+
# ph = view.pick_helper
|
243
|
+
# ph.do_pick(x, y)
|
244
|
+
# # Iterate all pick-routes:
|
245
|
+
# pickhelper.count.times { |pick_path_index|
|
246
|
+
# p pickhelper.path_at(pick_path_index)
|
247
|
+
# }
|
248
|
+
#
|
249
|
+
# @param index
|
250
|
+
# A number from 0 to number of items picked minus one.
|
251
|
+
#
|
252
|
+
# @return array - an array of entities including the leaf
|
253
|
+
#
|
254
|
+
# @version SketchUp 6.0
|
255
|
+
def path_at(index)
|
256
|
+
end
|
257
|
+
|
258
|
+
# The pick_segment method is used to pick a segment of a polyline curve that
|
259
|
+
# is defined by an array of points.
|
260
|
+
#
|
261
|
+
# If you click on a point in a polyline curve, the index of
|
262
|
+
# the point in the curve is returned (starting at 0). If you click on a
|
263
|
+
# segment in the polyline curve, the index of the segment is returned.
|
264
|
+
# Segments start at index -1 (for the segment connecting the first two points)
|
265
|
+
# and increase by a factor of -1 (for example, the segment connecting second
|
266
|
+
# and third point is -2).
|
267
|
+
#
|
268
|
+
# There is no need to invoke do_pick for this and the results are unrelated.
|
269
|
+
#
|
270
|
+
# @example
|
271
|
+
# point1 = Geom::Point3d.new(0 ,0, 0)
|
272
|
+
# point2 = Geom::Point3d.new(10, 0, 0)
|
273
|
+
# segment = [point1, point2]
|
274
|
+
# ph = view.pick_helper
|
275
|
+
# # If testing many points this is the fastest way to test.
|
276
|
+
# ph.init(x, y)
|
277
|
+
# picked = ph.pick_segment(segment)
|
278
|
+
# # This do not require init(
|
279
|
+
# picked = ph.pick_segment(segment, x, y)
|
280
|
+
#
|
281
|
+
# @param array_or_list
|
282
|
+
# A series of Point3d objects in the polyline as a list
|
283
|
+
# of parameters or an array containing Point3d objects.
|
284
|
+
#
|
285
|
+
# @param [optional] x
|
286
|
+
# screen mouse position in pixels.
|
287
|
+
#
|
288
|
+
# @param [optional but requires x and y] aperture
|
289
|
+
# aperture in pixels.
|
290
|
+
#
|
291
|
+
# @param [optional(required if x given)] y
|
292
|
+
# screen mouse position
|
293
|
+
# in pixels.
|
294
|
+
#
|
295
|
+
# @return index - an index of the point in the array if you
|
296
|
+
# clicked on a point or an index of a segment if you
|
297
|
+
# clicked on a segment (if successful)
|
298
|
+
#
|
299
|
+
# @version SketchUp 6.0
|
300
|
+
def pick_segment(array_or_list, x, y, aperture = 0)
|
301
|
+
end
|
302
|
+
|
303
|
+
# The picked_edge method is used to retrieve the "best" Edge picked.
|
304
|
+
#
|
305
|
+
# Returns nil if there were no edges picked. You must have called do_pick
|
306
|
+
# before calling this method.
|
307
|
+
#
|
308
|
+
# @example
|
309
|
+
# ph = view.pick_helper
|
310
|
+
# ph.do_pick(x, y)
|
311
|
+
# edge = ph.picked_edge
|
312
|
+
#
|
313
|
+
# @return edge - an Edge object if successful
|
314
|
+
#
|
315
|
+
# @version SketchUp 6.0
|
316
|
+
def picked_edge
|
317
|
+
end
|
318
|
+
|
319
|
+
# The picked_element method retrieves the best drawing element, that is not an
|
320
|
+
# edge or a face, picked.
|
321
|
+
#
|
322
|
+
# Returns nil if nothing was picked. You must have called do_pick
|
323
|
+
# before calling this method.
|
324
|
+
#
|
325
|
+
# @example
|
326
|
+
# ph = view.pick_helper
|
327
|
+
# ph.do_pick(x, y)
|
328
|
+
# entity = ph.picked_element
|
329
|
+
#
|
330
|
+
# @param index
|
331
|
+
#
|
332
|
+
# @return element - a drawing element that is not an edge or face
|
333
|
+
# if successful
|
334
|
+
#
|
335
|
+
# @version SketchUp 6.0
|
336
|
+
def picked_element(index)
|
337
|
+
end
|
338
|
+
|
339
|
+
# The picked_face method is used to retrieve the best face picked.
|
340
|
+
#
|
341
|
+
# Returns nil if there were no faces picked. You must have called do_pick
|
342
|
+
# before calling this method.
|
343
|
+
#
|
344
|
+
# @example
|
345
|
+
# ph = view.pick_helper
|
346
|
+
# ph.do_pick(x, y)
|
347
|
+
# face = ph.picked_face
|
348
|
+
#
|
349
|
+
# @return face - a Face object if successful
|
350
|
+
#
|
351
|
+
# @version SketchUp 6.0
|
352
|
+
def picked_face
|
353
|
+
end
|
354
|
+
|
355
|
+
# The test_point method is used to test a point to see if it would be selected
|
356
|
+
# using the default or given pick aperture.
|
357
|
+
#
|
358
|
+
# In the first form, you must have initialized the PickHelper using the init
|
359
|
+
# method. This is more efficient if you want to test a lot of points using the
|
360
|
+
# same screen point.
|
361
|
+
#
|
362
|
+
# In the second and third forms, it initializes the
|
363
|
+
# PickHelper using a screen point and an optional pick aperture that you pass
|
364
|
+
# in as the 2nd-4th arguments.
|
365
|
+
#
|
366
|
+
# There is no need to invoke do_pick for this and the results are unrelated.
|
367
|
+
#
|
368
|
+
# @example
|
369
|
+
# ph = view.pick_helper
|
370
|
+
# # If testing many points this is the fastest way to test.
|
371
|
+
# ph.init(x, y)
|
372
|
+
# picked = ph.test_point(point)
|
373
|
+
# # These do not require init()
|
374
|
+
# picked = ph.test_point(point, x, y)
|
375
|
+
# picked = ph.test_point(point, x, y, aperture)
|
376
|
+
#
|
377
|
+
# @param point
|
378
|
+
# Screen point.
|
379
|
+
#
|
380
|
+
# @param [optional] x
|
381
|
+
# x position of pick.
|
382
|
+
#
|
383
|
+
# @param [optional] aperture
|
384
|
+
# aperture in pixels.
|
385
|
+
#
|
386
|
+
# @param [optional] y
|
387
|
+
# y position of pick.
|
388
|
+
#
|
389
|
+
# @return would_be_selected - true or false
|
390
|
+
#
|
391
|
+
# @version SketchUp 6.0
|
392
|
+
def test_point(point, x, y, aperture = 0)
|
393
|
+
end
|
394
|
+
|
395
|
+
# The transformation_at method is used to get a transformation at a specific
|
396
|
+
# pick path index in the pick helper.
|
397
|
+
#
|
398
|
+
# The transformation combines the transformation of all groups, components and
|
399
|
+
# images in the pick path. This transformation can be used to transform the
|
400
|
+
# coordinates of the leaf entity into the coordinates of the active entities.
|
401
|
+
#
|
402
|
+
# @example
|
403
|
+
# ph = view.pick_helper
|
404
|
+
# ph.do_pick(x, y)
|
405
|
+
# # Iterate all pick-routes:
|
406
|
+
# pickhelper.count.times { |pick_path_index|
|
407
|
+
# puts pickhelper.transformation_at(pick_path_index)
|
408
|
+
# }
|
409
|
+
#
|
410
|
+
# @param index
|
411
|
+
# The index where the transformation should be retrieved.
|
412
|
+
#
|
413
|
+
# @return transformation - the transformation found
|
414
|
+
#
|
415
|
+
# @version SketchUp 6.0
|
416
|
+
def transformation_at(index)
|
417
|
+
end
|
418
|
+
|
419
|
+
# The view method is used to get the view associated with the PickHelper.
|
420
|
+
#
|
421
|
+
# @example
|
422
|
+
# view = pickhelper.view
|
423
|
+
#
|
424
|
+
# @return view - the associated view
|
425
|
+
#
|
426
|
+
# @version SketchUp 6.0
|
427
|
+
def view
|
428
|
+
end
|
429
|
+
|
430
|
+
# Used to pick a set of entities from a model based on a screen coordinate
|
431
|
+
# rectangular area defined by two points. The pick criteria can be for
|
432
|
+
# completely-contained or partially-contained entities, similar to how
|
433
|
+
# the Selection tool works. The z value of the points passed in are ignored.
|
434
|
+
#
|
435
|
+
# @example
|
436
|
+
# ph = Sketchup.active_model.active_view.pick_helper
|
437
|
+
# start_point = Geom::Point3d.new(100, 100, 0)
|
438
|
+
# end_point = Geom::Point3d.new(500, 500, 0)
|
439
|
+
# num_picked = ph.window_pick(start_point, end_point, Sketchup::PickHelper::PICK_CROSSING)
|
440
|
+
#
|
441
|
+
# @param start_point
|
442
|
+
# First screen coordinate point.
|
443
|
+
#
|
444
|
+
# @param end_point
|
445
|
+
# Second screen coordinate point.
|
446
|
+
#
|
447
|
+
# @param pick_type
|
448
|
+
# PICK_INSIDE to select entities completely contained or
|
449
|
+
# PICK_CROSSING to select entities partially contained.
|
450
|
+
#
|
451
|
+
# @return The number of Entity objects picked
|
452
|
+
#
|
453
|
+
# @version SketchUp 2016
|
454
|
+
def window_pick(start_point, end_point, pick_type)
|
455
|
+
end
|
456
|
+
|
457
|
+
end
|