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,355 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The SketchupExtension class contains methods allowing you to create and
|
5
|
+
# manipulate SketchUp extensions. Extensions are Ruby scripts that can be
|
6
|
+
# loaded and unloaded using the Extension manager (Extensions panel of the
|
7
|
+
# Preferences dialog box). Generally you should register your ruby scripts as
|
8
|
+
# an extension to give SketchUp users the ability to disable it through the
|
9
|
+
# user interface.
|
10
|
+
#
|
11
|
+
# The idea here is to take the ruby script that actually creates your
|
12
|
+
# functionality and place it in a folder somewhere outside of the /Plugins
|
13
|
+
# folder, most commonly a subdirectory like /Plugins/MyExtension. Then
|
14
|
+
# you create a new ruby script inside the /Plugins directory that will
|
15
|
+
# set up the extension entry and load your original script if the user
|
16
|
+
# has your extension turned on.
|
17
|
+
#
|
18
|
+
# Here is an example extension loading script. For this example, the
|
19
|
+
# following code would be saved in /Plugins/StairTools.rb, and the
|
20
|
+
# actual plugin itself would live in /Plugins/StairTools/core.rb.
|
21
|
+
#
|
22
|
+
# You can find two example extensions that ship with SketchUp,
|
23
|
+
# su_dynamiccomponents.rb and su_sandboxtools.rb, under the /Plugins/ folder.
|
24
|
+
#
|
25
|
+
# @example
|
26
|
+
# # Create an entry in the Extension list that loads a script called
|
27
|
+
# # core.rb.
|
28
|
+
# require 'sketchup.rb'
|
29
|
+
# require 'extensions.rb'
|
30
|
+
#
|
31
|
+
# stair_extension = SketchupExtension.new('Stair Tools", "StairTools/core.rb')
|
32
|
+
# stair_extension.version = '1.0'
|
33
|
+
# stair_extension.description = 'Tools to draw stairs automatically.'
|
34
|
+
# Sketchup.register_extension(stair_extension, true)
|
35
|
+
#
|
36
|
+
# @version SketchUp 6.0
|
37
|
+
class SketchupExtension
|
38
|
+
|
39
|
+
# Instance Methods
|
40
|
+
|
41
|
+
# Loads the extension, meaning the underlying ruby script is immediately
|
42
|
+
# interpreted. This is the equivalent of checking the extension's checkbox
|
43
|
+
# in the Preferences > Extensions list.
|
44
|
+
#
|
45
|
+
# @example
|
46
|
+
# # This will register the extension, a necessary step for it to appear
|
47
|
+
# # in SketchUp's Preferences > Extensions list
|
48
|
+
# ext_c = SketchupExtension.new('Stair Tools C', 'StairTools/core.rb')
|
49
|
+
# Sketchup.register_extension(ext_c, false)
|
50
|
+
#
|
51
|
+
# # And this will load the extension.
|
52
|
+
# ext_c.check
|
53
|
+
#
|
54
|
+
# @return boolean - whether the load succeeded
|
55
|
+
#
|
56
|
+
# @version SketchUp 8.0 M2
|
57
|
+
def check
|
58
|
+
end
|
59
|
+
|
60
|
+
# The copyright method returns the copyright string which appears beneath
|
61
|
+
# an extension inside the Extensions Manager dialog.
|
62
|
+
#
|
63
|
+
# @example
|
64
|
+
# # Create an entry in the Extension list that loads a script called
|
65
|
+
# # core.rb.
|
66
|
+
# extension = SketchupExtension.new('Stair Tools', 'StairTools/core.rb')
|
67
|
+
# extension.copyright = '2008'
|
68
|
+
# copyright = extension.copyright
|
69
|
+
#
|
70
|
+
# @return copyright - the Extension copyright
|
71
|
+
#
|
72
|
+
# @version SketchUp 6.0
|
73
|
+
def copyright
|
74
|
+
end
|
75
|
+
|
76
|
+
# The copyright= method sets the copyright string which appears beneath
|
77
|
+
# an extension inside the Extensions Manager dialog.
|
78
|
+
#
|
79
|
+
# @example
|
80
|
+
# # Create an entry in the Extension list that loads a script called
|
81
|
+
# # core.rb.
|
82
|
+
# extension = SketchupExtension.new('Stair Tools', 'StairTools/core.rb')
|
83
|
+
# extension.copyright = '2008'
|
84
|
+
# copyright = extension.copyright
|
85
|
+
#
|
86
|
+
# @param copyright
|
87
|
+
# The copyright to set
|
88
|
+
#
|
89
|
+
# @return copyright - the new copyright
|
90
|
+
#
|
91
|
+
# @version SketchUp 6.0
|
92
|
+
def copyright=(copyright)
|
93
|
+
end
|
94
|
+
|
95
|
+
# The creator method returns the creator string which appears beneath
|
96
|
+
# an extension inside the Extensions Manager dialog.
|
97
|
+
#
|
98
|
+
# @example
|
99
|
+
# # Create an entry in the Extension list that loads a script called
|
100
|
+
# # core.rb.
|
101
|
+
# extension = SketchupExtension.new('Stair Tools', 'StairTools/core.rb')
|
102
|
+
# extension.creator = 'Trimble Navigation, Inc.'
|
103
|
+
# creator = extension.creator
|
104
|
+
#
|
105
|
+
# @return creator - the Extension creator
|
106
|
+
#
|
107
|
+
# @version SketchUp 6.0
|
108
|
+
def creator
|
109
|
+
end
|
110
|
+
|
111
|
+
# The creator= method sets the creator string which appears beneath
|
112
|
+
# an extension inside the Extensions Manager dialog.
|
113
|
+
#
|
114
|
+
# @example
|
115
|
+
# # Create an entry in the Extension list that loads a script called
|
116
|
+
# # core.rb.
|
117
|
+
# extension = SketchupExtension.new('Stair Tools', 'StairTools/core.rb')
|
118
|
+
# extension.creator = 'Trimble Navigation, Inc.'
|
119
|
+
# creator = extension.creator
|
120
|
+
#
|
121
|
+
# @param creator
|
122
|
+
# The creator to set
|
123
|
+
#
|
124
|
+
# @return creator - the new creator
|
125
|
+
#
|
126
|
+
# @version SketchUp 6.0
|
127
|
+
def creator=(creator)
|
128
|
+
end
|
129
|
+
|
130
|
+
# The description method returns the long description which appears beneath
|
131
|
+
# an extension inside the Extensions Manager dialog.
|
132
|
+
#
|
133
|
+
# @example
|
134
|
+
# # Create an entry in the Extension list that loads a script called
|
135
|
+
# # core.rb.
|
136
|
+
# extension = SketchupExtension.new('Stair Tools', 'StairTools/core.rb')
|
137
|
+
# extension.description = 'My description.'
|
138
|
+
# description = extension.description
|
139
|
+
#
|
140
|
+
# @return description - the Extension description
|
141
|
+
#
|
142
|
+
# @version SketchUp 6.0
|
143
|
+
def description
|
144
|
+
end
|
145
|
+
|
146
|
+
# The description= method sets the long description which appears beneath
|
147
|
+
# an extension inside the Extensions Manager dialog.
|
148
|
+
#
|
149
|
+
# @example
|
150
|
+
# # Create an entry in the Extension list that loads a script called
|
151
|
+
# # core.rb.
|
152
|
+
# extension = SketchupExtension.new('Stair Tools', 'StairTools/core.rb')
|
153
|
+
# extension.description = 'My description.'
|
154
|
+
# description = extension.description
|
155
|
+
#
|
156
|
+
# @param description
|
157
|
+
# The description string to set.
|
158
|
+
#
|
159
|
+
# @return description - the Extension description
|
160
|
+
#
|
161
|
+
# @version SketchUp 6.0
|
162
|
+
def description=(description)
|
163
|
+
end
|
164
|
+
|
165
|
+
# The extension_path method returns the file system path to the extension's
|
166
|
+
# outer rb file.
|
167
|
+
#
|
168
|
+
# @return extension_path - the file system path to the extension
|
169
|
+
#
|
170
|
+
# @version SketchUp 2013
|
171
|
+
def extension_path
|
172
|
+
end
|
173
|
+
|
174
|
+
# The id method returns the Extension Warehouse ID string.
|
175
|
+
#
|
176
|
+
# @return id - the Extension Warehouse ID
|
177
|
+
#
|
178
|
+
# @version SketchUp 2013
|
179
|
+
def id
|
180
|
+
end
|
181
|
+
|
182
|
+
# The new method is used to create a new SketchupExtension object. Note
|
183
|
+
# that once the extension object is created, it will not appear in the
|
184
|
+
# Extension Manager dialog until your register it with the
|
185
|
+
# Sketchup.register_extension method.
|
186
|
+
#
|
187
|
+
# @example
|
188
|
+
# # Create an entry in the Extension list that loads a script called
|
189
|
+
# # core.rb.
|
190
|
+
# extension = SketchupExtension.new('Stair Tools', 'StairTools/core.rb')
|
191
|
+
#
|
192
|
+
# # Then be sure to register it. By passing a 2nd param of true, you're
|
193
|
+
# # telling SketchUp to load the extension by default.
|
194
|
+
# Sketchup.register_extension(extension, true)
|
195
|
+
#
|
196
|
+
# @param title
|
197
|
+
# The name of the extension
|
198
|
+
#
|
199
|
+
# @param path
|
200
|
+
# The relative path to the script that loads your
|
201
|
+
# plugin.
|
202
|
+
#
|
203
|
+
# @return extension - the new Extension object
|
204
|
+
#
|
205
|
+
# @version SketchUp 6.0
|
206
|
+
def initialize(title, path)
|
207
|
+
end
|
208
|
+
|
209
|
+
# Returns whether the extension is set to load when SketchUp starts up.
|
210
|
+
#
|
211
|
+
# @example
|
212
|
+
# ext = SketchupExtension.new('Stair Tools', 'StairTools/core.rb')
|
213
|
+
# UI.messagebox("load_on_start? is false: #{ext.load_on_start?.to_s}")
|
214
|
+
# Sketchup.register_extension(ext, true)
|
215
|
+
# UI.messagebox("load_on_start? is now true: #{ext.load_on_start?.to_s}")
|
216
|
+
#
|
217
|
+
# @return boolean - true if the extension loads on startup.
|
218
|
+
#
|
219
|
+
# @return [Boolean]
|
220
|
+
#
|
221
|
+
# @version SketchUp 8.0 M2
|
222
|
+
def load_on_start?
|
223
|
+
end
|
224
|
+
|
225
|
+
# Returns whether the extension is currently loaded, meaning the actual ruby
|
226
|
+
# script that implements the extension has been evaluated.
|
227
|
+
#
|
228
|
+
# @example
|
229
|
+
# ext = SketchupExtension.new('Stair Tools', 'StairTools/core.rb')
|
230
|
+
# UI.messagebox("loaded? is false: #{ext.loaded?.to_s}")
|
231
|
+
# Sketchup.register_extension ext, true
|
232
|
+
# UI.messagebox("loaded? is now true: #{ext.loaded?.to_s}")
|
233
|
+
#
|
234
|
+
# @return boolean - true if the extension has been loaded
|
235
|
+
#
|
236
|
+
# @return [Boolean]
|
237
|
+
#
|
238
|
+
# @version SketchUp 8.0 M2
|
239
|
+
def loaded?
|
240
|
+
end
|
241
|
+
|
242
|
+
# The name method returns the name which appears for
|
243
|
+
# an extension inside the Extensions Manager dialog.
|
244
|
+
#
|
245
|
+
# @example
|
246
|
+
# # Create an entry in the Extension list that loads a script called
|
247
|
+
# # core.rb.
|
248
|
+
# extension = SketchupExtension.new('Stair Tools', 'StairTools/core.rb')
|
249
|
+
# name = extension.name
|
250
|
+
#
|
251
|
+
# @return name - the Extension name
|
252
|
+
#
|
253
|
+
# @version SketchUp 6.0
|
254
|
+
def name
|
255
|
+
end
|
256
|
+
|
257
|
+
# The name= method sets the name which appears for
|
258
|
+
# an extension inside the Extensions Manager dialog.
|
259
|
+
#
|
260
|
+
# @example
|
261
|
+
# # Create an entry in the Extension list that loads a script called
|
262
|
+
# # core.rb.
|
263
|
+
# extension = SketchupExtension.new('Stair Tools', 'StairTools/core.rb')
|
264
|
+
# extension.name = 'Renamed Stair Tools'
|
265
|
+
#
|
266
|
+
# @param name
|
267
|
+
# The new name
|
268
|
+
#
|
269
|
+
# @return name - the Extension name
|
270
|
+
#
|
271
|
+
# @version SketchUp 6.0
|
272
|
+
def name=(name)
|
273
|
+
end
|
274
|
+
|
275
|
+
# Returns whether the extension has been registered via
|
276
|
+
# Sketchup.register_extension.
|
277
|
+
#
|
278
|
+
# @example
|
279
|
+
# ext = SketchupExtension.new('Stair Tools', 'StairTools/core.rb')
|
280
|
+
# UI.messagebox("My registered? is false: #{ext.registered?.to_s}")
|
281
|
+
# Sketchup.register_extension(ext, true)
|
282
|
+
# UI.messagebox("Now registered? is now true: #{ext.registered?.to_s}")
|
283
|
+
#
|
284
|
+
# @return boolean - true if the extension has been registered.
|
285
|
+
#
|
286
|
+
# @return [Boolean]
|
287
|
+
#
|
288
|
+
# @version SketchUp 8.0 M2
|
289
|
+
def registered?
|
290
|
+
end
|
291
|
+
|
292
|
+
# Unloads the extension. This is the equivalent of unchecking the extension's
|
293
|
+
# checkbox in the Preferences > Extensions list.
|
294
|
+
#
|
295
|
+
# Note that technically the extension is not "unloaded" in the sense that it
|
296
|
+
# stops running during the current SketchUp session, but the next time the
|
297
|
+
# user restarts SketchUp, the extension will not be active.
|
298
|
+
#
|
299
|
+
# @example
|
300
|
+
# # This unloads all extensions. The next time SketchUp starts, none of
|
301
|
+
# # the extensions will be active.
|
302
|
+
# Sketchup.extensions.each { |extension|
|
303
|
+
# extension.uncheck
|
304
|
+
# }
|
305
|
+
#
|
306
|
+
# @return boolean - whether the unload succeeded
|
307
|
+
#
|
308
|
+
# @version SketchUp 8.0 M2
|
309
|
+
def uncheck
|
310
|
+
end
|
311
|
+
|
312
|
+
# The version method returns the version which appears beneath
|
313
|
+
# an extension inside the Extensions Manager dialog.
|
314
|
+
#
|
315
|
+
# @example
|
316
|
+
# # Create an entry in the Extension list that loads a script called
|
317
|
+
# # core.rb.
|
318
|
+
# extension = SketchupExtension.new('Stair Tools', 'StairTools/core.rb')
|
319
|
+
# extension.version = '5.0'
|
320
|
+
# version = extension.version
|
321
|
+
#
|
322
|
+
# @return version - the Extension version
|
323
|
+
#
|
324
|
+
# @version SketchUp 6.0
|
325
|
+
def version
|
326
|
+
end
|
327
|
+
|
328
|
+
# The version method sets the version which appears beneath
|
329
|
+
# an extension inside the Extensions Manager dialog.
|
330
|
+
#
|
331
|
+
# @example
|
332
|
+
# # Create an entry in the Extension list that loads a script called
|
333
|
+
# # core.rb.
|
334
|
+
# extension = SketchupExtension.new('Stair Tools', 'StairTools/core.rb')
|
335
|
+
# extension.version = '5.0'
|
336
|
+
# version = extension.version
|
337
|
+
#
|
338
|
+
# @param version
|
339
|
+
# The version string to set.
|
340
|
+
#
|
341
|
+
# @return version - the Extension version
|
342
|
+
#
|
343
|
+
# @version SketchUp 6.0
|
344
|
+
def version=(version)
|
345
|
+
end
|
346
|
+
|
347
|
+
# The version_id method returns the Extension Warehouse Version ID string.
|
348
|
+
#
|
349
|
+
# @return version_id - the Extension Warehouse Version ID string
|
350
|
+
#
|
351
|
+
# @version SketchUp 2013
|
352
|
+
def version_id
|
353
|
+
end
|
354
|
+
|
355
|
+
end
|
data/SketchUp/string.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The String class contains a method used to parse a string as a length value.
|
5
|
+
# All string arguments in Ruby API expect utf-8 strings.
|
6
|
+
#
|
7
|
+
# @version SketchUp 6.0
|
8
|
+
class String
|
9
|
+
|
10
|
+
# Instance Methods
|
11
|
+
|
12
|
+
# The to_l method is used to convert a string to a length. The returned length
|
13
|
+
# is expressed in the Model units.
|
14
|
+
#
|
15
|
+
# @example
|
16
|
+
# length = "5'".to_l
|
17
|
+
#
|
18
|
+
# @return length - the length value
|
19
|
+
#
|
20
|
+
# @version SketchUp 6.0
|
21
|
+
def to_l
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/SketchUp/ui.rb
ADDED
@@ -0,0 +1,637 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The UI module contains a number of methods for creating simple UI elements
|
5
|
+
# from a SketchUp Ruby script.
|
6
|
+
#
|
7
|
+
# @version SketchUp 6.0
|
8
|
+
module UI
|
9
|
+
|
10
|
+
# Class Methods
|
11
|
+
|
12
|
+
# The add_context_menu_handler method is used to register a block of code with
|
13
|
+
# SketchUp that will be called when a context menu is to be displayed. The
|
14
|
+
# context menu handler can then display the context menu with the items that
|
15
|
+
# you have added.
|
16
|
+
#
|
17
|
+
# Be careful with what you do in a context menu handler. If you perform an
|
18
|
+
# operation takes take a long time, such as traversing the model or selection
|
19
|
+
# in a large model it will delay the menu.
|
20
|
+
#
|
21
|
+
# See the contextmenu.rb script in the Plugins/examples directory for an
|
22
|
+
# example.
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# # Right click on anything to see a Hello World item.
|
26
|
+
# UI.add_context_menu_handler do |context_menu|
|
27
|
+
# context_menu.add_item("Hello World") {
|
28
|
+
# UI.messagebox("Hello world")
|
29
|
+
# }
|
30
|
+
# end
|
31
|
+
#
|
32
|
+
# @return count - the number of context handlers that are
|
33
|
+
# registered
|
34
|
+
#
|
35
|
+
# @version SketchUp 6.0
|
36
|
+
#
|
37
|
+
# @yield [menu] A block of code that takes a menu as its only as its
|
38
|
+
# only argument.
|
39
|
+
def self.add_context_menu_handler
|
40
|
+
end
|
41
|
+
|
42
|
+
# The beep method plays a system beep sound.
|
43
|
+
#
|
44
|
+
# The beep method does not accept any arguments nor return any values.
|
45
|
+
#
|
46
|
+
# @example
|
47
|
+
# UI.beep
|
48
|
+
#
|
49
|
+
# @return nil
|
50
|
+
#
|
51
|
+
# @version SketchUp 6.0
|
52
|
+
def self.beep
|
53
|
+
end
|
54
|
+
|
55
|
+
# The create_cursor method is used to create a cursor from an image file at
|
56
|
+
# the specified location. This must be called from within a custom
|
57
|
+
# Tool. See the Tool class for a complete example.
|
58
|
+
#
|
59
|
+
# Since SketchUp 2016 it is possible to provide vector images for the cursors.
|
60
|
+
# SVG format for Windows and PDF format for OS X.
|
61
|
+
#
|
62
|
+
# @example
|
63
|
+
# cursor_id = nil
|
64
|
+
# cursor_path = Sketchup.find_support_file("Pointer.png", "Plugins/")
|
65
|
+
# if cursor_path
|
66
|
+
# cursor_id = UI.create_cursor(cursor_path, 0, 0)
|
67
|
+
# end
|
68
|
+
#
|
69
|
+
# def onSetCursor
|
70
|
+
# UI.set_cursor(cursor_id)
|
71
|
+
# end
|
72
|
+
#
|
73
|
+
# @param filename
|
74
|
+
# Filename for an image.
|
75
|
+
#
|
76
|
+
# @param hot_x
|
77
|
+
# An x coordinate that is the "hotpoint" for the cursor
|
78
|
+
# computed from the left edge of your cursor image.
|
79
|
+
#
|
80
|
+
# @param hot_y
|
81
|
+
# A y coordinate that is the "hotpoint" for the cursor
|
82
|
+
# computed from the top edge of the of your cursor image.
|
83
|
+
# For example, a value of (hot_x, hot_y) = (5,10) would
|
84
|
+
# identify the hotpoint of the cursor at 5 pixels from
|
85
|
+
# the left edge of your cursor image and 10 pixels from
|
86
|
+
# the top edge of your cursor image.
|
87
|
+
#
|
88
|
+
# @return ID - ID associated with the cursor
|
89
|
+
#
|
90
|
+
# @version SketchUp 6.0
|
91
|
+
def self.create_cursor(filename, hot_x, hot_y)
|
92
|
+
end
|
93
|
+
|
94
|
+
# Creates a dialog box for inputting user information. The dialog box contains
|
95
|
+
# input fields with static text prompts, optional default values, optional
|
96
|
+
# drop down selections, and optional title.
|
97
|
+
#
|
98
|
+
# You can also use this method to display drop down lists of options, by
|
99
|
+
# passing an optional param.
|
100
|
+
#
|
101
|
+
# @example
|
102
|
+
# # With three params, it shows all text boxes:
|
103
|
+
# prompts = ["What is your Name?", "What is your Age?", "Gender"]
|
104
|
+
# defaults = ["Enter name", "", "Male"]
|
105
|
+
# input = UI.inputbox(prompts, defaults, "Tell me about yourself.")
|
106
|
+
#
|
107
|
+
# # With four params, it shows a drop down box for prompts that have
|
108
|
+
# # pipe-delimited lists of options. In this case, the Gender prompt
|
109
|
+
# # is a drop down instead of a text box.
|
110
|
+
# prompts = ["What is your Name?", "What is your Age?", "Gender"]
|
111
|
+
# defaults = ["Enter name", "", "Male"]
|
112
|
+
# list = ["", "", "Male|Female"]
|
113
|
+
# input = UI.inputbox(prompts, defaults, list, "Tell me about yourself.")
|
114
|
+
#
|
115
|
+
# @param prompts
|
116
|
+
# An array of prompt names appearing in the input box
|
117
|
+
# adjacent to input fields.
|
118
|
+
#
|
119
|
+
# @param [optional] defaults
|
120
|
+
# An array of default values for the input
|
121
|
+
# fields.
|
122
|
+
#
|
123
|
+
# @param [optional] title
|
124
|
+
# The title for the input box.
|
125
|
+
#
|
126
|
+
# @param [optional] title_or_list
|
127
|
+
# If 3 params are passed, then this value is
|
128
|
+
# a string containing the title of the input box. If
|
129
|
+
# a total of 4 params are passed, then this is an array
|
130
|
+
# containing pipe-separated strings of options.
|
131
|
+
#
|
132
|
+
# @return results - An array of returned values if the user did
|
133
|
+
# not cancel the dialog. If the user canceled the
|
134
|
+
# dialog, false is returned. The returned values in the
|
135
|
+
# array will be in the same order as the input fields.
|
136
|
+
#
|
137
|
+
# @version SketchUp 6.0
|
138
|
+
def self.inputbox(prompts, defaults, title_or_list, title)
|
139
|
+
end
|
140
|
+
|
141
|
+
# The inspector_names method is used to returns the names of all the
|
142
|
+
# inspectors. Inspectors are another name for the various floating dialog
|
143
|
+
# windows that you can activate from withing SketchUp, such as the Materials
|
144
|
+
# window.
|
145
|
+
#
|
146
|
+
# @example
|
147
|
+
# inspectors = UI.inspector_names
|
148
|
+
#
|
149
|
+
# @return inspectors - an array of strings containing the names
|
150
|
+
# of inspectors.
|
151
|
+
#
|
152
|
+
# @version SketchUp 6.0
|
153
|
+
def self.inspector_names
|
154
|
+
end
|
155
|
+
|
156
|
+
# The menu method retrieves a SketchUp's menu object with a given name. This
|
157
|
+
# is the first step toward adding your own custom items to the bottom
|
158
|
+
# of SketchUp's menus.
|
159
|
+
#
|
160
|
+
# Valid menu names are: "File", "Edit", "View", "Camera", "Draw", "Tools",
|
161
|
+
# "Window", "Extensions" and "Help".
|
162
|
+
#
|
163
|
+
# Note that the "Extensions" menu was named "Plugins" prior to SketchUp 2015.
|
164
|
+
# For backward compatibility "Plugins" still works.
|
165
|
+
#
|
166
|
+
# @example
|
167
|
+
# tool_menu = UI.menu("Tools")
|
168
|
+
# tool_menu.add_item("Cheese Tool") {
|
169
|
+
# UI.messagebox("Cheese activated.")
|
170
|
+
# }
|
171
|
+
#
|
172
|
+
# @param menuname
|
173
|
+
# Optional. The name of an existing menu. Default menu
|
174
|
+
# is "Extensions"
|
175
|
+
#
|
176
|
+
# @return menu - a menu object.
|
177
|
+
#
|
178
|
+
# @version SketchUp 6.0
|
179
|
+
def self.menu(menuname = "Extensions")
|
180
|
+
end
|
181
|
+
|
182
|
+
# Creates a dialog box containing static text with a series of buttons for
|
183
|
+
# the user to choose from.
|
184
|
+
#
|
185
|
+
# Valid message box types are:
|
186
|
+
# - +MB_OK+ - Contains an OK button.
|
187
|
+
# - +MB_OKCANCEL+ - Contains OK and Cancel buttons.
|
188
|
+
# - +MB_ABORTRETRYIGNORE+ - Contains Abort, Retry, and Ignore buttons.
|
189
|
+
# - +MB_YESNOCANCEL+ - Contains Yes, No, and Cancel buttons.
|
190
|
+
# - +MB_YESNO+ - Contains Yes and No buttons.
|
191
|
+
# - +MB_RETRYCANCEL+ - Contains Retry and Cancel buttons.
|
192
|
+
# - +MB_MULTILINE+ - Contains and OK button.
|
193
|
+
#
|
194
|
+
# Return values can be any of following:
|
195
|
+
# - +IDOK+
|
196
|
+
# - +IDCANCEL+
|
197
|
+
# - +IDABORT+
|
198
|
+
# - +IDRETRY+
|
199
|
+
# - +IDIGNORE+
|
200
|
+
# - +IDYES+
|
201
|
+
# - +IDNO+
|
202
|
+
#
|
203
|
+
# In an +MB_MULTILINE+ message box, the message is displayed as a multi-line
|
204
|
+
# message with scrollbars (as needed). +MB_MULTILNE+ also allows a third string
|
205
|
+
# argument that will be used as the title for the messagebox.
|
206
|
+
#
|
207
|
+
# @example
|
208
|
+
# result = UI.messagebox('Do you like cheese?', MB_YESNO)
|
209
|
+
# if result == IDYES
|
210
|
+
# UI.messagebox('SketchUp likes cheese too!')
|
211
|
+
# end
|
212
|
+
#
|
213
|
+
# @param [String] message
|
214
|
+
# The message that you want to display.
|
215
|
+
#
|
216
|
+
# @param [Integer] type
|
217
|
+
# The message box type, which will be a constant from
|
218
|
+
# the list in the method comments.
|
219
|
+
#
|
220
|
+
# @return [Integer] A number corresponding to what the user selected.
|
221
|
+
#
|
222
|
+
# @version SketchUp 6.0
|
223
|
+
def self.messagebox(message, type = MB_OK)
|
224
|
+
end
|
225
|
+
|
226
|
+
# The model_info_pages method is used to returns the names of all the
|
227
|
+
# available model info pages. These include UI windows such as Components,
|
228
|
+
# Credits, and Units.
|
229
|
+
#
|
230
|
+
# @example
|
231
|
+
# mypages = UI.model_info_pages
|
232
|
+
#
|
233
|
+
# @return mypages - an array of strings containing the names of
|
234
|
+
# model info pages.
|
235
|
+
#
|
236
|
+
# @version SketchUp 6.0
|
237
|
+
def self.model_info_pages
|
238
|
+
end
|
239
|
+
|
240
|
+
# The openURL method is used to open the default Web browser to a URL.
|
241
|
+
#
|
242
|
+
# @example
|
243
|
+
# status = UI.openURL("http://www.sketchup.com")
|
244
|
+
#
|
245
|
+
# @param URL
|
246
|
+
# A string URL.
|
247
|
+
#
|
248
|
+
# @return status - true if successful
|
249
|
+
#
|
250
|
+
# @version SketchUp 6.0
|
251
|
+
def self.openURL(URL)
|
252
|
+
end
|
253
|
+
|
254
|
+
# The openpanel method is used to display the Open dialog box. The path that
|
255
|
+
# is returned can then be used inside code to open a text or image file.
|
256
|
+
# See the standard Ruby class File for examples of reading and writing from
|
257
|
+
# disk.
|
258
|
+
#
|
259
|
+
# Bug Fixed in SketchUp 2014: Wildcards were not working properly from SU7 to
|
260
|
+
# SU2013. Wildcard filters did not populate the file type dropdown. The filter
|
261
|
+
# string would be shown in the file name field with '*' characters converted to
|
262
|
+
# '_' characters. Note, the format of a wildcard filter string has been changed.
|
263
|
+
# See the description of the filename parameter below for details.
|
264
|
+
#
|
265
|
+
# @example
|
266
|
+
# chosen_image = UI.openpanel("Open SKP File", "c:/", "model.skp")
|
267
|
+
# chosen_image = UI.openpanel("Open Image File", "c:/", "Image Files|*.jpg;*.png;||")
|
268
|
+
# chosen_image = UI.openpanel("Open CAD File", "c:/", "DXF|*.dxf|DWG|*.dwg||")
|
269
|
+
#
|
270
|
+
# @param title
|
271
|
+
# The title to apply to the open dialog box.
|
272
|
+
#
|
273
|
+
# @param directory
|
274
|
+
# The default directory for the open panel.
|
275
|
+
#
|
276
|
+
# @param filename
|
277
|
+
# The default filename for the open panel. On Windows, you
|
278
|
+
# can alternatively pass a wildcard filter using this
|
279
|
+
# format: UIname|wildcard||. Additional filter dropdown
|
280
|
+
# list items can be added by adding additional pairs of
|
281
|
+
# filter name and filter like this:
|
282
|
+
# UIname1|wildcard1|UIname2|wildcard2||.
|
283
|
+
# Also multiple wildcard filters can be combined into a
|
284
|
+
# single line using a semicolon-separated list in the
|
285
|
+
# filter field: ui_name|wildcard1;wildcard2||.
|
286
|
+
#
|
287
|
+
# @return string - the full path and name of the file selected, or
|
288
|
+
# nil if the dialog was canceled.
|
289
|
+
#
|
290
|
+
# @version SketchUp 6.0
|
291
|
+
def self.openpanel(title, directory, filename)
|
292
|
+
end
|
293
|
+
|
294
|
+
# The play_sound method is used to play a sound file. Valid sound files include
|
295
|
+
# .wav and .mp3 files on the Mac and .wav files on the PC.
|
296
|
+
#
|
297
|
+
# @example
|
298
|
+
# UI.play_sound "Plugins/mediadiscussion.wav"
|
299
|
+
#
|
300
|
+
# @param filename
|
301
|
+
# the relative path to the filename from the SketchUp
|
302
|
+
# install directory, or an absolute path to the file. (See
|
303
|
+
# Sketchup.find_support_file for a way to search for a
|
304
|
+
# specific file.)
|
305
|
+
#
|
306
|
+
# @return nil
|
307
|
+
#
|
308
|
+
# @version SketchUp 6.0
|
309
|
+
def self.play_sound(filename)
|
310
|
+
end
|
311
|
+
|
312
|
+
# The preferences_pages method is used to returns the names of all the
|
313
|
+
# preferences pages. These include windows like Extensions.
|
314
|
+
#
|
315
|
+
# @example
|
316
|
+
# prefs = UI.preferences_pages
|
317
|
+
#
|
318
|
+
# @return prefspages - an array of strings containing the names
|
319
|
+
# of prefspages.
|
320
|
+
#
|
321
|
+
# @version SketchUp 6.0
|
322
|
+
def self.preferences_pages
|
323
|
+
end
|
324
|
+
|
325
|
+
# Tells SketchUp to refresh all inspectors such as the Component Browser and
|
326
|
+
# the Outliner. This is useful when you need to manually force a refresh after
|
327
|
+
# you've made a change to the document via Ruby. Generally, SketchUp will keep
|
328
|
+
# these in sync for you, but occasionally it does not, such as when
|
329
|
+
# model.start_operation has disabled UI updates.
|
330
|
+
#
|
331
|
+
# @example
|
332
|
+
# UI.refresh_inspectors
|
333
|
+
#
|
334
|
+
# @return nil
|
335
|
+
#
|
336
|
+
# @version SketchUp 7.0
|
337
|
+
def self.refresh_inspectors
|
338
|
+
end
|
339
|
+
|
340
|
+
# The savepanel method is used to display the Save dialog box. The path that
|
341
|
+
# is returned can then be used inside code to save out a text or image file.
|
342
|
+
# See the standard Ruby class File for examples of reading and writing from
|
343
|
+
# disk.
|
344
|
+
#
|
345
|
+
# Bug Fixed in SketchUp 2014: Wildcards were not working properly from SU7 to
|
346
|
+
# SU2013. Semicolon-separated lists of wildcards did not populate the file type
|
347
|
+
# dropdown. The filter string would be shown in the file name field with '*'
|
348
|
+
# characters converted to '_' characters.
|
349
|
+
#
|
350
|
+
# @example
|
351
|
+
# path_to_save_to = UI.savepanel("Save Image File", "c:\\", "Shapes.jpg")
|
352
|
+
#
|
353
|
+
# @param title
|
354
|
+
# The title to apply to the save dialog box.
|
355
|
+
#
|
356
|
+
# @param directory
|
357
|
+
# The default directory for the save panel.
|
358
|
+
#
|
359
|
+
# @param filename
|
360
|
+
# The default filename for the save panel. On Windows, you
|
361
|
+
# can alternatively pass a mask, like "*.txt", to have all
|
362
|
+
# the .txt files display. If you want multiple file types
|
363
|
+
# to display, you can supply multiple masks for the
|
364
|
+
# filename and separate them with a semicolon, like this:
|
365
|
+
# "*.txt;*.doc".
|
366
|
+
#
|
367
|
+
# @return string - the full path and name of the file
|
368
|
+
# selected or nil if the dialog was canceled.
|
369
|
+
#
|
370
|
+
# @version SketchUp 6.0
|
371
|
+
def self.savepanel(title, directory, filename)
|
372
|
+
end
|
373
|
+
|
374
|
+
# Returns the scaling factor SketchUp uses on high DPI monitors. Useful for
|
375
|
+
# things like {Sketchup::View#draw2d}.
|
376
|
+
#
|
377
|
+
# @example
|
378
|
+
# # Scale a set of points representing 2d screen points to account for high
|
379
|
+
# # DPI monitors.
|
380
|
+
# points2d = [
|
381
|
+
# Geom::Point3d.new(0, 0, 0),
|
382
|
+
# Geom::Point3d.new(8, 0, 0),
|
383
|
+
# Geom::Point3d.new(8, 4, 0),
|
384
|
+
# Geom::Point3d.new(0, 4, 0)
|
385
|
+
# ]
|
386
|
+
# tr = Geom::Transformation.scaling(UI.scale_factor)
|
387
|
+
# points2d.each { |point| point.transform!(tr)
|
388
|
+
#
|
389
|
+
# @note SU2017M0 will automatically scale up line width and text size, but will
|
390
|
+
# not scale up the points provided to {Sketchup::View#draw2d}.
|
391
|
+
#
|
392
|
+
# @return [Float]
|
393
|
+
#
|
394
|
+
# @version SketchUp 2017
|
395
|
+
def self.scale_factor
|
396
|
+
end
|
397
|
+
|
398
|
+
# The select_directory method is used to display the OS dialog for selecting
|
399
|
+
# one or several directories from the file system.
|
400
|
+
#
|
401
|
+
# Options:
|
402
|
+
# - :title string The title for the dialog.
|
403
|
+
# - :directory string Force the starting directory for the dialog. If
|
404
|
+
# not specified the last chosen directory will be
|
405
|
+
# used
|
406
|
+
# - :select_multiple boolean Set to true to allow multiple items to be
|
407
|
+
# selected.
|
408
|
+
#
|
409
|
+
# @example
|
410
|
+
# # Default title and folder:
|
411
|
+
# chosen_folder = UI.select_directory
|
412
|
+
#
|
413
|
+
# # Custom dialog title:
|
414
|
+
# chosen_folder = UI.select_directory(title: "Select Image Directory")
|
415
|
+
#
|
416
|
+
# # Force a start folder:
|
417
|
+
# chosen_folder = UI.select_directory(directory: "C:/images")
|
418
|
+
#
|
419
|
+
# # Allow multiple items to the selected:
|
420
|
+
# chosen_folder = UI.select_directory(select_multiple: true)
|
421
|
+
#
|
422
|
+
# # Custom dialog title and force a start folder:
|
423
|
+
# chosen_folder = UI.select_directory(
|
424
|
+
# title: "Select Image Directory",
|
425
|
+
# directory: "C:/images"
|
426
|
+
# )
|
427
|
+
#
|
428
|
+
# @param options
|
429
|
+
# hash (optional) The dialog can be customized by
|
430
|
+
# providing a hash or named arguments of
|
431
|
+
# options.
|
432
|
+
#
|
433
|
+
# @return string or array - A string with the full path of the
|
434
|
+
# directory selected when
|
435
|
+
# :select_multiple option is set to
|
436
|
+
# false otherwise an array of strings
|
437
|
+
# or nil if the user cancelled.
|
438
|
+
#
|
439
|
+
# @version SketchUp 2015
|
440
|
+
def self.select_directory(options)
|
441
|
+
end
|
442
|
+
|
443
|
+
# The set_cursor method is used to change the cursor to a new cursor with a
|
444
|
+
# given cursor id. See UI.create_cursor and the Tool class for details
|
445
|
+
# on creating your own tools with arbitrary cursors.
|
446
|
+
#
|
447
|
+
# If you call this while a standard SketchUp tool is active, you will not
|
448
|
+
# see your custom cursor, as these tools are constantly setting their
|
449
|
+
# own cursors to indicate SketchUp's state.
|
450
|
+
#
|
451
|
+
# @example
|
452
|
+
# def onSetCursor
|
453
|
+
# UI.set_cursor(cursor_id)
|
454
|
+
# end
|
455
|
+
#
|
456
|
+
# @param cursor_id
|
457
|
+
# The id of the cursor you want to display.
|
458
|
+
#
|
459
|
+
# @return nil
|
460
|
+
#
|
461
|
+
# @version SketchUp 6.0
|
462
|
+
def self.set_cursor(cursor_id)
|
463
|
+
end
|
464
|
+
|
465
|
+
# The set_toolbar_visible method is used to set whether a given toolbar is
|
466
|
+
# visible. Note that the toolbars and their names are different on the
|
467
|
+
# Mac vs. PC, so be careful and be sure to test when using this method in a
|
468
|
+
# cross-platform script.
|
469
|
+
#
|
470
|
+
# @example
|
471
|
+
# status = UI.set_toolbar_visible("Camera", true)
|
472
|
+
#
|
473
|
+
# @param name
|
474
|
+
# The name of a Ruby toolbar.
|
475
|
+
#
|
476
|
+
# @param visible
|
477
|
+
# True to make the toolbar visible, false to hide it.
|
478
|
+
#
|
479
|
+
# @return result - true if successful, false if not.
|
480
|
+
#
|
481
|
+
# @version SketchUp 6.0
|
482
|
+
def self.set_toolbar_visible(name, visible)
|
483
|
+
end
|
484
|
+
|
485
|
+
# The +show_extension_manager+ method is used to display the Extension Manager
|
486
|
+
# dialog.
|
487
|
+
#
|
488
|
+
# @example
|
489
|
+
# UI.show_extension_manager
|
490
|
+
#
|
491
|
+
# @return [nil]
|
492
|
+
#
|
493
|
+
# @version SketchUp 2017
|
494
|
+
def self.show_extension_manager
|
495
|
+
end
|
496
|
+
|
497
|
+
# The show_inspector method is used to display the inspector with the given
|
498
|
+
# name. You can get the list of valid inspectors with UI.inspector_names.
|
499
|
+
#
|
500
|
+
# @example
|
501
|
+
# status = UI.show_inspector "Components"
|
502
|
+
#
|
503
|
+
# @param name
|
504
|
+
# The name of inspector that you want to display.
|
505
|
+
#
|
506
|
+
# @return status - true if successful, false if unsuccessful
|
507
|
+
#
|
508
|
+
# @version SketchUp 6.0
|
509
|
+
def self.show_inspector(name)
|
510
|
+
end
|
511
|
+
|
512
|
+
# The show_model_info method is used to display the model info dialog for a
|
513
|
+
# specific page. You can get the list of valid dialogs with
|
514
|
+
# UI.model_info_pages.
|
515
|
+
#
|
516
|
+
# @example
|
517
|
+
# status = UI.show_model_info('Credits')
|
518
|
+
#
|
519
|
+
# @param page_name
|
520
|
+
# The name of the model info dialog you want to display.
|
521
|
+
#
|
522
|
+
# @return status - true
|
523
|
+
#
|
524
|
+
# @version SketchUp 6.0
|
525
|
+
def self.show_model_info(page_name)
|
526
|
+
end
|
527
|
+
|
528
|
+
# The show_preferences method is used to display a SketchUp preferences dialog.
|
529
|
+
# You can get the list of valid dialogs with UI.preferences_pages.
|
530
|
+
#
|
531
|
+
# Note that under OSX this method doesn't currently work.
|
532
|
+
#
|
533
|
+
# @example
|
534
|
+
# status = UI.show_preferences('GraphicsCard')
|
535
|
+
#
|
536
|
+
# @param page_name
|
537
|
+
# The name of the preferences dialog you want to display.
|
538
|
+
#
|
539
|
+
# @return status - true
|
540
|
+
#
|
541
|
+
# @version SketchUp 6.0
|
542
|
+
def self.show_preferences(page_name)
|
543
|
+
end
|
544
|
+
|
545
|
+
# The start_timer method is used to start a timer. This is an effective method
|
546
|
+
# to create a repeating snippet of code for arbitrary animation.
|
547
|
+
#
|
548
|
+
# See this blog post for an detailed example of custom animation using timers:
|
549
|
+
# http://sketchupapi.blogspot.com/2008/10/animate-yo-cheese.html
|
550
|
+
#
|
551
|
+
# Note that there is a bug that if you open a modal window in a non-repeating
|
552
|
+
# timer the timer will repeat until the window is closed.
|
553
|
+
#
|
554
|
+
# @example
|
555
|
+
# # Beep once after 10 seconds.
|
556
|
+
# id = UI.start_timer(10, false) { UI.beep }
|
557
|
+
#
|
558
|
+
# @param [optional] repeat
|
559
|
+
# true if you want the timer to repeat, false
|
560
|
+
# (or omit) if you do not want it to repeat.
|
561
|
+
#
|
562
|
+
# @param seconds
|
563
|
+
# The time in seconds before your code should be called.
|
564
|
+
#
|
565
|
+
# @return timer - a timer ID
|
566
|
+
#
|
567
|
+
# @version SketchUp 6.0
|
568
|
+
#
|
569
|
+
# @yield [procedure] The procedure you want to execute after seconds has
|
570
|
+
# expired.
|
571
|
+
def self.start_timer(seconds, repeat = false)
|
572
|
+
end
|
573
|
+
|
574
|
+
# The stop_timer method is used to stop a timer based on its id.
|
575
|
+
#
|
576
|
+
# @example
|
577
|
+
# # Stop timer before it triggers.
|
578
|
+
# id = UI.start_timer(10) { UI.beep }
|
579
|
+
# UI.stop_timer(id)
|
580
|
+
#
|
581
|
+
# @param id
|
582
|
+
# The timer id for the timer that you want to stop.
|
583
|
+
#
|
584
|
+
# @return nil
|
585
|
+
#
|
586
|
+
# @version SketchUp 6.0
|
587
|
+
def self.stop_timer(id)
|
588
|
+
end
|
589
|
+
|
590
|
+
# The toolbar method is used to get a Ruby toolbar by name. If the toolbar
|
591
|
+
# doesn't exist a new one will be created.
|
592
|
+
#
|
593
|
+
# @example
|
594
|
+
# toolbar = UI.toolbar('Test')
|
595
|
+
#
|
596
|
+
# @param name
|
597
|
+
# The name of the Ruby toolbar.
|
598
|
+
#
|
599
|
+
# @return toolbar - a Toolbar object
|
600
|
+
#
|
601
|
+
# @version SketchUp 6.0
|
602
|
+
def self.toolbar(name)
|
603
|
+
end
|
604
|
+
|
605
|
+
# The toolbar_names method is used to return the name of all the available
|
606
|
+
# native toolbars (this differs between PC and Mac). These toolbar names
|
607
|
+
# do not include Ruby toolbars.
|
608
|
+
#
|
609
|
+
# @example
|
610
|
+
# names = UI.toolbar_names
|
611
|
+
#
|
612
|
+
# @return names - Array of strings representing toolbar names.
|
613
|
+
#
|
614
|
+
# @version SketchUp 6.0
|
615
|
+
def self.toolbar_names
|
616
|
+
end
|
617
|
+
|
618
|
+
# The toolbar_visible? method is used to determine whether a given toolbar is
|
619
|
+
# visible. Note that the toolbars and their names are different on the
|
620
|
+
# Mac vs. PC, so be careful and be sure to test when using this method in a
|
621
|
+
# cross-platform script.
|
622
|
+
#
|
623
|
+
# @example
|
624
|
+
# status = UI.toolbar_visible?("Camera")
|
625
|
+
#
|
626
|
+
# @param name
|
627
|
+
# The name of a native toolbar.
|
628
|
+
#
|
629
|
+
# @return status - true if successful, false if unsuccessful
|
630
|
+
#
|
631
|
+
# @return [Boolean]
|
632
|
+
#
|
633
|
+
# @version SketchUp 6.0
|
634
|
+
def self.toolbar_visible?(name)
|
635
|
+
end
|
636
|
+
|
637
|
+
end
|