sketchup-api-stubs 0.7.9 → 0.7.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sketchup-api-stubs/sketchup.rb +151 -151
  3. data/lib/sketchup-api-stubs/stubs/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 -476
  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 -693
  16. data/lib/sketchup-api-stubs/stubs/Geom.rb +351 -351
  17. data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +93 -93
  18. data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +595 -595
  19. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +747 -747
  20. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +183 -183
  21. data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
  22. data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +569 -517
  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 +356 -353
  26. data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +354 -354
  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 +459 -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 -82
  43. data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +714 -692
  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 +278 -278
  51. data/lib/sketchup-api-stubs/stubs/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 -169
  54. data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +226 -209
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +150 -150
  56. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +281 -281
  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 -121
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +294 -294
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +659 -659
  64. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +593 -593
  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 -449
  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 -406
  77. data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +397 -397
  78. data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
  79. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1242 -1239
  80. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +261 -261
  81. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -127
  82. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +519 -545
  83. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -60
  84. data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +125 -125
  85. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +937 -937
  86. data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +102 -102
  87. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +750 -750
  88. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +282 -282
  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 -406
  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 -326
  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 -114
  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 -317
  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 +1656 -1652
  111. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +357 -357
  112. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +130 -130
  113. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +271 -271
  114. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
  115. data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +490 -490
  116. data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +116 -116
  117. data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +797 -797
  118. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +361 -361
  119. data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -77
  120. data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +480 -478
  121. data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
  122. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +373 -361
  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 -458
  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 -255
  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 -834
  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 -75
  140. data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
  141. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1329 -1311
  142. data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +45 -45
  143. data/lib/sketchup-api-stubs/stubs/Sketchup.rb +1394 -1377
  144. data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +353 -353
  145. data/lib/sketchup-api-stubs/stubs/String.rb +24 -24
  146. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +387 -389
  147. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +505 -494
  148. data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +269 -269
  149. data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +241 -241
  150. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +633 -635
  151. data/lib/sketchup-api-stubs/stubs/UI.rb +728 -683
  152. data/lib/sketchup-api-stubs/stubs/_top_level.rb +303 -303
  153. data/lib/sketchup-api-stubs.rb +1 -1
  154. metadata +3 -3
@@ -1,683 +1,728 @@
1
- # Copyright:: Copyright 2023 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 [Integer] 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 [String] path
74
- # File path to an image.
75
- #
76
- # @param [Integer] 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 [Integer] 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 [Integer] ID associated with the cursor
89
- #
90
- # @version SketchUp 6.0
91
- def self.create_cursor(path, 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
- # @overload inputbox(prompts, defaults, title)
116
- #
117
- # @param [Array<String>] prompts
118
- # An array of prompt names appearing in the input box
119
- # adjacent to input fields.
120
- # @param [Array<String>] defaults
121
- # An array of default values for the input
122
- # fields.
123
- # @param [String] title
124
- # The title for the input box.
125
- #
126
- # @overload inputbox(prompts, defaults, list, title)
127
- #
128
- # @param [Array<String>] prompts
129
- # An array of prompt names appearing in the input box
130
- # adjacent to input fields.
131
- # @param [Array<String>] defaults
132
- # An array of default values for the input
133
- # fields.
134
- # @param [String, Array<String>] list
135
- # An array containing pipe-separated strings of options.
136
- # @param [String] title
137
- # The title for the input box.
138
- #
139
- # @return [Array<String>, false] An array of returned values if the user did
140
- # not cancel the dialog. If the user canceled the
141
- # dialog, false is returned. The returned values in the
142
- # array will be in the same order as the input fields.
143
- #
144
- # @version SketchUp 6.0
145
- def self.inputbox(*args)
146
- end
147
-
148
- # The {.inspector_names} method is used to returns the names of all the
149
- # inspectors. Inspectors are another name for the various floating dialog
150
- # windows that you can activate from withing SketchUp, such as the Materials
151
- # window.
152
- #
153
- # @bug Prior to SketchUp 2022.0 "EntityInfo" was not listed.
154
- #
155
- # @example
156
- # inspectors = UI.inspector_names
157
- #
158
- # @return [Array<String>] an array of strings containing the names
159
- # of inspectors.
160
- #
161
- # @version SketchUp 6.0
162
- def self.inspector_names
163
- end
164
-
165
- # The {.menu} method retrieves a SketchUp's menu object with a given name. This
166
- # is the first step toward adding your own custom items to the bottom
167
- # of SketchUp's menus.
168
- #
169
- # Valid menu names are: "File", "Edit", "View", "Camera", "Draw", "Tools",
170
- # "Window", "Extensions", "Help" and "Developer".
171
- #
172
- # @example
173
- # tool_menu = UI.menu("Tools")
174
- # tool_menu.add_item("Cheese Tool") {
175
- # UI.messagebox("Cheese activated.")
176
- # }
177
- #
178
- # @note The "Extensions" menu was named "Plugins" prior to SketchUp 2015.
179
- # For backward compatibility "Plugins" still works.
180
- #
181
- # @note In versions prior to SketchUp 2018 this would crash if you passed an
182
- # empty string.
183
- #
184
- # @param menu_name
185
- # The name of an existing top level menu.
186
- #
187
- # @return [Sketchup::Menu]
188
- #
189
- # @version SketchUp 6.0
190
- def self.menu(menu_name = "Plugins")
191
- end
192
-
193
- # Creates a dialog box containing static text with a series of buttons for
194
- # the user to choose from.
195
- #
196
- # Valid message box types are:
197
- # - +MB_OK+ - Contains an OK button.
198
- # - +MB_OKCANCEL+ - Contains OK and Cancel buttons.
199
- # - +MB_ABORTRETRYIGNORE+ - Contains Abort, Retry, and Ignore buttons.
200
- # - +MB_YESNOCANCEL+ - Contains Yes, No, and Cancel buttons.
201
- # - +MB_YESNO+ - Contains Yes and No buttons.
202
- # - +MB_RETRYCANCEL+ - Contains Retry and Cancel buttons.
203
- # - +MB_MULTILINE+ - Contains and OK button.
204
- #
205
- # Return values can be any of following:
206
- # - +IDOK+
207
- # - +IDCANCEL+
208
- # - +IDABORT+
209
- # - +IDRETRY+
210
- # - +IDIGNORE+
211
- # - +IDYES+
212
- # - +IDNO+
213
- #
214
- # In an +MB_MULTILINE+ message box, the message is displayed as a multi-line
215
- # message with scrollbars (as needed). +MB_MULTILNE+ also allows a third string
216
- # argument that will be used as the title for the messagebox.
217
- #
218
- # @example
219
- # result = UI.messagebox('Do you like cheese?', MB_YESNO)
220
- # if result == IDYES
221
- # UI.messagebox('SketchUp likes cheese too!')
222
- # end
223
- #
224
- # @param [String] message
225
- # The message that you want to display.
226
- #
227
- # @param [Integer] type
228
- # The message box type, which will be a constant from
229
- # the list in the method comments.
230
- #
231
- # @return [Integer] A number corresponding to what the user selected.
232
- #
233
- # @version SketchUp 6.0
234
- def self.messagebox(message, type = MB_OK)
235
- end
236
-
237
- # The model_info_pages method is used to returns the names of all the
238
- # available model info pages. These include UI windows such as Components,
239
- # Credits, and Units.
240
- #
241
- # @example
242
- # mypages = UI.model_info_pages
243
- #
244
- # @return [Array<String>] an array of strings containing the names of
245
- # model info pages.
246
- #
247
- # @version SketchUp 6.0
248
- def self.model_info_pages
249
- end
250
-
251
- # The {.openURL} method is used to open the default browser to a URL.
252
- #
253
- # @bug Before SketchUp 2019.3 the mac version would URL encode the given URL.
254
- # This could inadvertently mangle some URLs, if for example if they had
255
- # URL fragments (# character).
256
- # The Windows version would not. As of SketchUp 2019.3 both platforms do
257
- # not perform URL encoding and the API user is expected to provide a valid
258
- # URL.
259
- #
260
- # @example
261
- # status = UI.openURL("http://www.sketchup.com")
262
- #
263
- # @param [String] url
264
- #
265
- # @return [Boolean]
266
- #
267
- # @version SketchUp 6.0
268
- def self.openURL(url)
269
- end
270
-
271
- # The {.openpanel} method is used to display the Open dialog box. The path that
272
- # is returned can then be used inside code to open a text or image file.
273
- # See the standard Ruby class File for examples of reading and writing from
274
- # disk.
275
- #
276
- # @bug Fixed in SketchUp 2014: Wildcards were not working properly from SU7 to
277
- # SU2013. Wildcard filters did not populate the file type dropdown. The filter
278
- # string would be shown in the file name field with '*' characters converted to
279
- # '_' characters. Note, the format of a wildcard filter string has been changed.
280
- # See the description of the filename parameter below for details.
281
- #
282
- # @example
283
- # chosen_image = UI.openpanel("Open SKP File", "c:/", "model.skp")
284
- # chosen_image = UI.openpanel("Open Image File", "c:/", "Image Files|*.jpg;*.png;||")
285
- # chosen_image = UI.openpanel("Open CAD File", "c:/", "DXF|*.dxf|DWG|*.dwg||")
286
- #
287
- # @param [String] title
288
- # The title to apply to the open dialog box.
289
- #
290
- # @param [String] directory
291
- # The default directory for the open panel.
292
- #
293
- # @param [String] filename
294
- # The default filename for the open panel. On Windows, you
295
- # can alternatively pass a wildcard filter using this
296
- # format: UIname|wildcard||. Additional filter dropdown
297
- # list items can be added by adding additional pairs of
298
- # filter name and filter like this:
299
- # UIname1|wildcard1|UIname2|wildcard2||.
300
- # Also multiple wildcard filters can be combined into a
301
- # single line using a semicolon-separated list in the
302
- # filter field: ui_name|wildcard1;wildcard2||.
303
- #
304
- # @return [String] the full path and name of the file selected, or
305
- # nil if the dialog was canceled.
306
- #
307
- # @see UI.savepanel
308
- #
309
- # @version SketchUp 6.0
310
- def self.openpanel(title, directory, filename)
311
- end
312
-
313
- # The play_sound method is used to play a sound file. Valid sound files include
314
- # .wav and .mp3 files on the Mac and .wav files on the PC.
315
- #
316
- # @example
317
- # UI.play_sound "Plugins/mediadiscussion.wav"
318
- #
319
- # @param [String] filename
320
- # the relative path to the filename from the SketchUp
321
- # install directory, or an absolute path to the file. (See
322
- # Sketchup.find_support_file for a way to search for a
323
- # specific file.)
324
- #
325
- # @return [nil]
326
- #
327
- # @version SketchUp 6.0
328
- def self.play_sound(filename)
329
- end
330
-
331
- # The preferences_pages method is used to returns the names of all the
332
- # preferences pages. These include windows like Templates.
333
- #
334
- # [SketchUp 2017] <code>"Extensions"</code> page was removed.
335
- #
336
- # @example
337
- # prefs = UI.preferences_pages
338
- #
339
- # @return [Array<String>] an array of strings containing the names
340
- # of preference pages.
341
- #
342
- # @version SketchUp 6.0
343
- def self.preferences_pages
344
- end
345
-
346
- # Tells SketchUp to refresh all inspectors such as the Component Browser and
347
- # the Outliner. This is useful when you need to manually force a refresh after
348
- # you've made a change to the document via Ruby. Generally, SketchUp will keep
349
- # these in sync for you, but occasionally it does not, such as when
350
- # model.start_operation has disabled UI updates.
351
- #
352
- # @example
353
- # UI.refresh_inspectors
354
- #
355
- # @return [nil]
356
- #
357
- # @version SketchUp 7.0
358
- def self.refresh_inspectors
359
- end
360
-
361
- # Tells SketchUp to refresh all floating toolbars. This is useful when you need
362
- # to manually force a refresh after you've made a change to the document via
363
- # Ruby. Generally, SketchUp will keep these in sync for you, but occasionally
364
- # it does not, such as when {Sketchup::Model#start_operation} has disabled UI
365
- # updates.
366
- # This only affects macOS, on Windows the toolbars are always refreshing.
367
- #
368
- # @example
369
- # UI.refresh_toolbars
370
- #
371
- # @return [nil]
372
- #
373
- # @version SketchUp 2018
374
- def self.refresh_toolbars
375
- end
376
-
377
- # The {.savepanel} method is used to display the Save dialog box. The path that
378
- # is returned can then be used inside code to save out a text or image file.
379
- # See the standard Ruby class File for examples of reading and writing from
380
- # disk.
381
- #
382
- # @bug Fixed in SketchUp 2014: Wildcards were not working properly from SU7 to
383
- # SU2013. Semicolon-separated lists of wildcards did not populate the file type
384
- # dropdown. The filter string would be shown in the file name field with '*'
385
- # characters converted to '_' characters.
386
- #
387
- # @bug Fixed in SketchUp 2022.0: if +filename+ begins with a +*+ it crashes
388
- # on macOS.
389
- #
390
- # @example
391
- # path_to_save_to = UI.savepanel("Save Image File", "c:\\", "Shapes.jpg")
392
- #
393
- # @param [String] title
394
- # The title to apply to the save dialog box.
395
- #
396
- # @param [String] directory
397
- # The default directory for the save panel.
398
- #
399
- # @param [String] filename
400
- # The default filename for the save panel. On Windows, you
401
- # can alternatively pass a mask, like "*.txt", to have all
402
- # the .txt files display. If you want multiple file types
403
- # to display, you can supply multiple masks for the
404
- # filename and separate them with a semicolon, like this:
405
- # "*.txt;*.doc".
406
- #
407
- # @return [String] the full path and name of the file
408
- # selected or nil if the dialog was canceled.
409
- #
410
- # @see UI.openpanel
411
- #
412
- # @version SketchUp 6.0
413
- def self.savepanel(title, directory, filename)
414
- end
415
-
416
- # Returns the scaling factor SketchUp uses on high DPI monitors. Useful for
417
- # things like {Sketchup::View#draw2d}.
418
- #
419
- # @example
420
- # # Scale a set of points representing 2d screen points to account for high
421
- # # DPI monitors.
422
- # points2d = [
423
- # Geom::Point3d.new(0, 0, 0),
424
- # Geom::Point3d.new(8, 0, 0),
425
- # Geom::Point3d.new(8, 4, 0),
426
- # Geom::Point3d.new(0, 4, 0)
427
- # ]
428
- # tr = Geom::Transformation.scaling(UI.scale_factor)
429
- # points2d.each { |point| point.transform!(tr)
430
- #
431
- # @note SU2017M0 will automatically scale up line width and text size, but will
432
- # not scale up the points provided to {Sketchup::View#draw2d}.
433
- #
434
- # @return [Float]
435
- #
436
- # @version SketchUp 2017
437
- def self.scale_factor
438
- end
439
-
440
- # The {.select_directory} method is used to display the OS dialog for selecting
441
- # one or several directories from the file system.
442
- #
443
- # @example
444
- # # Default title and folder:
445
- # chosen_folder = UI.select_directory
446
- #
447
- # # Custom dialog title:
448
- # chosen_folder = UI.select_directory(title: "Select Image Directory")
449
- #
450
- # # Force a start folder:
451
- # chosen_folder = UI.select_directory(directory: "C:/images")
452
- #
453
- # # Allow multiple items to the selected:
454
- # chosen_folder = UI.select_directory(select_multiple: true)
455
- #
456
- # # Custom dialog title and force a start folder:
457
- # chosen_folder = UI.select_directory(
458
- # title: "Select Image Directory",
459
- # directory: "C:/images"
460
- # )
461
- #
462
- # @option options [String] :title (nil) The title for the dialog.
463
- #
464
- # @option options [String] :directory (nil) Force the starting directory for the dialog. If not specified the last
465
- # chosen directory will be used.
466
- #
467
- # @option options [Boolean] :select_multiple (false) Set to true to allow multiple items to be selected.
468
- #
469
- # @param [Hash] options
470
- # The dialog can be customized by providing a hash or named arguments of
471
- # options.
472
- #
473
- # @return [String, Array<String>, nil] A string with the full path of the
474
- # directory selected when
475
- # :select_multiple option is set to
476
- # false otherwise an array of strings
477
- # or nil if the user cancelled.
478
- #
479
- # @version SketchUp 2015
480
- def self.select_directory(options = {})
481
- end
482
-
483
- # The {.set_cursor} method is used to change the cursor to a new cursor with a
484
- # given cursor id. See UI.create_cursor and the Tool class for details
485
- # on creating your own tools with arbitrary cursors.
486
- #
487
- # If you call this while a standard SketchUp tool is active, you will not
488
- # see your custom cursor, as these tools are constantly setting their
489
- # own cursors to indicate SketchUp's state.
490
- #
491
- # @example
492
- # def onSetCursor
493
- # UI.set_cursor(cursor_id)
494
- # end
495
- #
496
- # @param [Integer] cursor_id
497
- # The id of the cursor you want to display.
498
- #
499
- # @return [Boolean]
500
- #
501
- # @version SketchUp 6.0
502
- def self.set_cursor(cursor_id)
503
- end
504
-
505
- # The set_toolbar_visible method is used to set whether a given toolbar is
506
- # visible. Note that the toolbars and their names are different on the
507
- # Mac vs. PC, so be careful and be sure to test when using this method in a
508
- # cross-platform script.
509
- #
510
- # @example
511
- # status = UI.set_toolbar_visible("Camera", true)
512
- #
513
- # @param [String] name
514
- # The name of a Ruby toolbar.
515
- #
516
- # @param [Boolean] visible
517
- # True to make the toolbar visible, false to hide it.
518
- #
519
- # @return [Boolean] true if successful, false if not.
520
- #
521
- # @version SketchUp 6.0
522
- def self.set_toolbar_visible(name, visible)
523
- end
524
-
525
- # The +show_extension_manager+ method is used to display the Extension Manager
526
- # dialog.
527
- #
528
- # @example
529
- # UI.show_extension_manager
530
- #
531
- # @return [nil]
532
- #
533
- # @version SketchUp 2017
534
- def self.show_extension_manager
535
- end
536
-
537
- # The {.show_inspector} method is used to display the inspector with the given
538
- # name. You can get the list of valid inspectors with UI.inspector_names.
539
- #
540
- # @bug Prior to SketchUp 2022.0 "EntityInfo" was not a supported parameter.
541
- #
542
- # @example
543
- # status = UI.show_inspector("Components")
544
- #
545
- # @param [String] name
546
- # The name of inspector that you want to display.
547
- #
548
- # @return [Boolean] true if successful, false if unsuccessful
549
- #
550
- # @version SketchUp 6.0
551
- def self.show_inspector(name)
552
- end
553
-
554
- # The {.show_model_info} method is used to display the model info dialog for a
555
- # specific page. You can get the list of valid page names with {UI.model_info_pages}.
556
- #
557
- # [SketchUp 2014] <code>"Classifications"</code> page was added.
558
- #
559
- # @bug Until SketchUp 2021.1 SketchUp on Mac didn't display the desired page in,
560
- # but only selected it in the navigation.
561
- #
562
- # @bug Until SketchUp 2021.1 SketchUp on Mac didn't accept English page names on localized builds.
563
- #
564
- # @example
565
- # UI.show_model_info('Credits')
566
- #
567
- # @param [String] page_name
568
- # The name of the model info dialog you want to display.
569
- #
570
- # @return [Boolean]
571
- #
572
- # @version SketchUp 6.0
573
- def self.show_model_info(page_name)
574
- end
575
-
576
- # The show_preferences method is used to display a SketchUp preferences dialog.
577
- # You can get the list of valid dialogs with {UI.preferences_pages}.
578
- #
579
- # @bug Under OSX this method doesn't currently work.
580
- #
581
- # @example
582
- # status = UI.show_preferences('GraphicsCard')
583
- #
584
- # @param [String] page_name
585
- # The name of the preferences dialog you want to display.
586
- #
587
- # @return [Boolean] true
588
- #
589
- # @version SketchUp 6.0
590
- def self.show_preferences(page_name)
591
- end
592
-
593
- # The start_timer method is used to start a timer. This is an effective method
594
- # to create a repeating snippet of code for arbitrary animation.
595
- #
596
- # See this blog post for an detailed example of custom animation using timers:
597
- # http://sketchupapi.blogspot.com/2008/10/animate-yo-cheese.html
598
- #
599
- # Note that there is a bug that if you open a modal window in a non-repeating
600
- # timer the timer will repeat until the window is closed.
601
- #
602
- # @example
603
- # # Beep once after 10 seconds.
604
- # id = UI.start_timer(10, false) { UI.beep }
605
- #
606
- # @param [Numeric] seconds
607
- # The time in seconds before your code should be called.
608
- #
609
- # @param [Boolean] repeat
610
- # true if you want the timer to repeat, false
611
- # (or omit) if you do not want it to repeat.
612
- #
613
- # @return [Integer] a timer ID
614
- #
615
- # @version SketchUp 6.0
616
- #
617
- # @yield [procedure] The procedure you want to execute after seconds has
618
- # expired.
619
- def self.start_timer(seconds, repeat = false)
620
- end
621
-
622
- # The stop_timer method is used to stop a timer based on its id.
623
- #
624
- # @example
625
- # # Stop timer before it triggers.
626
- # id = UI.start_timer(10) { UI.beep }
627
- # UI.stop_timer(id)
628
- #
629
- # @param [Integer] id
630
- # The timer id for the timer that you want to stop.
631
- #
632
- # @return [nil]
633
- #
634
- # @version SketchUp 6.0
635
- def self.stop_timer(id)
636
- end
637
-
638
- # The toolbar method is used to get a Ruby toolbar by name. If the toolbar
639
- # doesn't exist a new one will be created.
640
- #
641
- # @example
642
- # toolbar = UI.toolbar('Test')
643
- #
644
- # @param [String] name
645
- # The name of the Ruby toolbar.
646
- #
647
- # @return [UI::Toolbar] a Toolbar object
648
- #
649
- # @version SketchUp 6.0
650
- def self.toolbar(name)
651
- end
652
-
653
- # The toolbar_names method is used to return the name of all the available
654
- # native toolbars (this differs between PC and Mac). These toolbar names
655
- # do not include Ruby toolbars.
656
- #
657
- # @example
658
- # names = UI.toolbar_names
659
- #
660
- # @return [Array<String>] Array of strings representing toolbar names.
661
- #
662
- # @version SketchUp 6.0
663
- def self.toolbar_names
664
- end
665
-
666
- # The toolbar_visible? method is used to determine whether a given toolbar is
667
- # visible. Note that the toolbars and their names are different on the
668
- # Mac vs. PC, so be careful and be sure to test when using this method in a
669
- # cross-platform script.
670
- #
671
- # @example
672
- # status = UI.toolbar_visible?("Camera")
673
- #
674
- # @param [String] name
675
- # The name of a native toolbar.
676
- #
677
- # @return [Boolean]
678
- #
679
- # @version SketchUp 6.0
680
- def self.toolbar_visible?(name)
681
- end
682
-
683
- end
1
+ # Copyright:: Copyright 2024 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 [Integer] 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 {Sketchup::Tool} documentation for a complete example.
58
+ #
59
+ # The size of the cursor images should be 32x32 pixels.
60
+ #
61
+ # The coordinates for the cursor's hotspot is based from it's top left corner.
62
+ # For example, a value of (hot_x, hot_y) = (5, 10) would identify the hotpoint
63
+ # of the cursor at 6 pixels from the left edge of your cursor image and 11
64
+ # pixels from the top edge of your cursor image.
65
+ #
66
+ # @bug On macOS raster cursors are always displayed at 24x24.
67
+ #
68
+ # @bug In SketchUp 2023.1 on Mac provided an incorrect hotspot location. The hotspot was scaled by
69
+ # a factor of 32.0/24.0. If a hotspot position was greater than 24, the cursor would not display.
70
+ #
71
+ # @example
72
+ # class ExampleTool
73
+ # def initialize
74
+ # @cursor_id = nil
75
+ # # Load vector cursor format depending on platform.
76
+ # ext = Sketchup.platform == :platform_win ? 'svg' : 'pdf'
77
+ # cursor_path = File.join(__dir__, "cursor.#{ext}")
78
+ # @cursor_id = UI.create_cursor(cursor_path, 4, 6)
79
+ # end
80
+ #
81
+ # def onSetCursor
82
+ # UI.set_cursor(@cursor_id)
83
+ # end
84
+ # end
85
+ #
86
+ # @note Since SketchUp 2016 it is possible to provide vector images for the cursors.
87
+ # SVG format for Windows and PDF format for macOS. This is the recommended format
88
+ # to use since it will scale well with different DPI scaling.
89
+ #
90
+ # @note Because the image is never released, avoid creating new cursors for the same image for any
91
+ # given tool. Cache it and reuse it.
92
+ #
93
+ # @param [String] path
94
+ # File path to an image.
95
+ #
96
+ # @param [Integer] hot_x
97
+ # An x coordinate that is the "hotpoint" for the cursor
98
+ # computed from the left edge of your cursor image.
99
+ #
100
+ # @param [Integer] hot_y
101
+ # A y coordinate that is the "hotpoint" for the cursor
102
+ # computed from the top edge of the of your cursor image.
103
+ #
104
+ # @return [Integer] Id associated with the cursor.
105
+ # Use this with {UI.set_cursor} in {Sketchup::Tool#onSetCursor}.
106
+ #
107
+ # @see UI.set_cursor
108
+ #
109
+ # @see Sketchup::Tool#onSetCursor
110
+ #
111
+ # @version SketchUp 6.0
112
+ def self.create_cursor(path, hot_x, hot_y)
113
+ end
114
+
115
+ # Returns the plain text available on the clipboard, if there is any.
116
+ #
117
+ # @example
118
+ # text = UI.get_clipboard_data
119
+ #
120
+ # @return [String, nil]
121
+ #
122
+ # @version SketchUp 2023.1
123
+ def self.get_clipboard_data
124
+ end
125
+
126
+ # Creates a dialog box for inputting user information. The dialog box contains
127
+ # input fields with static text prompts, optional default values, optional
128
+ # drop down selections, and optional title.
129
+ #
130
+ # You can also use this method to display drop down lists of options, by
131
+ # passing an optional param.
132
+ #
133
+ # @example
134
+ # # With three params, it shows all text boxes:
135
+ # prompts = ["What is your Name?", "What is your Age?", "Gender"]
136
+ # defaults = ["Enter name", "", "Male"]
137
+ # input = UI.inputbox(prompts, defaults, "Tell me about yourself.")
138
+ #
139
+ # # With four params, it shows a drop down box for prompts that have
140
+ # # pipe-delimited lists of options. In this case, the Gender prompt
141
+ # # is a drop down instead of a text box.
142
+ # prompts = ["What is your Name?", "What is your Age?", "Gender"]
143
+ # defaults = ["Enter name", "", "Male"]
144
+ # list = ["", "", "Male|Female"]
145
+ # input = UI.inputbox(prompts, defaults, list, "Tell me about yourself.")
146
+ #
147
+ # @overload inputbox(prompts, defaults, title)
148
+ #
149
+ # @param [Array<String>] prompts
150
+ # An array of prompt names appearing in the input box
151
+ # adjacent to input fields.
152
+ # @param [Array<String>] defaults
153
+ # An array of default values for the input
154
+ # fields.
155
+ # @param [String] title
156
+ # The title for the input box.
157
+ #
158
+ # @overload inputbox(prompts, defaults, list, title)
159
+ #
160
+ # @param [Array<String>] prompts
161
+ # An array of prompt names appearing in the input box
162
+ # adjacent to input fields.
163
+ # @param [Array<String>] defaults
164
+ # An array of default values for the input
165
+ # fields.
166
+ # @param [String, Array<String>] list
167
+ # An array containing pipe-separated strings of options.
168
+ # @param [String] title
169
+ # The title for the input box.
170
+ #
171
+ # @return [Array<String>, false] An array of returned values if the user did
172
+ # not cancel the dialog. If the user canceled the
173
+ # dialog, false is returned. The returned values in the
174
+ # array will be in the same order as the input fields.
175
+ #
176
+ # @version SketchUp 6.0
177
+ def self.inputbox(*args)
178
+ end
179
+
180
+ # The {.inspector_names} method is used to returns the names of all the
181
+ # inspectors. Inspectors are another name for the various floating dialog
182
+ # windows that you can activate from withing SketchUp, such as the Materials
183
+ # window.
184
+ #
185
+ # @bug Prior to SketchUp 2022.0 "EntityInfo" was not listed.
186
+ #
187
+ # @example
188
+ # inspectors = UI.inspector_names
189
+ #
190
+ # @return [Array<String>] an array of strings containing the names
191
+ # of inspectors.
192
+ #
193
+ # @version SketchUp 6.0
194
+ def self.inspector_names
195
+ end
196
+
197
+ # The {.menu} method retrieves a SketchUp's menu object with a given name. This
198
+ # is the first step toward adding your own custom items to the bottom
199
+ # of SketchUp's menus.
200
+ #
201
+ # Valid menu names are: +'File'+, +'Edit'+, +'View'+, +'Camera'+, +'Draw'+,
202
+ # +'Tools'+, +'Window'+, +'Extensions'+, +'Help'+ and +'Developer'+.
203
+ #
204
+ # @bug In versions prior to SketchUp 2018 this would crash if you passed an
205
+ # empty string.
206
+ #
207
+ # @example
208
+ # tool_menu = UI.menu("Tools")
209
+ # tool_menu.add_item("Cheese Tool") {
210
+ # UI.messagebox("Cheese activated.")
211
+ # }
212
+ #
213
+ # @note The +'Extensions'+ menu was named +'Plugins'+ prior to SketchUp 2015.
214
+ # For backward compatibility +'Plugins'+ still works.
215
+ #
216
+ # @note +'Developer'+ menu was added with SketchUp 2021.1.
217
+ #
218
+ # @param [String] menu_name
219
+ # The name of a supported menu.
220
+ #
221
+ # @return [Sketchup::Menu]
222
+ #
223
+ # @version SketchUp 6.0
224
+ def self.menu(menu_name = "Extensions")
225
+ end
226
+
227
+ # Creates a dialog box containing static text with a series of buttons for
228
+ # the user to choose from.
229
+ #
230
+ # Valid message box types are:
231
+ # - +MB_OK+ - Contains an OK button.
232
+ # - +MB_OKCANCEL+ - Contains OK and Cancel buttons.
233
+ # - +MB_ABORTRETRYIGNORE+ - Contains Abort, Retry, and Ignore buttons.
234
+ # - +MB_YESNOCANCEL+ - Contains Yes, No, and Cancel buttons.
235
+ # - +MB_YESNO+ - Contains Yes and No buttons.
236
+ # - +MB_RETRYCANCEL+ - Contains Retry and Cancel buttons.
237
+ # - +MB_MULTILINE+ - Contains and OK button.
238
+ #
239
+ # Return values can be any of following:
240
+ # - +IDOK+
241
+ # - +IDCANCEL+
242
+ # - +IDABORT+
243
+ # - +IDRETRY+
244
+ # - +IDIGNORE+
245
+ # - +IDYES+
246
+ # - +IDNO+
247
+ #
248
+ # In an +MB_MULTILINE+ message box, the message is displayed as a multi-line
249
+ # message with scrollbars (as needed). +MB_MULTILNE+ also allows a third string
250
+ # argument that will be used as the title for the messagebox.
251
+ #
252
+ # @example
253
+ # result = UI.messagebox('Do you like cheese?', MB_YESNO)
254
+ # if result == IDYES
255
+ # UI.messagebox('SketchUp likes cheese too!')
256
+ # end
257
+ #
258
+ # @param [String] message
259
+ # The message that you want to display.
260
+ #
261
+ # @param [Integer] type
262
+ # The message box type, which will be a constant from
263
+ # the list in the method comments.
264
+ #
265
+ # @return [Integer] A number corresponding to what the user selected.
266
+ #
267
+ # @version SketchUp 6.0
268
+ def self.messagebox(message, type = MB_OK)
269
+ end
270
+
271
+ # The model_info_pages method is used to returns the names of all the
272
+ # available model info pages. These include UI windows such as Components,
273
+ # Credits, and Units.
274
+ #
275
+ # @example
276
+ # mypages = UI.model_info_pages
277
+ #
278
+ # @return [Array<String>] an array of strings containing the names of
279
+ # model info pages.
280
+ #
281
+ # @version SketchUp 6.0
282
+ def self.model_info_pages
283
+ end
284
+
285
+ # The {.openURL} method is used to open the default browser to a URL.
286
+ #
287
+ # @bug Before SketchUp 2019.3 the mac version would URL encode the given URL.
288
+ # This could inadvertently mangle some URLs, if for example if they had
289
+ # URL fragments (# character).
290
+ # The Windows version would not. As of SketchUp 2019.3 both platforms do
291
+ # not perform URL encoding and the API user is expected to provide a valid
292
+ # URL.
293
+ #
294
+ # @example
295
+ # status = UI.openURL("http://www.sketchup.com")
296
+ #
297
+ # @param [String] url
298
+ #
299
+ # @return [Boolean]
300
+ #
301
+ # @version SketchUp 6.0
302
+ def self.openURL(url)
303
+ end
304
+
305
+ # The {.openpanel} method is used to display the Open dialog box. The path that
306
+ # is returned can then be used inside code to open a text or image file.
307
+ # See the standard Ruby class File for examples of reading and writing from
308
+ # disk.
309
+ #
310
+ # @bug Fixed in SketchUp 2014: Wildcards were not working properly from SU7 to
311
+ # SU2013. Wildcard filters did not populate the file type dropdown. The filter
312
+ # string would be shown in the file name field with '*' characters converted to
313
+ # '_' characters. Note, the format of a wildcard filter string has been changed.
314
+ # See the description of the filename parameter below for details.
315
+ #
316
+ # @example
317
+ # chosen_image = UI.openpanel("Open SKP File", "c:/", "model.skp")
318
+ # chosen_image = UI.openpanel("Open Image File", "c:/", "Image Files|*.jpg;*.png;||")
319
+ # chosen_image = UI.openpanel("Open CAD File", "c:/", "DXF|*.dxf|DWG|*.dwg||")
320
+ #
321
+ # @param [String] title
322
+ # The title to apply to the open dialog box.
323
+ #
324
+ # @param [String] directory
325
+ # The default directory for the open panel.
326
+ #
327
+ # @param [String] filename
328
+ # The default filename for the open panel. On Windows, you
329
+ # can alternatively pass a wildcard filter using this
330
+ # format: UIname|wildcard||. Additional filter dropdown
331
+ # list items can be added by adding additional pairs of
332
+ # filter name and filter like this:
333
+ # UIname1|wildcard1|UIname2|wildcard2||.
334
+ # Also multiple wildcard filters can be combined into a
335
+ # single line using a semicolon-separated list in the
336
+ # filter field: ui_name|wildcard1;wildcard2||.
337
+ #
338
+ # @return [String] the full path and name of the file selected, or
339
+ # nil if the dialog was canceled.
340
+ #
341
+ # @see UI.savepanel
342
+ #
343
+ # @version SketchUp 6.0
344
+ def self.openpanel(title, directory, filename)
345
+ end
346
+
347
+ # The play_sound method is used to play a sound file. Valid sound files include
348
+ # .wav and .mp3 files on the Mac and .wav files on the PC.
349
+ #
350
+ # @example
351
+ # UI.play_sound "Plugins/mediadiscussion.wav"
352
+ #
353
+ # @param [String] filename
354
+ # the relative path to the filename from the SketchUp
355
+ # install directory, or an absolute path to the file. (See
356
+ # Sketchup.find_support_file for a way to search for a
357
+ # specific file.)
358
+ #
359
+ # @return [nil]
360
+ #
361
+ # @version SketchUp 6.0
362
+ def self.play_sound(filename)
363
+ end
364
+
365
+ # The preferences_pages method is used to returns the names of all the
366
+ # preferences pages. These include windows like Templates.
367
+ #
368
+ # [SketchUp 2017] <code>"Extensions"</code> page was removed.
369
+ #
370
+ # @example
371
+ # prefs = UI.preferences_pages
372
+ #
373
+ # @return [Array<String>] an array of strings containing the names
374
+ # of preference pages.
375
+ #
376
+ # @version SketchUp 6.0
377
+ def self.preferences_pages
378
+ end
379
+
380
+ # Tells SketchUp to refresh all inspectors such as the Component Browser and
381
+ # the Outliner. This is useful when you need to manually force a refresh after
382
+ # you've made a change to the document via Ruby. Generally, SketchUp will keep
383
+ # these in sync for you, but occasionally it does not, such as when
384
+ # model.start_operation has disabled UI updates.
385
+ #
386
+ # @example
387
+ # UI.refresh_inspectors
388
+ #
389
+ # @return [nil]
390
+ #
391
+ # @version SketchUp 7.0
392
+ def self.refresh_inspectors
393
+ end
394
+
395
+ # Tells SketchUp to refresh all floating toolbars. This is useful when you need
396
+ # to manually force a refresh after you've made a change to the document via
397
+ # Ruby. Generally, SketchUp will keep these in sync for you, but occasionally
398
+ # it does not, such as when {Sketchup::Model#start_operation} has disabled UI
399
+ # updates.
400
+ # This only affects macOS, on Windows the toolbars are always refreshing.
401
+ #
402
+ # @example
403
+ # UI.refresh_toolbars
404
+ #
405
+ # @return [nil]
406
+ #
407
+ # @version SketchUp 2018
408
+ def self.refresh_toolbars
409
+ end
410
+
411
+ # The {.savepanel} method is used to display the Save dialog box. The path that
412
+ # is returned can then be used inside code to save out a text or image file.
413
+ # See the standard Ruby class File for examples of reading and writing from
414
+ # disk.
415
+ #
416
+ # @bug Fixed in SketchUp 2014: Wildcards were not working properly from SU7 to
417
+ # SU2013. Semicolon-separated lists of wildcards did not populate the file type
418
+ # dropdown. The filter string would be shown in the file name field with '*'
419
+ # characters converted to '_' characters.
420
+ #
421
+ # @bug Fixed in SketchUp 2022.0: if +filename+ begins with a +*+ it crashes
422
+ # on macOS.
423
+ #
424
+ # @example
425
+ # path_to_save_to = UI.savepanel("Save Image File", "c:\\", "Shapes.jpg")
426
+ #
427
+ # @param [String] title
428
+ # The title to apply to the save dialog box.
429
+ #
430
+ # @param [String] directory
431
+ # The default directory for the save panel.
432
+ #
433
+ # @param [String] filename
434
+ # The default filename for the save panel. On Windows, you
435
+ # can alternatively pass a mask, like "*.txt", to have all
436
+ # the .txt files display. If you want multiple file types
437
+ # to display, you can supply multiple masks for the
438
+ # filename and separate them with a semicolon, like this:
439
+ # "*.txt;*.doc".
440
+ #
441
+ # @return [String] the full path and name of the file
442
+ # selected or nil if the dialog was canceled.
443
+ #
444
+ # @see UI.openpanel
445
+ #
446
+ # @version SketchUp 6.0
447
+ def self.savepanel(title, directory, filename)
448
+ end
449
+
450
+ # Returns the scaling factor SketchUp uses on high DPI monitors. Useful for
451
+ # things like {Sketchup::View#draw2d}.
452
+ #
453
+ # @example
454
+ # # Scale a set of points representing 2d screen points to account for high
455
+ # # DPI monitors.
456
+ # points2d = [
457
+ # Geom::Point3d.new(0, 0, 0),
458
+ # Geom::Point3d.new(8, 0, 0),
459
+ # Geom::Point3d.new(8, 4, 0),
460
+ # Geom::Point3d.new(0, 4, 0)
461
+ # ]
462
+ # tr = Geom::Transformation.scaling(UI.scale_factor)
463
+ # points2d.each { |point| point.transform!(tr)
464
+ #
465
+ # @note SU2017M0 will automatically scale up line width and text size, but will
466
+ # not scale up the points provided to {Sketchup::View#draw2d}.
467
+ #
468
+ # @return [Float]
469
+ #
470
+ # @version SketchUp 2017
471
+ def self.scale_factor
472
+ end
473
+
474
+ # The {.select_directory} method is used to display the OS dialog for selecting
475
+ # one or several directories from the file system.
476
+ #
477
+ # @example
478
+ # # Default title and folder:
479
+ # chosen_folder = UI.select_directory
480
+ #
481
+ # # Custom dialog title:
482
+ # chosen_folder = UI.select_directory(title: "Select Image Directory")
483
+ #
484
+ # # Force a start folder:
485
+ # chosen_folder = UI.select_directory(directory: "C:/images")
486
+ #
487
+ # # Allow multiple items to the selected:
488
+ # chosen_folder = UI.select_directory(select_multiple: true)
489
+ #
490
+ # # Custom dialog title and force a start folder:
491
+ # chosen_folder = UI.select_directory(
492
+ # title: "Select Image Directory",
493
+ # directory: "C:/images"
494
+ # )
495
+ #
496
+ # @option options [String] :title (nil) The title for the dialog.
497
+ #
498
+ # @option options [String] :directory (nil) Force the starting directory for the dialog. If not specified the last
499
+ # chosen directory will be used.
500
+ #
501
+ # @option options [Boolean] :select_multiple (false) Set to true to allow multiple items to be selected.
502
+ #
503
+ # @param [Hash] options
504
+ # The dialog can be customized by providing a hash or named arguments of
505
+ # options.
506
+ #
507
+ # @return [String, Array<String>, nil] A string with the full path of the
508
+ # directory selected when
509
+ # :select_multiple option is set to
510
+ # false otherwise an array of strings
511
+ # or nil if the user cancelled.
512
+ #
513
+ # @version SketchUp 2015
514
+ def self.select_directory(options = {})
515
+ end
516
+
517
+ # Copies plain text to the clipboard.
518
+ #
519
+ # @example
520
+ # UI.set_clipboard_data('Hello World')
521
+ #
522
+ # @return [Boolean]
523
+ #
524
+ # @version SketchUp 2023.1
525
+ def self.set_clipboard_data(data)
526
+ end
527
+
528
+ # The {.set_cursor} method is used to change the cursor to a new cursor with a
529
+ # given cursor id. See UI.create_cursor and the Tool class for details
530
+ # on creating your own tools with arbitrary cursors.
531
+ #
532
+ # If you call this while a standard SketchUp tool is active, you will not
533
+ # see your custom cursor, as these tools are constantly setting their
534
+ # own cursors to indicate SketchUp's state.
535
+ #
536
+ # @example
537
+ # def onSetCursor
538
+ # UI.set_cursor(cursor_id)
539
+ # end
540
+ #
541
+ # @param [Integer] cursor_id
542
+ # The id of the cursor you want to display.
543
+ #
544
+ # @return [Boolean]
545
+ #
546
+ # @version SketchUp 6.0
547
+ def self.set_cursor(cursor_id)
548
+ end
549
+
550
+ # The set_toolbar_visible method is used to set whether a given toolbar is
551
+ # visible. Note that the toolbars and their names are different on the
552
+ # Mac vs. PC, so be careful and be sure to test when using this method in a
553
+ # cross-platform script.
554
+ #
555
+ # @example
556
+ # status = UI.set_toolbar_visible("Camera", true)
557
+ #
558
+ # @param [String] name
559
+ # The name of a Ruby toolbar.
560
+ #
561
+ # @param [Boolean] visible
562
+ # True to make the toolbar visible, false to hide it.
563
+ #
564
+ # @return [Boolean] true if successful, false if not.
565
+ #
566
+ # @version SketchUp 6.0
567
+ def self.set_toolbar_visible(name, visible)
568
+ end
569
+
570
+ # The +show_extension_manager+ method is used to display the Extension Manager
571
+ # dialog.
572
+ #
573
+ # @example
574
+ # UI.show_extension_manager
575
+ #
576
+ # @return [nil]
577
+ #
578
+ # @version SketchUp 2017
579
+ def self.show_extension_manager
580
+ end
581
+
582
+ # The {.show_inspector} method is used to display the inspector with the given
583
+ # name. You can get the list of valid inspectors with UI.inspector_names.
584
+ #
585
+ # @bug Prior to SketchUp 2022.0 "EntityInfo" was not a supported parameter.
586
+ #
587
+ # @example
588
+ # status = UI.show_inspector("Components")
589
+ #
590
+ # @param [String] name
591
+ # The name of inspector that you want to display.
592
+ #
593
+ # @return [Boolean] true if successful, false if unsuccessful
594
+ #
595
+ # @version SketchUp 6.0
596
+ def self.show_inspector(name)
597
+ end
598
+
599
+ # The {.show_model_info} method is used to display the model info dialog for a
600
+ # specific page. You can get the list of valid page names with {UI.model_info_pages}.
601
+ #
602
+ # [SketchUp 2014] <code>"Classifications"</code> page was added.
603
+ #
604
+ # @bug Until SketchUp 2021.1 SketchUp on Mac didn't display the desired page in,
605
+ # but only selected it in the navigation.
606
+ #
607
+ # @bug Until SketchUp 2021.1 SketchUp on Mac didn't accept English page names on localized builds.
608
+ #
609
+ # @example
610
+ # UI.show_model_info('Credits')
611
+ #
612
+ # @param [String] page_name
613
+ # The name of the model info dialog you want to display.
614
+ #
615
+ # @return [Boolean]
616
+ #
617
+ # @version SketchUp 6.0
618
+ def self.show_model_info(page_name)
619
+ end
620
+
621
+ # The show_preferences method is used to display a SketchUp preferences dialog.
622
+ # You can get the list of valid dialogs with {UI.preferences_pages}.
623
+ #
624
+ # @bug Under OSX this method doesn't currently work.
625
+ #
626
+ # @example
627
+ # status = UI.show_preferences('GraphicsCard')
628
+ #
629
+ # @param [String] page_name
630
+ # The name of the preferences dialog you want to display.
631
+ #
632
+ # @return [Boolean] true
633
+ #
634
+ # @version SketchUp 6.0
635
+ def self.show_preferences(page_name)
636
+ end
637
+
638
+ # The start_timer method is used to start a timer. This is an effective method
639
+ # to create a repeating snippet of code for arbitrary animation.
640
+ #
641
+ # See this blog post for an detailed example of custom animation using timers:
642
+ # http://sketchupapi.blogspot.com/2008/10/animate-yo-cheese.html
643
+ #
644
+ # Note that there is a bug that if you open a modal window in a non-repeating
645
+ # timer the timer will repeat until the window is closed.
646
+ #
647
+ # @example
648
+ # # Beep once after 10 seconds.
649
+ # id = UI.start_timer(10, false) { UI.beep }
650
+ #
651
+ # @param [Numeric] seconds
652
+ # The time in seconds before your code should be called.
653
+ #
654
+ # @param [Boolean] repeat
655
+ # true if you want the timer to repeat, false
656
+ # (or omit) if you do not want it to repeat.
657
+ #
658
+ # @return [Integer] a timer ID
659
+ #
660
+ # @version SketchUp 6.0
661
+ #
662
+ # @yield [procedure] The procedure you want to execute after seconds has
663
+ # expired.
664
+ def self.start_timer(seconds, repeat = false)
665
+ end
666
+
667
+ # The stop_timer method is used to stop a timer based on its id.
668
+ #
669
+ # @example
670
+ # # Stop timer before it triggers.
671
+ # id = UI.start_timer(10) { UI.beep }
672
+ # UI.stop_timer(id)
673
+ #
674
+ # @param [Integer] id
675
+ # The timer id for the timer that you want to stop.
676
+ #
677
+ # @return [nil]
678
+ #
679
+ # @version SketchUp 6.0
680
+ def self.stop_timer(id)
681
+ end
682
+
683
+ # The toolbar method is used to get a Ruby toolbar by name. If the toolbar
684
+ # doesn't exist a new one will be created.
685
+ #
686
+ # @example
687
+ # toolbar = UI.toolbar('Test')
688
+ #
689
+ # @param [String] name
690
+ # The name of the Ruby toolbar.
691
+ #
692
+ # @return [UI::Toolbar] a Toolbar object
693
+ #
694
+ # @version SketchUp 6.0
695
+ def self.toolbar(name)
696
+ end
697
+
698
+ # The toolbar_names method is used to return the name of all the available
699
+ # native toolbars (this differs between PC and Mac). These toolbar names
700
+ # do not include Ruby toolbars.
701
+ #
702
+ # @example
703
+ # names = UI.toolbar_names
704
+ #
705
+ # @return [Array<String>] Array of strings representing toolbar names.
706
+ #
707
+ # @version SketchUp 6.0
708
+ def self.toolbar_names
709
+ end
710
+
711
+ # The toolbar_visible? method is used to determine whether a given toolbar is
712
+ # visible. Note that the toolbars and their names are different on the
713
+ # Mac vs. PC, so be careful and be sure to test when using this method in a
714
+ # cross-platform script.
715
+ #
716
+ # @example
717
+ # status = UI.toolbar_visible?("Camera")
718
+ #
719
+ # @param [String] name
720
+ # The name of a native toolbar.
721
+ #
722
+ # @return [Boolean]
723
+ #
724
+ # @version SketchUp 6.0
725
+ def self.toolbar_visible?(name)
726
+ end
727
+
728
+ end