sketchup-api-stubs 0.6.1 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +2 -0
- data/lib/sketchup-api-stubs.rb +1 -1
- data/lib/sketchup-api-stubs/sketchup.rb +145 -145
- data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +318 -318
- data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +172 -172
- data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +126 -126
- data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
- data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +400 -401
- data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +661 -661
- data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +492 -492
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +478 -478
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +263 -263
- data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +141 -141
- data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +522 -523
- data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +691 -691
- data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +573 -569
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +411 -411
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +174 -186
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +514 -455
- data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
- data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +143 -155
- data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +353 -359
- data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +349 -349
- data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -123
- data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
- data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -86
- data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +371 -371
- data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +218 -218
- data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +128 -128
- data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +220 -232
- data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +567 -563
- data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +10 -10
- data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +11 -11
- data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +183 -183
- data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +387 -387
- data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +204 -216
- data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +344 -344
- data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +174 -174
- data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +694 -547
- data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1519 -1519
- data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
- data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
- data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
- data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +140 -140
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +157 -157
- data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +209 -209
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +152 -152
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +281 -281
- data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +328 -328
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +577 -577
- data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
- data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +122 -122
- data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +281 -281
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +562 -554
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +593 -593
- data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +257 -257
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
- data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +194 -194
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +329 -329
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +72 -72
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +102 -102
- data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +165 -165
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +312 -312
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +38 -38
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
- data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +390 -390
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +508 -508
- data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1119 -1097
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +125 -125
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +544 -537
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +59 -59
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +125 -125
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +750 -750
- data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +104 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +697 -697
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +285 -285
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +62 -62
- data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +409 -409
- data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +226 -226
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +190 -190
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +393 -393
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +82 -82
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +303 -303
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +285 -262
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +244 -231
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +136 -136
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +48 -48
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +112 -123
- data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +416 -416
- data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +311 -311
- data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +141 -141
- data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +95 -95
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1638 -1483
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +356 -356
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +132 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +284 -282
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +770 -650
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +76 -76
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +456 -456
- data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +364 -356
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +44 -44
- data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +454 -454
- data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
- data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +212 -212
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +257 -257
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +57 -57
- data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +69 -69
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +211 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +262 -262
- data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +225 -225
- data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +829 -829
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +154 -154
- data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +61 -61
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1301 -995
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +43 -43
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +310 -310
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +356 -356
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +229 -229
- data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +240 -240
- data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +633 -633
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +311 -303
- data/lib/sketchup-api-stubs/stubs/array.rb +741 -741
- data/lib/sketchup-api-stubs/stubs/geom.rb +348 -233
- data/lib/sketchup-api-stubs/stubs/languagehandler.rb +92 -92
- data/lib/sketchup-api-stubs/stubs/length.rb +278 -262
- data/lib/sketchup-api-stubs/stubs/numeric.rb +249 -249
- data/lib/sketchup-api-stubs/stubs/sketchup.rb +1310 -1310
- data/lib/sketchup-api-stubs/stubs/sketchupextension.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/string.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/ui.rb +667 -660
- metadata +2 -16
@@ -1,24 +1,24 @@
|
|
1
|
-
# Copyright:: Copyright
|
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
|
1
|
+
# Copyright:: Copyright 2020 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
|
@@ -1,660 +1,667 @@
|
|
1
|
-
# Copyright:: Copyright
|
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] filename
|
74
|
-
# Filename for 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(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
|
-
# @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
|
-
# @example
|
154
|
-
# inspectors = UI.inspector_names
|
155
|
-
#
|
156
|
-
# @return [Array<String>] an array of strings containing the names
|
157
|
-
# of inspectors.
|
158
|
-
#
|
159
|
-
# @version SketchUp 6.0
|
160
|
-
def self.inspector_names
|
161
|
-
end
|
162
|
-
|
163
|
-
# The {.menu} method retrieves a SketchUp's menu object with a given name. This
|
164
|
-
# is the first step toward adding your own custom items to the bottom
|
165
|
-
# of SketchUp's menus.
|
166
|
-
#
|
167
|
-
# Valid menu names are: "File", "Edit", "View", "Camera", "Draw", "Tools",
|
168
|
-
# "Window", "Extensions" and "Help".
|
169
|
-
#
|
170
|
-
# @example
|
171
|
-
# tool_menu = UI.menu("Tools")
|
172
|
-
# tool_menu.add_item("Cheese Tool") {
|
173
|
-
# UI.messagebox("Cheese activated.")
|
174
|
-
# }
|
175
|
-
#
|
176
|
-
# @note The "Extensions" menu was named "Plugins" prior to SketchUp 2015.
|
177
|
-
# For backward compatibility "Plugins" still works.
|
178
|
-
#
|
179
|
-
# @note In versions prior to SketchUp 2018 this would crash if you passed an
|
180
|
-
# empty string.
|
181
|
-
#
|
182
|
-
# @param menu_name
|
183
|
-
# The name of an existing top level menu.
|
184
|
-
#
|
185
|
-
# @return [Sketchup::Menu]
|
186
|
-
#
|
187
|
-
# @version SketchUp 6.0
|
188
|
-
def self.menu(menu_name = "Plugins")
|
189
|
-
end
|
190
|
-
|
191
|
-
# Creates a dialog box containing static text with a series of buttons for
|
192
|
-
# the user to choose from.
|
193
|
-
#
|
194
|
-
# Valid message box types are:
|
195
|
-
# - +MB_OK+ - Contains an OK button.
|
196
|
-
# - +MB_OKCANCEL+ - Contains OK and Cancel buttons.
|
197
|
-
# - +MB_ABORTRETRYIGNORE+ - Contains Abort, Retry, and Ignore buttons.
|
198
|
-
# - +MB_YESNOCANCEL+ - Contains Yes, No, and Cancel buttons.
|
199
|
-
# - +MB_YESNO+ - Contains Yes and No buttons.
|
200
|
-
# - +MB_RETRYCANCEL+ - Contains Retry and Cancel buttons.
|
201
|
-
# - +MB_MULTILINE+ - Contains and OK button.
|
202
|
-
#
|
203
|
-
# Return values can be any of following:
|
204
|
-
# - +IDOK+
|
205
|
-
# - +IDCANCEL+
|
206
|
-
# - +IDABORT+
|
207
|
-
# - +IDRETRY+
|
208
|
-
# - +IDIGNORE+
|
209
|
-
# - +IDYES+
|
210
|
-
# - +IDNO+
|
211
|
-
#
|
212
|
-
# In an +MB_MULTILINE+ message box, the message is displayed as a multi-line
|
213
|
-
# message with scrollbars (as needed). +MB_MULTILNE+ also allows a third string
|
214
|
-
# argument that will be used as the title for the messagebox.
|
215
|
-
#
|
216
|
-
# @example
|
217
|
-
# result = UI.messagebox('Do you like cheese?', MB_YESNO)
|
218
|
-
# if result == IDYES
|
219
|
-
# UI.messagebox('SketchUp likes cheese too!')
|
220
|
-
# end
|
221
|
-
#
|
222
|
-
# @param [String] message
|
223
|
-
# The message that you want to display.
|
224
|
-
#
|
225
|
-
# @param [Integer] type
|
226
|
-
# The message box type, which will be a constant from
|
227
|
-
# the list in the method comments.
|
228
|
-
#
|
229
|
-
# @return [Integer] A number corresponding to what the user selected.
|
230
|
-
#
|
231
|
-
# @version SketchUp 6.0
|
232
|
-
def self.messagebox(message, type = MB_OK)
|
233
|
-
end
|
234
|
-
|
235
|
-
# The model_info_pages method is used to returns the names of all the
|
236
|
-
# available model info pages. These include UI windows such as Components,
|
237
|
-
# Credits, and Units.
|
238
|
-
#
|
239
|
-
# @example
|
240
|
-
# mypages = UI.model_info_pages
|
241
|
-
#
|
242
|
-
# @return [Array<String>] an array of strings containing the names of
|
243
|
-
# model info pages.
|
244
|
-
#
|
245
|
-
# @version SketchUp 6.0
|
246
|
-
def self.model_info_pages
|
247
|
-
end
|
248
|
-
|
249
|
-
# The {.openURL} method is used to open the default
|
250
|
-
#
|
251
|
-
# @
|
252
|
-
#
|
253
|
-
#
|
254
|
-
#
|
255
|
-
#
|
256
|
-
#
|
257
|
-
#
|
258
|
-
# @
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
#
|
263
|
-
#
|
264
|
-
#
|
265
|
-
#
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
#
|
270
|
-
#
|
271
|
-
#
|
272
|
-
#
|
273
|
-
#
|
274
|
-
#
|
275
|
-
#
|
276
|
-
#
|
277
|
-
#
|
278
|
-
#
|
279
|
-
#
|
280
|
-
#
|
281
|
-
#
|
282
|
-
#
|
283
|
-
#
|
284
|
-
#
|
285
|
-
#
|
286
|
-
#
|
287
|
-
#
|
288
|
-
#
|
289
|
-
#
|
290
|
-
#
|
291
|
-
#
|
292
|
-
#
|
293
|
-
# filter
|
294
|
-
#
|
295
|
-
#
|
296
|
-
#
|
297
|
-
#
|
298
|
-
#
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
#
|
303
|
-
#
|
304
|
-
#
|
305
|
-
# @
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
#
|
310
|
-
#
|
311
|
-
#
|
312
|
-
#
|
313
|
-
#
|
314
|
-
#
|
315
|
-
#
|
316
|
-
#
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
#
|
321
|
-
#
|
322
|
-
#
|
323
|
-
# @
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
#
|
328
|
-
#
|
329
|
-
#
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
#
|
334
|
-
#
|
335
|
-
#
|
336
|
-
#
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
#
|
341
|
-
#
|
342
|
-
#
|
343
|
-
#
|
344
|
-
#
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
#
|
349
|
-
#
|
350
|
-
#
|
351
|
-
#
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
#
|
356
|
-
#
|
357
|
-
#
|
358
|
-
#
|
359
|
-
#
|
360
|
-
#
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
#
|
365
|
-
#
|
366
|
-
#
|
367
|
-
#
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
#
|
372
|
-
#
|
373
|
-
#
|
374
|
-
#
|
375
|
-
#
|
376
|
-
#
|
377
|
-
#
|
378
|
-
#
|
379
|
-
#
|
380
|
-
#
|
381
|
-
#
|
382
|
-
#
|
383
|
-
#
|
384
|
-
#
|
385
|
-
#
|
386
|
-
#
|
387
|
-
#
|
388
|
-
#
|
389
|
-
#
|
390
|
-
#
|
391
|
-
#
|
392
|
-
#
|
393
|
-
#
|
394
|
-
#
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
#
|
399
|
-
#
|
400
|
-
#
|
401
|
-
# @
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
#
|
406
|
-
#
|
407
|
-
#
|
408
|
-
#
|
409
|
-
#
|
410
|
-
#
|
411
|
-
# points2d
|
412
|
-
#
|
413
|
-
#
|
414
|
-
#
|
415
|
-
#
|
416
|
-
#
|
417
|
-
#
|
418
|
-
#
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
#
|
423
|
-
#
|
424
|
-
#
|
425
|
-
# @
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
#
|
430
|
-
#
|
431
|
-
#
|
432
|
-
#
|
433
|
-
#
|
434
|
-
#
|
435
|
-
#
|
436
|
-
#
|
437
|
-
#
|
438
|
-
#
|
439
|
-
#
|
440
|
-
#
|
441
|
-
#
|
442
|
-
#
|
443
|
-
#
|
444
|
-
#
|
445
|
-
#
|
446
|
-
#
|
447
|
-
#
|
448
|
-
#
|
449
|
-
#
|
450
|
-
#
|
451
|
-
# @
|
452
|
-
#
|
453
|
-
#
|
454
|
-
#
|
455
|
-
#
|
456
|
-
#
|
457
|
-
#
|
458
|
-
#
|
459
|
-
#
|
460
|
-
#
|
461
|
-
#
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
#
|
466
|
-
#
|
467
|
-
#
|
468
|
-
#
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
#
|
473
|
-
#
|
474
|
-
#
|
475
|
-
#
|
476
|
-
#
|
477
|
-
#
|
478
|
-
#
|
479
|
-
#
|
480
|
-
#
|
481
|
-
#
|
482
|
-
#
|
483
|
-
#
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
#
|
488
|
-
#
|
489
|
-
#
|
490
|
-
#
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
#
|
495
|
-
#
|
496
|
-
#
|
497
|
-
#
|
498
|
-
#
|
499
|
-
#
|
500
|
-
#
|
501
|
-
#
|
502
|
-
#
|
503
|
-
#
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
#
|
508
|
-
#
|
509
|
-
#
|
510
|
-
# @
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
#
|
515
|
-
#
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
#
|
520
|
-
#
|
521
|
-
#
|
522
|
-
# @
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
#
|
527
|
-
#
|
528
|
-
#
|
529
|
-
#
|
530
|
-
#
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
#
|
535
|
-
#
|
536
|
-
#
|
537
|
-
#
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
#
|
542
|
-
#
|
543
|
-
#
|
544
|
-
#
|
545
|
-
#
|
546
|
-
#
|
547
|
-
#
|
548
|
-
#
|
549
|
-
#
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
#
|
554
|
-
#
|
555
|
-
#
|
556
|
-
#
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
#
|
561
|
-
#
|
562
|
-
#
|
563
|
-
#
|
564
|
-
#
|
565
|
-
#
|
566
|
-
#
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
#
|
571
|
-
#
|
572
|
-
#
|
573
|
-
#
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
#
|
578
|
-
#
|
579
|
-
#
|
580
|
-
#
|
581
|
-
#
|
582
|
-
#
|
583
|
-
#
|
584
|
-
#
|
585
|
-
#
|
586
|
-
# @
|
587
|
-
#
|
588
|
-
# (
|
589
|
-
#
|
590
|
-
# @
|
591
|
-
#
|
592
|
-
#
|
593
|
-
#
|
594
|
-
#
|
595
|
-
#
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
#
|
600
|
-
#
|
601
|
-
# @
|
602
|
-
#
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
#
|
607
|
-
#
|
608
|
-
#
|
609
|
-
#
|
610
|
-
#
|
611
|
-
#
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
#
|
616
|
-
#
|
617
|
-
#
|
618
|
-
# @
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
#
|
623
|
-
#
|
624
|
-
#
|
625
|
-
#
|
626
|
-
#
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
#
|
631
|
-
#
|
632
|
-
#
|
633
|
-
#
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
#
|
638
|
-
#
|
639
|
-
#
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
#
|
644
|
-
#
|
645
|
-
#
|
646
|
-
#
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
#
|
651
|
-
#
|
652
|
-
#
|
653
|
-
#
|
654
|
-
#
|
655
|
-
#
|
656
|
-
#
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
1
|
+
# Copyright:: Copyright 2020 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] filename
|
74
|
+
# Filename for 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(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
|
+
# @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
|
+
# @example
|
154
|
+
# inspectors = UI.inspector_names
|
155
|
+
#
|
156
|
+
# @return [Array<String>] an array of strings containing the names
|
157
|
+
# of inspectors.
|
158
|
+
#
|
159
|
+
# @version SketchUp 6.0
|
160
|
+
def self.inspector_names
|
161
|
+
end
|
162
|
+
|
163
|
+
# The {.menu} method retrieves a SketchUp's menu object with a given name. This
|
164
|
+
# is the first step toward adding your own custom items to the bottom
|
165
|
+
# of SketchUp's menus.
|
166
|
+
#
|
167
|
+
# Valid menu names are: "File", "Edit", "View", "Camera", "Draw", "Tools",
|
168
|
+
# "Window", "Extensions" and "Help".
|
169
|
+
#
|
170
|
+
# @example
|
171
|
+
# tool_menu = UI.menu("Tools")
|
172
|
+
# tool_menu.add_item("Cheese Tool") {
|
173
|
+
# UI.messagebox("Cheese activated.")
|
174
|
+
# }
|
175
|
+
#
|
176
|
+
# @note The "Extensions" menu was named "Plugins" prior to SketchUp 2015.
|
177
|
+
# For backward compatibility "Plugins" still works.
|
178
|
+
#
|
179
|
+
# @note In versions prior to SketchUp 2018 this would crash if you passed an
|
180
|
+
# empty string.
|
181
|
+
#
|
182
|
+
# @param menu_name
|
183
|
+
# The name of an existing top level menu.
|
184
|
+
#
|
185
|
+
# @return [Sketchup::Menu]
|
186
|
+
#
|
187
|
+
# @version SketchUp 6.0
|
188
|
+
def self.menu(menu_name = "Plugins")
|
189
|
+
end
|
190
|
+
|
191
|
+
# Creates a dialog box containing static text with a series of buttons for
|
192
|
+
# the user to choose from.
|
193
|
+
#
|
194
|
+
# Valid message box types are:
|
195
|
+
# - +MB_OK+ - Contains an OK button.
|
196
|
+
# - +MB_OKCANCEL+ - Contains OK and Cancel buttons.
|
197
|
+
# - +MB_ABORTRETRYIGNORE+ - Contains Abort, Retry, and Ignore buttons.
|
198
|
+
# - +MB_YESNOCANCEL+ - Contains Yes, No, and Cancel buttons.
|
199
|
+
# - +MB_YESNO+ - Contains Yes and No buttons.
|
200
|
+
# - +MB_RETRYCANCEL+ - Contains Retry and Cancel buttons.
|
201
|
+
# - +MB_MULTILINE+ - Contains and OK button.
|
202
|
+
#
|
203
|
+
# Return values can be any of following:
|
204
|
+
# - +IDOK+
|
205
|
+
# - +IDCANCEL+
|
206
|
+
# - +IDABORT+
|
207
|
+
# - +IDRETRY+
|
208
|
+
# - +IDIGNORE+
|
209
|
+
# - +IDYES+
|
210
|
+
# - +IDNO+
|
211
|
+
#
|
212
|
+
# In an +MB_MULTILINE+ message box, the message is displayed as a multi-line
|
213
|
+
# message with scrollbars (as needed). +MB_MULTILNE+ also allows a third string
|
214
|
+
# argument that will be used as the title for the messagebox.
|
215
|
+
#
|
216
|
+
# @example
|
217
|
+
# result = UI.messagebox('Do you like cheese?', MB_YESNO)
|
218
|
+
# if result == IDYES
|
219
|
+
# UI.messagebox('SketchUp likes cheese too!')
|
220
|
+
# end
|
221
|
+
#
|
222
|
+
# @param [String] message
|
223
|
+
# The message that you want to display.
|
224
|
+
#
|
225
|
+
# @param [Integer] type
|
226
|
+
# The message box type, which will be a constant from
|
227
|
+
# the list in the method comments.
|
228
|
+
#
|
229
|
+
# @return [Integer] A number corresponding to what the user selected.
|
230
|
+
#
|
231
|
+
# @version SketchUp 6.0
|
232
|
+
def self.messagebox(message, type = MB_OK)
|
233
|
+
end
|
234
|
+
|
235
|
+
# The model_info_pages method is used to returns the names of all the
|
236
|
+
# available model info pages. These include UI windows such as Components,
|
237
|
+
# Credits, and Units.
|
238
|
+
#
|
239
|
+
# @example
|
240
|
+
# mypages = UI.model_info_pages
|
241
|
+
#
|
242
|
+
# @return [Array<String>] an array of strings containing the names of
|
243
|
+
# model info pages.
|
244
|
+
#
|
245
|
+
# @version SketchUp 6.0
|
246
|
+
def self.model_info_pages
|
247
|
+
end
|
248
|
+
|
249
|
+
# The {.openURL} method is used to open the default browser to a URL.
|
250
|
+
#
|
251
|
+
# @bug Before SketchUp 2019.3 the mac version would URL encode the given URL.
|
252
|
+
# This could inadvertently mangle some URLs, if for example if they had
|
253
|
+
# URL fragments (# character).
|
254
|
+
# The Windows version would not. As of SketchUp 2019.3 both platforms do
|
255
|
+
# not perform URL encoding and the API user is expected to provide a valid
|
256
|
+
# URL.
|
257
|
+
#
|
258
|
+
# @example
|
259
|
+
# status = UI.openURL("http://www.sketchup.com")
|
260
|
+
#
|
261
|
+
# @param [String] url
|
262
|
+
#
|
263
|
+
# @return [Boolean]
|
264
|
+
#
|
265
|
+
# @version SketchUp 6.0
|
266
|
+
def self.openURL(url)
|
267
|
+
end
|
268
|
+
|
269
|
+
# The openpanel method is used to display the Open dialog box. The path that
|
270
|
+
# is returned can then be used inside code to open a text or image file.
|
271
|
+
# See the standard Ruby class File for examples of reading and writing from
|
272
|
+
# disk.
|
273
|
+
#
|
274
|
+
# Bug Fixed in SketchUp 2014: Wildcards were not working properly from SU7 to
|
275
|
+
# SU2013. Wildcard filters did not populate the file type dropdown. The filter
|
276
|
+
# string would be shown in the file name field with '*' characters converted to
|
277
|
+
# '_' characters. Note, the format of a wildcard filter string has been changed.
|
278
|
+
# See the description of the filename parameter below for details.
|
279
|
+
#
|
280
|
+
# @example
|
281
|
+
# chosen_image = UI.openpanel("Open SKP File", "c:/", "model.skp")
|
282
|
+
# chosen_image = UI.openpanel("Open Image File", "c:/", "Image Files|*.jpg;*.png;||")
|
283
|
+
# chosen_image = UI.openpanel("Open CAD File", "c:/", "DXF|*.dxf|DWG|*.dwg||")
|
284
|
+
#
|
285
|
+
# @param [String] title
|
286
|
+
# The title to apply to the open dialog box.
|
287
|
+
#
|
288
|
+
# @param [String] directory
|
289
|
+
# The default directory for the open panel.
|
290
|
+
#
|
291
|
+
# @param [String] filename
|
292
|
+
# The default filename for the open panel. On Windows, you
|
293
|
+
# can alternatively pass a wildcard filter using this
|
294
|
+
# format: UIname|wildcard||. Additional filter dropdown
|
295
|
+
# list items can be added by adding additional pairs of
|
296
|
+
# filter name and filter like this:
|
297
|
+
# UIname1|wildcard1|UIname2|wildcard2||.
|
298
|
+
# Also multiple wildcard filters can be combined into a
|
299
|
+
# single line using a semicolon-separated list in the
|
300
|
+
# filter field: ui_name|wildcard1;wildcard2||.
|
301
|
+
#
|
302
|
+
# @return [String] the full path and name of the file selected, or
|
303
|
+
# nil if the dialog was canceled.
|
304
|
+
#
|
305
|
+
# @version SketchUp 6.0
|
306
|
+
def self.openpanel(title, directory, filename)
|
307
|
+
end
|
308
|
+
|
309
|
+
# The play_sound method is used to play a sound file. Valid sound files include
|
310
|
+
# .wav and .mp3 files on the Mac and .wav files on the PC.
|
311
|
+
#
|
312
|
+
# @example
|
313
|
+
# UI.play_sound "Plugins/mediadiscussion.wav"
|
314
|
+
#
|
315
|
+
# @param [String] filename
|
316
|
+
# the relative path to the filename from the SketchUp
|
317
|
+
# install directory, or an absolute path to the file. (See
|
318
|
+
# Sketchup.find_support_file for a way to search for a
|
319
|
+
# specific file.)
|
320
|
+
#
|
321
|
+
# @return [nil]
|
322
|
+
#
|
323
|
+
# @version SketchUp 6.0
|
324
|
+
def self.play_sound(filename)
|
325
|
+
end
|
326
|
+
|
327
|
+
# The preferences_pages method is used to returns the names of all the
|
328
|
+
# preferences pages. These include windows like Extensions.
|
329
|
+
#
|
330
|
+
# @example
|
331
|
+
# prefs = UI.preferences_pages
|
332
|
+
#
|
333
|
+
# @return [Array<String>] an array of strings containing the names
|
334
|
+
# of preference pages.
|
335
|
+
#
|
336
|
+
# @version SketchUp 6.0
|
337
|
+
def self.preferences_pages
|
338
|
+
end
|
339
|
+
|
340
|
+
# Tells SketchUp to refresh all inspectors such as the Component Browser and
|
341
|
+
# the Outliner. This is useful when you need to manually force a refresh after
|
342
|
+
# you've made a change to the document via Ruby. Generally, SketchUp will keep
|
343
|
+
# these in sync for you, but occasionally it does not, such as when
|
344
|
+
# model.start_operation has disabled UI updates.
|
345
|
+
#
|
346
|
+
# @example
|
347
|
+
# UI.refresh_inspectors
|
348
|
+
#
|
349
|
+
# @return [nil]
|
350
|
+
#
|
351
|
+
# @version SketchUp 7.0
|
352
|
+
def self.refresh_inspectors
|
353
|
+
end
|
354
|
+
|
355
|
+
# Tells SketchUp to refresh all floating toolbars. This is useful when you need
|
356
|
+
# to manually force a refresh after you've made a change to the document via
|
357
|
+
# Ruby. Generally, SketchUp will keep these in sync for you, but occasionally
|
358
|
+
# it does not, such as when {Sketchup::Model#start_operation} has disabled UI
|
359
|
+
# updates.
|
360
|
+
# This only affects macOS, on Windows the toolbars are always refreshing.
|
361
|
+
#
|
362
|
+
# @example
|
363
|
+
# UI.refresh_toolbars
|
364
|
+
#
|
365
|
+
# @return [nil]
|
366
|
+
#
|
367
|
+
# @version SketchUp 2018
|
368
|
+
def self.refresh_toolbars
|
369
|
+
end
|
370
|
+
|
371
|
+
# The savepanel method is used to display the Save dialog box. The path that
|
372
|
+
# is returned can then be used inside code to save out a text or image file.
|
373
|
+
# See the standard Ruby class File for examples of reading and writing from
|
374
|
+
# disk.
|
375
|
+
#
|
376
|
+
# Bug Fixed in SketchUp 2014: Wildcards were not working properly from SU7 to
|
377
|
+
# SU2013. Semicolon-separated lists of wildcards did not populate the file type
|
378
|
+
# dropdown. The filter string would be shown in the file name field with '*'
|
379
|
+
# characters converted to '_' characters.
|
380
|
+
#
|
381
|
+
# @example
|
382
|
+
# path_to_save_to = UI.savepanel("Save Image File", "c:\\", "Shapes.jpg")
|
383
|
+
#
|
384
|
+
# @param [String] title
|
385
|
+
# The title to apply to the save dialog box.
|
386
|
+
#
|
387
|
+
# @param [String] directory
|
388
|
+
# The default directory for the save panel.
|
389
|
+
#
|
390
|
+
# @param [String] filename
|
391
|
+
# The default filename for the save panel. On Windows, you
|
392
|
+
# can alternatively pass a mask, like "*.txt", to have all
|
393
|
+
# the .txt files display. If you want multiple file types
|
394
|
+
# to display, you can supply multiple masks for the
|
395
|
+
# filename and separate them with a semicolon, like this:
|
396
|
+
# "*.txt;*.doc".
|
397
|
+
#
|
398
|
+
# @return [String] the full path and name of the file
|
399
|
+
# selected or nil if the dialog was canceled.
|
400
|
+
#
|
401
|
+
# @version SketchUp 6.0
|
402
|
+
def self.savepanel(title, directory, filename)
|
403
|
+
end
|
404
|
+
|
405
|
+
# Returns the scaling factor SketchUp uses on high DPI monitors. Useful for
|
406
|
+
# things like {Sketchup::View#draw2d}.
|
407
|
+
#
|
408
|
+
# @example
|
409
|
+
# # Scale a set of points representing 2d screen points to account for high
|
410
|
+
# # DPI monitors.
|
411
|
+
# points2d = [
|
412
|
+
# Geom::Point3d.new(0, 0, 0),
|
413
|
+
# Geom::Point3d.new(8, 0, 0),
|
414
|
+
# Geom::Point3d.new(8, 4, 0),
|
415
|
+
# Geom::Point3d.new(0, 4, 0)
|
416
|
+
# ]
|
417
|
+
# tr = Geom::Transformation.scaling(UI.scale_factor)
|
418
|
+
# points2d.each { |point| point.transform!(tr)
|
419
|
+
#
|
420
|
+
# @note SU2017M0 will automatically scale up line width and text size, but will
|
421
|
+
# not scale up the points provided to {Sketchup::View#draw2d}.
|
422
|
+
#
|
423
|
+
# @return [Float]
|
424
|
+
#
|
425
|
+
# @version SketchUp 2017
|
426
|
+
def self.scale_factor
|
427
|
+
end
|
428
|
+
|
429
|
+
# The {.select_directory} method is used to display the OS dialog for selecting
|
430
|
+
# one or several directories from the file system.
|
431
|
+
#
|
432
|
+
# @example
|
433
|
+
# # Default title and folder:
|
434
|
+
# chosen_folder = UI.select_directory
|
435
|
+
#
|
436
|
+
# # Custom dialog title:
|
437
|
+
# chosen_folder = UI.select_directory(title: "Select Image Directory")
|
438
|
+
#
|
439
|
+
# # Force a start folder:
|
440
|
+
# chosen_folder = UI.select_directory(directory: "C:/images")
|
441
|
+
#
|
442
|
+
# # Allow multiple items to the selected:
|
443
|
+
# chosen_folder = UI.select_directory(select_multiple: true)
|
444
|
+
#
|
445
|
+
# # Custom dialog title and force a start folder:
|
446
|
+
# chosen_folder = UI.select_directory(
|
447
|
+
# title: "Select Image Directory",
|
448
|
+
# directory: "C:/images"
|
449
|
+
# )
|
450
|
+
#
|
451
|
+
# @option options [String] :title (nil) The title for the dialog.
|
452
|
+
#
|
453
|
+
# @option options [String] :directory (nil) Force the starting directory for the dialog. If not specified the last
|
454
|
+
# chosen directory will be used.
|
455
|
+
#
|
456
|
+
# @option options [Boolean] :select_multiple (false) Set to true to allow multiple items to be selected.
|
457
|
+
#
|
458
|
+
# @param [Hash] options
|
459
|
+
# The dialog can be customized by providing a hash or named arguments of
|
460
|
+
# options.
|
461
|
+
#
|
462
|
+
# @return [String, Array<String>, nil] A string with the full path of the
|
463
|
+
# directory selected when
|
464
|
+
# :select_multiple option is set to
|
465
|
+
# false otherwise an array of strings
|
466
|
+
# or nil if the user cancelled.
|
467
|
+
#
|
468
|
+
# @version SketchUp 2015
|
469
|
+
def self.select_directory(options = {})
|
470
|
+
end
|
471
|
+
|
472
|
+
# The #{set_cursor} method is used to change the cursor to a new cursor with a
|
473
|
+
# given cursor id. See UI.create_cursor and the Tool class for details
|
474
|
+
# on creating your own tools with arbitrary cursors.
|
475
|
+
#
|
476
|
+
# If you call this while a standard SketchUp tool is active, you will not
|
477
|
+
# see your custom cursor, as these tools are constantly setting their
|
478
|
+
# own cursors to indicate SketchUp's state.
|
479
|
+
#
|
480
|
+
# @example
|
481
|
+
# def onSetCursor
|
482
|
+
# UI.set_cursor(cursor_id)
|
483
|
+
# end
|
484
|
+
#
|
485
|
+
# @param [Integer] cursor_id
|
486
|
+
# The id of the cursor you want to display.
|
487
|
+
#
|
488
|
+
# @return [Boolean]
|
489
|
+
#
|
490
|
+
# @version SketchUp 6.0
|
491
|
+
def self.set_cursor(cursor_id)
|
492
|
+
end
|
493
|
+
|
494
|
+
# The set_toolbar_visible method is used to set whether a given toolbar is
|
495
|
+
# visible. Note that the toolbars and their names are different on the
|
496
|
+
# Mac vs. PC, so be careful and be sure to test when using this method in a
|
497
|
+
# cross-platform script.
|
498
|
+
#
|
499
|
+
# @example
|
500
|
+
# status = UI.set_toolbar_visible("Camera", true)
|
501
|
+
#
|
502
|
+
# @param [String] name
|
503
|
+
# The name of a Ruby toolbar.
|
504
|
+
#
|
505
|
+
# @param [Boolean] visible
|
506
|
+
# True to make the toolbar visible, false to hide it.
|
507
|
+
#
|
508
|
+
# @return [Boolean] true if successful, false if not.
|
509
|
+
#
|
510
|
+
# @version SketchUp 6.0
|
511
|
+
def self.set_toolbar_visible(name, visible)
|
512
|
+
end
|
513
|
+
|
514
|
+
# The +show_extension_manager+ method is used to display the Extension Manager
|
515
|
+
# dialog.
|
516
|
+
#
|
517
|
+
# @example
|
518
|
+
# UI.show_extension_manager
|
519
|
+
#
|
520
|
+
# @return [nil]
|
521
|
+
#
|
522
|
+
# @version SketchUp 2017
|
523
|
+
def self.show_extension_manager
|
524
|
+
end
|
525
|
+
|
526
|
+
# The show_inspector method is used to display the inspector with the given
|
527
|
+
# name. You can get the list of valid inspectors with UI.inspector_names.
|
528
|
+
#
|
529
|
+
# @example
|
530
|
+
# status = UI.show_inspector("Components")
|
531
|
+
#
|
532
|
+
# @param [String] name
|
533
|
+
# The name of inspector that you want to display.
|
534
|
+
#
|
535
|
+
# @return [Boolean] true if successful, false if unsuccessful
|
536
|
+
#
|
537
|
+
# @version SketchUp 6.0
|
538
|
+
def self.show_inspector(name)
|
539
|
+
end
|
540
|
+
|
541
|
+
# The {.show_model_info} method is used to display the model info dialog for a
|
542
|
+
# specific page. You can get the list of valid dialogs with
|
543
|
+
# {UI.model_info_pages}.
|
544
|
+
#
|
545
|
+
# [SketchUp 2014] <code>"Classifications"</code> page was added.
|
546
|
+
# [SketchUp 2017] <code>"Extensions"</code> page was removed.
|
547
|
+
#
|
548
|
+
# @example
|
549
|
+
# UI.show_model_info('Credits')
|
550
|
+
#
|
551
|
+
# @param [String] page_name
|
552
|
+
# The name of the model info dialog you want to display.
|
553
|
+
#
|
554
|
+
# @return [Boolean]
|
555
|
+
#
|
556
|
+
# @version SketchUp 6.0
|
557
|
+
def self.show_model_info(page_name)
|
558
|
+
end
|
559
|
+
|
560
|
+
# The show_preferences method is used to display a SketchUp preferences dialog.
|
561
|
+
# You can get the list of valid dialogs with UI.preferences_pages.
|
562
|
+
#
|
563
|
+
# Note that under OSX this method doesn't currently work.
|
564
|
+
#
|
565
|
+
# @example
|
566
|
+
# status = UI.show_preferences('GraphicsCard')
|
567
|
+
#
|
568
|
+
# @param [String] page_name
|
569
|
+
# The name of the preferences dialog you want to display.
|
570
|
+
#
|
571
|
+
# @return [Boolean] true
|
572
|
+
#
|
573
|
+
# @version SketchUp 6.0
|
574
|
+
def self.show_preferences(page_name)
|
575
|
+
end
|
576
|
+
|
577
|
+
# The start_timer method is used to start a timer. This is an effective method
|
578
|
+
# to create a repeating snippet of code for arbitrary animation.
|
579
|
+
#
|
580
|
+
# See this blog post for an detailed example of custom animation using timers:
|
581
|
+
# http://sketchupapi.blogspot.com/2008/10/animate-yo-cheese.html
|
582
|
+
#
|
583
|
+
# Note that there is a bug that if you open a modal window in a non-repeating
|
584
|
+
# timer the timer will repeat until the window is closed.
|
585
|
+
#
|
586
|
+
# @example
|
587
|
+
# # Beep once after 10 seconds.
|
588
|
+
# id = UI.start_timer(10, false) { UI.beep }
|
589
|
+
#
|
590
|
+
# @param [Numeric] seconds
|
591
|
+
# The time in seconds before your code should be called.
|
592
|
+
#
|
593
|
+
# @param [Boolean] repeat
|
594
|
+
# true if you want the timer to repeat, false
|
595
|
+
# (or omit) if you do not want it to repeat.
|
596
|
+
#
|
597
|
+
# @return [Integer] a timer ID
|
598
|
+
#
|
599
|
+
# @version SketchUp 6.0
|
600
|
+
#
|
601
|
+
# @yield [procedure] The procedure you want to execute after seconds has
|
602
|
+
# expired.
|
603
|
+
def self.start_timer(seconds, repeat = false)
|
604
|
+
end
|
605
|
+
|
606
|
+
# The stop_timer method is used to stop a timer based on its id.
|
607
|
+
#
|
608
|
+
# @example
|
609
|
+
# # Stop timer before it triggers.
|
610
|
+
# id = UI.start_timer(10) { UI.beep }
|
611
|
+
# UI.stop_timer(id)
|
612
|
+
#
|
613
|
+
# @param [Integer] id
|
614
|
+
# The timer id for the timer that you want to stop.
|
615
|
+
#
|
616
|
+
# @return [nil]
|
617
|
+
#
|
618
|
+
# @version SketchUp 6.0
|
619
|
+
def self.stop_timer(id)
|
620
|
+
end
|
621
|
+
|
622
|
+
# The toolbar method is used to get a Ruby toolbar by name. If the toolbar
|
623
|
+
# doesn't exist a new one will be created.
|
624
|
+
#
|
625
|
+
# @example
|
626
|
+
# toolbar = UI.toolbar('Test')
|
627
|
+
#
|
628
|
+
# @param [String] name
|
629
|
+
# The name of the Ruby toolbar.
|
630
|
+
#
|
631
|
+
# @return [UI::Toolbar] a Toolbar object
|
632
|
+
#
|
633
|
+
# @version SketchUp 6.0
|
634
|
+
def self.toolbar(name)
|
635
|
+
end
|
636
|
+
|
637
|
+
# The toolbar_names method is used to return the name of all the available
|
638
|
+
# native toolbars (this differs between PC and Mac). These toolbar names
|
639
|
+
# do not include Ruby toolbars.
|
640
|
+
#
|
641
|
+
# @example
|
642
|
+
# names = UI.toolbar_names
|
643
|
+
#
|
644
|
+
# @return [Array<String>] Array of strings representing toolbar names.
|
645
|
+
#
|
646
|
+
# @version SketchUp 6.0
|
647
|
+
def self.toolbar_names
|
648
|
+
end
|
649
|
+
|
650
|
+
# The toolbar_visible? method is used to determine whether a given toolbar is
|
651
|
+
# visible. Note that the toolbars and their names are different on the
|
652
|
+
# Mac vs. PC, so be careful and be sure to test when using this method in a
|
653
|
+
# cross-platform script.
|
654
|
+
#
|
655
|
+
# @example
|
656
|
+
# status = UI.toolbar_visible?("Camera")
|
657
|
+
#
|
658
|
+
# @param [String] name
|
659
|
+
# The name of a native toolbar.
|
660
|
+
#
|
661
|
+
# @return [Boolean]
|
662
|
+
#
|
663
|
+
# @version SketchUp 6.0
|
664
|
+
def self.toolbar_visible?(name)
|
665
|
+
end
|
666
|
+
|
667
|
+
end
|