sketchup-api-stubs 0.7.8 → 0.7.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sketchup-api-stubs/sketchup.rb +151 -148
- data/lib/sketchup-api-stubs/stubs/Array.rb +741 -741
- data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +322 -322
- 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 -400
- data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +661 -661
- data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +509 -523
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +476 -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 -522
- data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +693 -693
- data/lib/sketchup-api-stubs/stubs/Geom.rb +351 -351
- data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +93 -93
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +595 -595
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +747 -698
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +183 -183
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +517 -516
- data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
- data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +148 -148
- data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +354 -354
- data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -311
- data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
- data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -91
- data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +370 -370
- 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 +225 -225
- data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +567 -567
- 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 +209 -209
- 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/ReferenceEntity.rb +82 -0
- data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +692 -692
- 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/Layout.rb +25 -25
- data/lib/sketchup-api-stubs/stubs/Length.rb +278 -278
- data/lib/sketchup-api-stubs/stubs/Numeric.rb +249 -249
- data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +144 -144
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +169 -169
- data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +209 -209
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +150 -152
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +281 -286
- data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +302 -302
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +478 -478
- data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
- data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +121 -122
- data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +294 -294
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +659 -619
- 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 +201 -201
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +449 -426
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +74 -74
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +104 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +165 -165
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +306 -306
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +42 -42
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
- data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +406 -396
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +397 -502
- data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1239 -1205
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +261 -272
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -127
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +545 -545
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -60
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +125 -126
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +937 -937
- data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +102 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +750 -750
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +282 -292
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +62 -62
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
- data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +468 -468
- data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +266 -266
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +189 -189
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +406 -407
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +84 -84
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +306 -306
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +326 -326
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +422 -422
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +427 -427
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +249 -249
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +48 -48
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +114 -112
- data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +414 -414
- data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +317 -318
- data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +93 -93
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1652 -1651
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +357 -357
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +130 -131
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +271 -284
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
- data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +490 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +116 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +797 -797
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +361 -363
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -77
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +478 -477
- data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +361 -364
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +45 -45
- data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +458 -459
- 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 +255 -260
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +59 -59
- data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -40
- data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +69 -69
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +217 -217
- data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +262 -262
- data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +217 -217
- data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +834 -837
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +156 -156
- data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +75 -75
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1311 -1317
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +45 -45
- data/lib/sketchup-api-stubs/stubs/Sketchup.rb +1377 -1360
- 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/Command.rb +389 -389
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +494 -496
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +269 -269
- data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +241 -240
- data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +635 -635
- data/lib/sketchup-api-stubs/stubs/UI.rb +683 -683
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +303 -311
- data/lib/sketchup-api-stubs.rb +1 -1
- metadata +10 -7
@@ -1,1360 +1,1377 @@
|
|
1
|
-
# Copyright:: Copyright
|
2
|
-
# License:: The MIT License (MIT)
|
3
|
-
|
4
|
-
# The Sketchup module contains a number of important utility methods for use in
|
5
|
-
# your Ruby scripts. Many of the classes in the API are implemented beneath
|
6
|
-
# this module. You can think of the Sketchup module as the "root" of the
|
7
|
-
# application tree. Most ruby calls start from the currently active model, and
|
8
|
-
# this is accessed via the Sketchup.active_model method.
|
9
|
-
#
|
10
|
-
# @example
|
11
|
-
# # Grab a handle to the currently active model (aka the one the user is
|
12
|
-
# # looking at in SketchUp.)
|
13
|
-
# model = Sketchup.active_model
|
14
|
-
#
|
15
|
-
# # Grab other handles to commonly used collections inside the model.
|
16
|
-
# entities = model.entities
|
17
|
-
# layers = model.layers
|
18
|
-
# materials = model.materials
|
19
|
-
# component_definitions = model.definitions
|
20
|
-
# selection = model.selection
|
21
|
-
#
|
22
|
-
# # Now that we have our handles, we can start pulling objects and making
|
23
|
-
# # method calls that are useful.
|
24
|
-
# first_entity = entities[0]
|
25
|
-
# UI.messagebox("First thing in your model is a " + first_entity.typename)
|
26
|
-
#
|
27
|
-
# number_materials = materials.length
|
28
|
-
# UI.messagebox("Your model has " + number_materials.to_s + " materials.")
|
29
|
-
#
|
30
|
-
# new_edge = entities.add_line( [0,0,0], [500,500,0])
|
31
|
-
#
|
32
|
-
# @version SketchUp 6.0
|
33
|
-
module Sketchup
|
34
|
-
|
35
|
-
# Class Methods
|
36
|
-
|
37
|
-
# The active_model method returns the currently active SketchUp model. On the
|
38
|
-
# PC, this is the only model that one can have access to via the API, but
|
39
|
-
# Macintosh versions of SketchUp can have multiple models open at once, in
|
40
|
-
# which case the method will return the model that the user currently has
|
41
|
-
# focused.
|
42
|
-
#
|
43
|
-
# @example
|
44
|
-
# model = Sketchup.active_model
|
45
|
-
# if !model
|
46
|
-
# UI.messagebox("Failure")
|
47
|
-
# else
|
48
|
-
# # code acting on the model
|
49
|
-
# end
|
50
|
-
#
|
51
|
-
# @return [Sketchup::Model] active model object if successful, false if
|
52
|
-
# unsuccessful
|
53
|
-
#
|
54
|
-
# @version SketchUp 6.0
|
55
|
-
def self.active_model
|
56
|
-
end
|
57
|
-
|
58
|
-
# The add_observer method is used to add an observer to the current object.
|
59
|
-
#
|
60
|
-
# @example
|
61
|
-
# status = Sketchup.add_observer(observer)
|
62
|
-
#
|
63
|
-
# @param [Object] observer
|
64
|
-
# An observer.
|
65
|
-
#
|
66
|
-
# @return [Boolean] true if successful, false if unsuccessful.
|
67
|
-
#
|
68
|
-
# @version SketchUp 6.0
|
69
|
-
def self.add_observer(observer)
|
70
|
-
end
|
71
|
-
|
72
|
-
# The app_name method is used to retrieve the current application name.
|
73
|
-
#
|
74
|
-
# @example
|
75
|
-
# name = Sketchup.app_name
|
76
|
-
#
|
77
|
-
# @return [String] the name of the application, either
|
78
|
-
# "SketchUp Pro" or "SketchUp".
|
79
|
-
# Note: For versions earlier than SketchUp8 M4
|
80
|
-
# (Mac 8.0.15157 and Windows 8.0.15158) this function will
|
81
|
-
# return "Google SketchUp Pro" or "Google SketchUp".
|
82
|
-
#
|
83
|
-
# @version SketchUp 6.0
|
84
|
-
def self.app_name
|
85
|
-
end
|
86
|
-
|
87
|
-
# The break_edges= method can be used to disable or enable the break edges
|
88
|
-
# feature. Break edges is the SketchUp 7 feature that automatically splits
|
89
|
-
# edges that the user draws which cross over one another.
|
90
|
-
#
|
91
|
-
# This feature is always on by default and cannot be disabled by the user
|
92
|
-
# via the user interface, but you can call this method to disable it. Be
|
93
|
-
# cautious in doing so, however, as the resulting model could then be altered
|
94
|
-
# when the user later draws lines into it with the break edges feature
|
95
|
-
# reactivated.
|
96
|
-
#
|
97
|
-
# @example
|
98
|
-
# Sketchup.break_edges = false
|
99
|
-
#
|
100
|
-
# @param [Boolean] enabled
|
101
|
-
# If true, break edges will be turned on. If false, it
|
102
|
-
# will be deactivated.
|
103
|
-
#
|
104
|
-
# @return [Boolean] true if break edges was turned on.
|
105
|
-
#
|
106
|
-
# @version SketchUp 7.0
|
107
|
-
def self.break_edges=(enabled)
|
108
|
-
end
|
109
|
-
|
110
|
-
# The break_edges? method indicates whether the break edges feature is
|
111
|
-
# currently turned on. Break edges is the SketchUp 7 feature that
|
112
|
-
# automatically splits edges that the user draws which cross over one another.
|
113
|
-
# This feature is always on by default and cannot be disabled by the user
|
114
|
-
# via the user interface.
|
115
|
-
#
|
116
|
-
# @example
|
117
|
-
# is_on = Sketchup.break_edges?
|
118
|
-
#
|
119
|
-
# @return [Boolean]
|
120
|
-
#
|
121
|
-
# @version SketchUp 7.0
|
122
|
-
def self.break_edges?
|
123
|
-
end
|
124
|
-
|
125
|
-
# The create_texture_writer method is used to create a TextureWriter object.
|
126
|
-
#
|
127
|
-
# @example
|
128
|
-
# texturewriter = Sketchup.create_texture_writer
|
129
|
-
#
|
130
|
-
# @return [Sketchup::TextureWriter] a texturewriter object if successful.
|
131
|
-
#
|
132
|
-
# @version SketchUp 6.0
|
133
|
-
def self.create_texture_writer
|
134
|
-
end
|
135
|
-
|
136
|
-
# The debug_mode= method lets you controls whether SketchUp will output
|
137
|
-
# warnings to the console when it detects incorrect usage of the API.
|
138
|
-
# The setting takes effect right away, no need to restart SketchUp.
|
139
|
-
#
|
140
|
-
# @example
|
141
|
-
# Sketchup.debug_mode = true
|
142
|
-
#
|
143
|
-
# @note Changing this value within your extension can cause problems for other
|
144
|
-
# extension developers who rely on the debug information for their own work.
|
145
|
-
# Only use this locally; never change this value in an extension you
|
146
|
-
# publish.
|
147
|
-
#
|
148
|
-
# @param [Boolean] enabled
|
149
|
-
# If true, SketchUp will produce debug warnings.
|
150
|
-
#
|
151
|
-
# @return [Boolean]
|
152
|
-
#
|
153
|
-
# @version SketchUp 2016
|
154
|
-
def self.debug_mode=(enabled)
|
155
|
-
end
|
156
|
-
|
157
|
-
# The debug_mode? controls whether SketchUp will output warnings to the console
|
158
|
-
# when it detects incorrect usage of the API.
|
159
|
-
#
|
160
|
-
# @example
|
161
|
-
# debug_mode = Sketchup.debug_mode?
|
162
|
-
#
|
163
|
-
# @return [Boolean]
|
164
|
-
#
|
165
|
-
# @version SketchUp 2016
|
166
|
-
def self.debug_mode?
|
167
|
-
end
|
168
|
-
|
169
|
-
# The display_name_from_action method is used to gets a user-friendly name
|
170
|
-
# from an action string. See Sketchup.send_action for a list of valid
|
171
|
-
# action strings.
|
172
|
-
#
|
173
|
-
# @example
|
174
|
-
# Sketchup.display_name_from_action("viewRight:")
|
175
|
-
#
|
176
|
-
# @note This method has been non-functional on Mac since SketchUp 8.
|
177
|
-
#
|
178
|
-
# @param [String] action_name
|
179
|
-
# An action string.
|
180
|
-
#
|
181
|
-
# @return [String] a friendly name.
|
182
|
-
#
|
183
|
-
# @version SketchUp 6.0
|
184
|
-
def self.display_name_from_action(action_name)
|
185
|
-
end
|
186
|
-
|
187
|
-
# Returns the ExtensionsManager where you can find all registered
|
188
|
-
# SketchupExtension objects.
|
189
|
-
#
|
190
|
-
# #{extension.loaded?}"
|
191
|
-
# }
|
192
|
-
#
|
193
|
-
# @example
|
194
|
-
# extensions = Sketchup.extensions
|
195
|
-
# extensions.each{ |extension|
|
196
|
-
# puts "The next extension is named: #{extension.name} and its loaded? state is:
|
197
|
-
#
|
198
|
-
# @return [Sketchup::ExtensionsManager] an ExtensionsManager object.
|
199
|
-
#
|
200
|
-
# @version SketchUp 8.0 M2
|
201
|
-
def self.extensions
|
202
|
-
end
|
203
|
-
|
204
|
-
# The file_new method is used to create a new file.
|
205
|
-
#
|
206
|
-
# @example
|
207
|
-
# new_sketchup = Sketchup.file_new
|
208
|
-
#
|
209
|
-
# @return [Module] The Sketchup module.
|
210
|
-
#
|
211
|
-
# @version SketchUp 6.0
|
212
|
-
def self.file_new
|
213
|
-
end
|
214
|
-
|
215
|
-
# The find_support_files method is used to retrieve the relative path and name
|
216
|
-
# of a file within the SketchUp installation directory.
|
217
|
-
#
|
218
|
-
# Forward slashes must be used to delimit between directory names.
|
219
|
-
#
|
220
|
-
# @example
|
221
|
-
# help_file = Sketchup.find_support_file("help.html", "Plugins/")
|
222
|
-
# if help_file
|
223
|
-
# # Print out the help_file full path
|
224
|
-
# UI.messagebox(help_file)
|
225
|
-
#
|
226
|
-
# # Open the help_file in a web browser
|
227
|
-
# UI.openURL("file://" + help_file)
|
228
|
-
# else
|
229
|
-
# UI.messagebox("Failure")
|
230
|
-
# end
|
231
|
-
#
|
232
|
-
# @param [String] filename
|
233
|
-
# Name of the filename you want to find.
|
234
|
-
#
|
235
|
-
# @param [String] directory
|
236
|
-
# directory relative to the SketchUp
|
237
|
-
# installation directory.
|
238
|
-
#
|
239
|
-
# @return [String] the entire path if successful. If unsuccessful,
|
240
|
-
# the method returns false.
|
241
|
-
#
|
242
|
-
# @version SketchUp 6.0
|
243
|
-
def self.find_support_file(filename, directory)
|
244
|
-
end
|
245
|
-
|
246
|
-
# The find_support_files method is used to retrieve the path and name of all
|
247
|
-
# matching files within the SketchUp installation directory.
|
248
|
-
#
|
249
|
-
# Forward slashes must be used to delimit between directory names.
|
250
|
-
#
|
251
|
-
# @example
|
252
|
-
# files = Sketchup.find_support_files('rb', 'Plugins')
|
253
|
-
#
|
254
|
-
# @param [String] filename
|
255
|
-
# Extension of the files to be found.
|
256
|
-
#
|
257
|
-
# @param [String] directory
|
258
|
-
# directory relative to the SketchUp installation
|
259
|
-
# directory. Without this the result will
|
260
|
-
# be empty.
|
261
|
-
#
|
262
|
-
# @return [Array<String>] an array of files. If unsuccessful, the method
|
263
|
-
# returns false.
|
264
|
-
#
|
265
|
-
# @version SketchUp 6.0
|
266
|
-
def self.find_support_files(filename, directory)
|
267
|
-
end
|
268
|
-
|
269
|
-
# The fix_shadow_strings= method lets you control whether shadow rendering
|
270
|
-
# attempts to fix an artifact commonly referred to as "strings". The fix
|
271
|
-
# is actually very model dependent and not controllable from the UI, so this
|
272
|
-
# method can be used to control it.
|
273
|
-
#
|
274
|
-
# @example
|
275
|
-
# Sketchup.fix_shadow_strings = true
|
276
|
-
#
|
277
|
-
# @param [Boolean] enabled
|
278
|
-
# If true, shadow strings fix will be turned on. If
|
279
|
-
# false, it will be deactivated.
|
280
|
-
#
|
281
|
-
# @return [Boolean] true if shadow strings fix was turned on.
|
282
|
-
#
|
283
|
-
# @version SketchUp 8.0 M1
|
284
|
-
def self.fix_shadow_strings=(enabled)
|
285
|
-
end
|
286
|
-
|
287
|
-
# The fix_shadow_strings? method indicates whether the a fix for a shadow
|
288
|
-
# rendering artifact commonly referred to as "strings" is enabled. The fix
|
289
|
-
# is actually very model dependent and not controllable from the UI, so this
|
290
|
-
# method can be used to test it.
|
291
|
-
#
|
292
|
-
# @example
|
293
|
-
# is_on = Sketchup.fix_shadow_strings?
|
294
|
-
#
|
295
|
-
# @return [Boolean]
|
296
|
-
#
|
297
|
-
# @version SketchUp 8.0 M1
|
298
|
-
def self.fix_shadow_strings?
|
299
|
-
end
|
300
|
-
|
301
|
-
# The {.focus} method is used to focus the active model window.
|
302
|
-
#
|
303
|
-
# @example
|
304
|
-
# Sketchup.focus
|
305
|
-
#
|
306
|
-
# @see UI::HtmlDialog.bring_to_front
|
307
|
-
#
|
308
|
-
# @version SketchUp 2021.1
|
309
|
-
def self.focus
|
310
|
-
end
|
311
|
-
|
312
|
-
# The format_angle method takes a number as an angle in radians and formats it
|
313
|
-
# into degrees. For example, format_angle(Math::PI) will return 180.0.
|
314
|
-
#
|
315
|
-
# @example
|
316
|
-
# degrees = Sketchup.format_angle(Math::PI)
|
317
|
-
#
|
318
|
-
# @param [Numeric] number
|
319
|
-
# A number to be formatted.
|
320
|
-
#
|
321
|
-
# @return [String] an angle in degrees if successful, false if unsuccessful
|
322
|
-
#
|
323
|
-
# @version SketchUp 6.0
|
324
|
-
def self.format_angle(number)
|
325
|
-
end
|
326
|
-
|
327
|
-
# The {.format_area} method formats a number as an area using the current units
|
328
|
-
# settings.
|
329
|
-
#
|
330
|
-
# The +number+ must be in square inches.
|
331
|
-
#
|
332
|
-
# @example
|
333
|
-
# number = 3.m * 4.m # This will result in 12m2 in inches.
|
334
|
-
# formatted_area = Sketchup.format_area(number)
|
335
|
-
#
|
336
|
-
# @param [Numeric] number
|
337
|
-
# A number to be formatted.
|
338
|
-
#
|
339
|
-
# @return [String]
|
340
|
-
#
|
341
|
-
# @version SketchUp 6.0
|
342
|
-
def self.format_area(number)
|
343
|
-
end
|
344
|
-
|
345
|
-
# The format_degrees method formats a number as an angle given in degrees. For
|
346
|
-
# example, 10 becomes 10.0. This is the equivalent to a to_f call.
|
347
|
-
#
|
348
|
-
# @example
|
349
|
-
# degrees = Sketchup.format_degrees(number)
|
350
|
-
#
|
351
|
-
# @param [Numeric] number
|
352
|
-
# A number to be formatted.
|
353
|
-
#
|
354
|
-
# @return [String] degrees if successful, false if unsuccessful.
|
355
|
-
#
|
356
|
-
# @version SketchUp 6.0
|
357
|
-
def self.format_degrees(number)
|
358
|
-
end
|
359
|
-
|
360
|
-
# The {.format_length} method formats a number as a length using the current
|
361
|
-
# units settings.
|
362
|
-
#
|
363
|
-
# The default unit setting is inches. For example, 10 becomes 10".
|
364
|
-
#
|
365
|
-
# @example
|
366
|
-
# length = Sketchup.format_length(10)
|
367
|
-
#
|
368
|
-
# @overload format_length(number)
|
369
|
-
#
|
370
|
-
# @param [Numeric] number A number to be formatted.
|
371
|
-
#
|
372
|
-
# @overload format_length(number, precision)
|
373
|
-
#
|
374
|
-
# @param [Numeric] number A number to be formatted.
|
375
|
-
# @param [Integer] number A custom precision. Negative number will strip
|
376
|
-
# trailing zeros.
|
377
|
-
#
|
378
|
-
# @return [String]
|
379
|
-
#
|
380
|
-
# @version SketchUp 6.0
|
381
|
-
def self.format_length(*args)
|
382
|
-
end
|
383
|
-
|
384
|
-
# The {.format_volume} method formats a number as a volume using the current
|
385
|
-
# units settings.
|
386
|
-
#
|
387
|
-
# The +number+ must be in cubic inches.
|
388
|
-
#
|
389
|
-
# @example
|
390
|
-
# number = 3.m * 4.m * 5.m # This will result in 60m3 in inches.
|
391
|
-
# formatted_volume = Sketchup.format_area(number)
|
392
|
-
#
|
393
|
-
# @param [Numeric] number
|
394
|
-
# A number to be formatted.
|
395
|
-
#
|
396
|
-
# @return [String]
|
397
|
-
#
|
398
|
-
# @version SketchUp 2019.2
|
399
|
-
def self.format_volume(number)
|
400
|
-
end
|
401
|
-
|
402
|
-
# The get_datfile_info method is used to retrieve the value for the given key
|
403
|
-
# from Sketchup.dat.
|
404
|
-
#
|
405
|
-
# If the key is not found, default_value is returned.
|
406
|
-
#
|
407
|
-
# @example
|
408
|
-
# value = Sketchup.get_datfile_info(key, default_value)
|
409
|
-
#
|
410
|
-
# @param [String] key
|
411
|
-
# The key whose value you want to retrieve.
|
412
|
-
#
|
413
|
-
# @param [String] default_value
|
414
|
-
# The default value you want returned if key is not
|
415
|
-
# available.
|
416
|
-
#
|
417
|
-
# @return [String] a string value if successful.
|
418
|
-
#
|
419
|
-
# @version SketchUp 6.0
|
420
|
-
def self.get_datfile_info(key, default_value)
|
421
|
-
end
|
422
|
-
|
423
|
-
# The {.get_i18n_datfile_info} method is used to retrieve the value for the
|
424
|
-
# given key from the internationalization file that SketchUp uses to work
|
425
|
-
# in multiple languages.
|
426
|
-
#
|
427
|
-
# If the +key+ is not found, +default_value+ is returned.
|
428
|
-
#
|
429
|
-
# @example
|
430
|
-
# value = Sketchup.get_i18n_datfile_info(key, default_value)
|
431
|
-
#
|
432
|
-
# @param [String] key
|
433
|
-
# The key whose value you want to retrieve.
|
434
|
-
#
|
435
|
-
# @param [String] default_value
|
436
|
-
# The default value you want returned if key is not
|
437
|
-
# available.
|
438
|
-
#
|
439
|
-
# @return [String]
|
440
|
-
#
|
441
|
-
# @version SketchUp 6.0
|
442
|
-
def self.get_i18n_datfile_info(key, default_value)
|
443
|
-
end
|
444
|
-
|
445
|
-
# The os_language method returns the language code for the language SketchUp
|
446
|
-
# is running in. This is an alias for the get_locale method.
|
447
|
-
#
|
448
|
-
# Examples of return values are: en-US, fr, it, de, es, ja, ko, zh-CN, zh-TW,
|
449
|
-
# pt-BR, nl, ru and sv. For an up to date list os supported languages, see
|
450
|
-
# the SketchUp download page.
|
451
|
-
#
|
452
|
-
# @example
|
453
|
-
# language = Sketchup.os_language
|
454
|
-
#
|
455
|
-
# @return [String] a code representing the language SketchUp
|
456
|
-
# is displaying.
|
457
|
-
#
|
458
|
-
# @version SketchUp 6.0
|
459
|
-
def self.get_locale
|
460
|
-
end
|
461
|
-
|
462
|
-
# The get_resource_path is used to retrieve the directory where "resource"
|
463
|
-
# files are stored by SketchUp. Resource files include things like language
|
464
|
-
# localization files.
|
465
|
-
#
|
466
|
-
# @example
|
467
|
-
# directory = Sketchup.get_resource_path("Styles.strings")
|
468
|
-
#
|
469
|
-
# @param [String] filename
|
470
|
-
# The filename of a resource file in the resource directory hierarchy.
|
471
|
-
#
|
472
|
-
# @return [String] the directory path to the resources folder.
|
473
|
-
#
|
474
|
-
# @version SketchUp 6.0
|
475
|
-
def self.get_resource_path(filename)
|
476
|
-
end
|
477
|
-
|
478
|
-
# The get_shortcuts method retrieves an array of all keyboard shortcuts
|
479
|
-
# currently registered with SketchUp. Each shortcut is returned as a
|
480
|
-
# string with the shortcut and the command separated by a tab, similar
|
481
|
-
# to "Ctrl+A\\tEdit/Select All"
|
482
|
-
#
|
483
|
-
# @example
|
484
|
-
# shortcuts = Sketchup.get_shortcuts
|
485
|
-
#
|
486
|
-
# @return [Array<String>] an array of shortcut strings.
|
487
|
-
#
|
488
|
-
# @version SketchUp 6.0
|
489
|
-
def self.get_shortcuts
|
490
|
-
end
|
491
|
-
|
492
|
-
# Installs the contents of a ZIP archive file into SketchUp's Plugins folder.
|
493
|
-
# If the ZIP contains subfolders, these will be preserved. This allows for a
|
494
|
-
# Ruby API plugin or Extension developer to distribute their plugin as a single
|
495
|
-
# file regardless of how many asset files must be included.
|
496
|
-
#
|
497
|
-
# The user will be shown a warning message that they must agree to before the
|
498
|
-
# install proceeds. If they do not agree, an Interrupt error will be raised.
|
499
|
-
# If the user does agree but there is a problem with the unzip process, an
|
500
|
-
# Exception will be raised. You can capture these states via a begin/rescue.
|
501
|
-
# See the example below.
|
502
|
-
#
|
503
|
-
# If the install is successful, any Ruby files that have been added to
|
504
|
-
# the Plugins folder will immediately be executed, saving the user a restart.
|
505
|
-
#
|
506
|
-
# To create an archive file, use your favorite tool (7zip, Winzip, etc.) to zip
|
507
|
-
# up any files and folders in your plugins directory. If the archive contains a
|
508
|
-
# SketchupExtension that you would like users to be able to install from the
|
509
|
-
# Preferences > Extensions panel, rename your file to have a .rbz file
|
510
|
-
# extension.
|
511
|
-
#
|
512
|
-
# @example
|
513
|
-
# path = 'c:/temp/SomePluginPackage.zip'
|
514
|
-
# begin
|
515
|
-
# Sketchup.install_from_archive(path)
|
516
|
-
# rescue Interrupt => error
|
517
|
-
# UI.messagebox("User said 'no': " + error)
|
518
|
-
# rescue Exception => error
|
519
|
-
# UI.messagebox("Error during unzip: " + error)
|
520
|
-
# end
|
521
|
-
#
|
522
|
-
# @param [String] filepath
|
523
|
-
# The path to the RBZ or ZIP file to install.
|
524
|
-
#
|
525
|
-
# @param [Boolean] show_warning
|
526
|
-
# Whether to warn the user not to install untrusted extensions.
|
527
|
-
# In certain cases the warning can be confusing and redundant, e.g. when
|
528
|
-
# automatically updating a trusted extension. When the user has selected
|
529
|
-
# the archive themselves, it is best to warn about the possible risks.
|
530
|
-
#
|
531
|
-
# @raise [Exception] If the archive cannot be installed.
|
532
|
-
#
|
533
|
-
# @raise [Interrupt] If the user cancel the installation.
|
534
|
-
#
|
535
|
-
# @raise [Exception] If the archive cannot be found.
|
536
|
-
#
|
537
|
-
# @return [Boolean]
|
538
|
-
#
|
539
|
-
# @version SketchUp 8.0 M2
|
540
|
-
def self.install_from_archive(filepath, show_warning = true)
|
541
|
-
end
|
542
|
-
|
543
|
-
# This methods indicates whether the host SketchUp application is 64bit.
|
544
|
-
# Useful for extensions that ship with binaries and need to determine
|
545
|
-
# which versions to load.
|
546
|
-
#
|
547
|
-
# @example
|
548
|
-
# # For backward compatibility, check for the existence of the method
|
549
|
-
# # and load 32bit binaries for SketchUp versions that do not have this
|
550
|
-
# # method.
|
551
|
-
# if Sketchup.respond_to?(:is_64bit?) && Sketchup.is_64bit?
|
552
|
-
# # Load 64bit binaries.
|
553
|
-
# else
|
554
|
-
# # Load 32bit binaries.
|
555
|
-
# end
|
556
|
-
#
|
557
|
-
# @return [Boolean]
|
558
|
-
#
|
559
|
-
# @version SketchUp 2015
|
560
|
-
def self.is_64bit?
|
561
|
-
end
|
562
|
-
|
563
|
-
# The is_online method is used to verify a connection to the Internet. This
|
564
|
-
# method can take some time to execute, so be careful not to call it more often
|
565
|
-
# than you need.
|
566
|
-
#
|
567
|
-
# @example
|
568
|
-
# status = Sketchup.is_online
|
569
|
-
#
|
570
|
-
# @return [Boolean] true if successful, false if unsuccessful.
|
571
|
-
#
|
572
|
-
# @version SketchUp 6.0
|
573
|
-
def self.is_online
|
574
|
-
end
|
575
|
-
|
576
|
-
# Returns a boolean flag indicating whether the application is SketchUp Pro.
|
577
|
-
#
|
578
|
-
# @example
|
579
|
-
# if Sketchup.is_pro?
|
580
|
-
# UI.messagebox("You are running SU Pro.")
|
581
|
-
# end
|
582
|
-
#
|
583
|
-
# @note In SketchUp Make this method will return +true+ during the Pro trial
|
584
|
-
# period and revert to +false+ when the trial period is over.
|
585
|
-
#
|
586
|
-
# @return [Boolean]
|
587
|
-
#
|
588
|
-
# @version SketchUp 7.0
|
589
|
-
def self.is_pro?
|
590
|
-
end
|
591
|
-
|
592
|
-
# The is_valid_filename? method is used to determine whether a filename
|
593
|
-
# contains illegal characters.
|
594
|
-
#
|
595
|
-
# @example
|
596
|
-
# status = Sketchup.is_valid_filename?(filename)
|
597
|
-
#
|
598
|
-
# @param [String] filename
|
599
|
-
# A filename string.
|
600
|
-
#
|
601
|
-
# @return [Boolean]
|
602
|
-
#
|
603
|
-
# @version SketchUp 6.0
|
604
|
-
def self.is_valid_filename?(filename)
|
605
|
-
end
|
606
|
-
|
607
|
-
# The load method is used to include encrypted and nonencrypted ruby files.
|
608
|
-
#
|
609
|
-
# You do not need to include the file extension on the path. This method will
|
610
|
-
# look for .rb first (unencrypted) and then .rbe (encrypted) and finally .rbs
|
611
|
-
# (the deprecated scrambled format) files.
|
612
|
-
# See the "Distributing your Plugin" article for details.
|
613
|
-
#
|
614
|
-
# @example
|
615
|
-
# sfile = "application_loader" # file extension not required
|
616
|
-
# status = Sketchup.load(sfile)
|
617
|
-
#
|
618
|
-
# @param [String] path
|
619
|
-
# The path, including the filename, to the file you want
|
620
|
-
# to require.
|
621
|
-
#
|
622
|
-
# @return [Boolean] True if the file is included. False if the
|
623
|
-
# file is not included.
|
624
|
-
#
|
625
|
-
# @version SketchUp 6.0
|
626
|
-
def self.load(path)
|
627
|
-
end
|
628
|
-
|
629
|
-
# The {.open_file} method is used to open a SketchUp model.
|
630
|
-
#
|
631
|
-
# @example
|
632
|
-
# result = Sketchup.open_file("C:\\model.skp")
|
633
|
-
#
|
634
|
-
# @overload open_file(filename)
|
635
|
-
#
|
636
|
-
# @deprecated Prefer +with_status+ overload instead of this variant.
|
637
|
-
# @param [String] filename The model file to open.
|
638
|
-
# @return [Boolean] +true+ if opening the file succeeded,
|
639
|
-
# +false+ otherwise.
|
640
|
-
#
|
641
|
-
# @overload open_file(filename, with_status: true)
|
642
|
-
#
|
643
|
-
# Starting with SketchUp 2021.0 SketchUp attempts to load newer SketchUp
|
644
|
-
# models. If a newer model is loaded some information might have been skipped
|
645
|
-
# and extensions should be careful to not save over the file they loaded from
|
646
|
-
# as information might be lost.
|
647
|
-
#
|
648
|
-
# Success status codes:
|
649
|
-
# * {Sketchup::Model::LOAD_STATUS_SUCCESS}
|
650
|
-
# * {Sketchup::Model::LOAD_STATUS_SUCCESS_MORE_RECENT}
|
651
|
-
#
|
652
|
-
# @version SketchUp 2021.0
|
653
|
-
# @param [String] filename The model file to open.
|
654
|
-
# @return [Integer, false] status code if opening the file succeeded,
|
655
|
-
# +false+ otherwise.
|
656
|
-
#
|
657
|
-
# @version SketchUp 6.0
|
658
|
-
def self.open_file(*args)
|
659
|
-
end
|
660
|
-
|
661
|
-
# The os_language method returns the language code for the language SketchUp
|
662
|
-
# is running in. This is an alias for the get_locale method.
|
663
|
-
#
|
664
|
-
# Examples of return values are: en-US, fr, it, de, es, ja, ko, zh-CN, zh-TW,
|
665
|
-
# pt-BR, nl, ru and sv. For an up to date list os supported languages, see
|
666
|
-
# the SketchUp download page.
|
667
|
-
#
|
668
|
-
# @example
|
669
|
-
# language = Sketchup.os_language
|
670
|
-
#
|
671
|
-
# @return [String] a code representing the language SketchUp
|
672
|
-
# is displaying.
|
673
|
-
#
|
674
|
-
# @version SketchUp 6.0
|
675
|
-
def self.os_language
|
676
|
-
end
|
677
|
-
|
678
|
-
# The parse_length method parses a string as a length.
|
679
|
-
#
|
680
|
-
# For example, "200" becomes 200.0.
|
681
|
-
#
|
682
|
-
# @example
|
683
|
-
# float = Sketchup.parse_length("2'") # Returns 24 (representing inches)
|
684
|
-
# length = float.to_l # Convert to a Length type if needed.
|
685
|
-
#
|
686
|
-
# @param [String] string
|
687
|
-
# The string to be parsed as a number.
|
688
|
-
#
|
689
|
-
# @return [Float] the numerical representation of the string if
|
690
|
-
# successful, or nil if unsuccessful.
|
691
|
-
#
|
692
|
-
# @version SketchUp 6.0
|
693
|
-
def self.parse_length(string)
|
694
|
-
end
|
695
|
-
|
696
|
-
# This methods returns a symbol indicating the current platform.
|
697
|
-
#
|
698
|
-
# It should be used over RUBY_PLATFORM as this returns a different value for
|
699
|
-
# Windows since SketchUp 2014.
|
700
|
-
#
|
701
|
-
# Older SketchUp versions still need to check
|
702
|
-
# <code>RUBY_PLATFORM.include?('mswin')</code> or
|
703
|
-
# <code>RUBY_PLATFORM.include?('darwin')</code>.
|
704
|
-
#
|
705
|
-
# Possible return values:
|
706
|
-
# - :platform_win
|
707
|
-
# - :platform_osx
|
708
|
-
#
|
709
|
-
# @example
|
710
|
-
# module MyExtension
|
711
|
-
# IS_WIN = Sketchup.platform == :platform_win
|
712
|
-
# IS_OSX = Sketchup.platform == :platform_osx
|
713
|
-
# end
|
714
|
-
#
|
715
|
-
# @return [Symbol] Current OS platform.
|
716
|
-
#
|
717
|
-
# @version SketchUp 2014
|
718
|
-
def self.platform
|
719
|
-
end
|
720
|
-
|
721
|
-
# The plugins_disabled= method lets you control whether SketchUp will load
|
722
|
-
# Ruby scripts from the plugins directory at startup time. This is primarily
|
723
|
-
# a trouble-shooting method. If you are having strange behavior in SketchUp
|
724
|
-
# that you suspect is from a bad script, you can type
|
725
|
-
# Sketchup.plugins_disabled=true into the Ruby console and restart SketchUp
|
726
|
-
# to see if the problem is fixed.
|
727
|
-
#
|
728
|
-
# @example
|
729
|
-
# # Type this in the Ruby console then restart SketchUp.
|
730
|
-
# Sketchup.plugins_disabled = true
|
731
|
-
#
|
732
|
-
# # To reactivate plugins, type this into the Ruby console and restart.
|
733
|
-
# Sketchup.plugins_disabled = false
|
734
|
-
#
|
735
|
-
# @param [Boolean] enabled
|
736
|
-
# If true, the plugins directory will not load.
|
737
|
-
#
|
738
|
-
# @return [Boolean] true if plugins were disabled.
|
739
|
-
#
|
740
|
-
# @version SketchUp 8.0 M2
|
741
|
-
def self.plugins_disabled=(enabled)
|
742
|
-
end
|
743
|
-
|
744
|
-
# The plugins_disabled? method indicates whether Ruby scripts in the plugins
|
745
|
-
# directory will be loaded at startup time.
|
746
|
-
#
|
747
|
-
# @example
|
748
|
-
# is_disabled = Sketchup.plugins_disabled?
|
749
|
-
#
|
750
|
-
# @return [Boolean]
|
751
|
-
#
|
752
|
-
# @version SketchUp 8.0 M2
|
753
|
-
def self.plugins_disabled?
|
754
|
-
end
|
755
|
-
|
756
|
-
# The quit method is used to terminate the application. This will pop-up the
|
757
|
-
# usual model save prompts if there are unsaved models open. User can cancel
|
758
|
-
# the model save, in which case the application will not terminate.
|
759
|
-
#
|
760
|
-
# @example
|
761
|
-
# Sketchup.quit
|
762
|
-
# # Do not expect code to execute reliably after this point.
|
763
|
-
#
|
764
|
-
# @return self
|
765
|
-
#
|
766
|
-
# @version SketchUp 2014
|
767
|
-
def self.quit
|
768
|
-
end
|
769
|
-
|
770
|
-
# The read_default method is used to retrieve the string associated with a
|
771
|
-
# value within the specified sub-section section of a .INI file or registry
|
772
|
-
# (within the Software > SketchUp > SketchUp [Version] section).
|
773
|
-
#
|
774
|
-
# @example
|
775
|
-
# result = Sketchup.read_default("section", "variable", "default")
|
776
|
-
#
|
777
|
-
# @param [String] section
|
778
|
-
# A section in an .INI or registry.
|
779
|
-
#
|
780
|
-
# @param [String] variable
|
781
|
-
# A variable within the section.
|
782
|
-
#
|
783
|
-
# @param [Object] default
|
784
|
-
# A default value if the value is not found.
|
785
|
-
#
|
786
|
-
# @return [Object, nil] if unsuccessful, the value of the default
|
787
|
-
# if successful.
|
788
|
-
#
|
789
|
-
# @version SketchUp 6.0
|
790
|
-
def self.read_default(section, variable, default = nil)
|
791
|
-
end
|
792
|
-
|
793
|
-
# The redo method is used redo the last transaction on the redo stack.
|
794
|
-
#
|
795
|
-
# @example
|
796
|
-
# Sketchup.redo
|
797
|
-
#
|
798
|
-
# @return [nil]
|
799
|
-
#
|
800
|
-
# @version SketchUp 2021.0
|
801
|
-
def self.redo
|
802
|
-
end
|
803
|
-
|
804
|
-
# The register_extension method is used to register an extension with
|
805
|
-
# SketchUp's extension manager (in SketchUp preferences).
|
806
|
-
#
|
807
|
-
# @example
|
808
|
-
# utilities_extension = SketchupExtension.new("Utilities Tools",
|
809
|
-
# "Utilities/utilitiesTools.rb")
|
810
|
-
#
|
811
|
-
# utilities_extension.description = "Adds Tools->Utilities to the " +
|
812
|
-
# "SketchUp inteface. The Utilities submenu contains two tools: " +
|
813
|
-
# "Create Face and Query Tool."
|
814
|
-
#
|
815
|
-
# Sketchup.register_extension(utilities_extension, false)
|
816
|
-
#
|
817
|
-
# @note It is recommended to set +load_on_start+ to true unless you have a very
|
818
|
-
# good reason not to.
|
819
|
-
#
|
820
|
-
# @param [SketchupExtension] extension
|
821
|
-
# A SketchupExtension object.
|
822
|
-
#
|
823
|
-
# @param [Boolean] load_on_start
|
824
|
-
# Passing true into this will load the
|
825
|
-
# extension immediately and set it so
|
826
|
-
# that it will load automatically
|
827
|
-
# whenever SketchUp restarts.
|
828
|
-
#
|
829
|
-
# @return [Boolean] +true+ if extension registered properly
|
830
|
-
#
|
831
|
-
# @version SketchUp 6.0
|
832
|
-
def self.register_extension(extension, load_on_start = false)
|
833
|
-
end
|
834
|
-
|
835
|
-
# The register_importer method is used to register an importer with SketchUp.
|
836
|
-
#
|
837
|
-
# @example
|
838
|
-
# status = Sketchup.register_importer(importer)
|
839
|
-
#
|
840
|
-
# @param [Sketchup::Importer] importer
|
841
|
-
# An Importer object representing the importer.
|
842
|
-
#
|
843
|
-
# @return [Boolean] true if successful, false if unsuccessful.
|
844
|
-
#
|
845
|
-
# @version SketchUp 6.0
|
846
|
-
def self.register_importer(importer)
|
847
|
-
end
|
848
|
-
|
849
|
-
# The remove_observer method is used to remove an observer from the current
|
850
|
-
# object.
|
851
|
-
#
|
852
|
-
# @example
|
853
|
-
# status = Sketchup.remove_observer(observer)
|
854
|
-
#
|
855
|
-
# @param [Sketchup::AppObserver] observer
|
856
|
-
# An observer.
|
857
|
-
#
|
858
|
-
# @return [Boolean] true if successful, false if unsuccessful.
|
859
|
-
#
|
860
|
-
# @version SketchUp 6.0
|
861
|
-
def self.remove_observer(observer)
|
862
|
-
end
|
863
|
-
|
864
|
-
# The require method is used to include encrypted and nonencrypted ruby files.
|
865
|
-
# This is an alias of the Sketchup.load method.
|
866
|
-
#
|
867
|
-
# You do not need to include the file extension on the path. This method will
|
868
|
-
# look for .rbe first (encrypted) and then .rbs (the deprecated scrambled
|
869
|
-
# format) and finally .rb (unencrypted) files. The loading order was changed
|
870
|
-
# in SketchUp 2016 when the new .rbe encryption was introduced. Prior to
|
871
|
-
# SketchUp 2016 the loading order was first .rb then .rbs.
|
872
|
-
#
|
873
|
-
# @example
|
874
|
-
# sfile = "application_loader" # file extension not required
|
875
|
-
# status = Sketchup::require(sfile)
|
876
|
-
#
|
877
|
-
# @param [String] path
|
878
|
-
# The path, including the filename, to the file you want
|
879
|
-
# to require.
|
880
|
-
#
|
881
|
-
# @return [Boolean] True if the file is included. False if the
|
882
|
-
# file is not included.
|
883
|
-
#
|
884
|
-
# @version SketchUp 6.0
|
885
|
-
def self.require(path)
|
886
|
-
end
|
887
|
-
|
888
|
-
# The
|
889
|
-
#
|
890
|
-
#
|
891
|
-
#
|
892
|
-
#
|
893
|
-
#
|
894
|
-
#
|
895
|
-
#
|
896
|
-
#
|
897
|
-
#
|
898
|
-
# @param [
|
899
|
-
#
|
900
|
-
#
|
901
|
-
# @
|
902
|
-
#
|
903
|
-
#
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
#
|
908
|
-
#
|
909
|
-
#
|
910
|
-
#
|
911
|
-
#
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
# -
|
916
|
-
#
|
917
|
-
#
|
918
|
-
#
|
919
|
-
#
|
920
|
-
#
|
921
|
-
#
|
922
|
-
#
|
923
|
-
#
|
924
|
-
#
|
925
|
-
#
|
926
|
-
#
|
927
|
-
#
|
928
|
-
#
|
929
|
-
#
|
930
|
-
#
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
#
|
935
|
-
#
|
936
|
-
#
|
937
|
-
#
|
938
|
-
# -
|
939
|
-
# -
|
940
|
-
# -
|
941
|
-
# -
|
942
|
-
# -
|
943
|
-
# -
|
944
|
-
# -
|
945
|
-
# -
|
946
|
-
# -
|
947
|
-
# -
|
948
|
-
# -
|
949
|
-
# -
|
950
|
-
# -
|
951
|
-
# -
|
952
|
-
# -
|
953
|
-
# -
|
954
|
-
# -
|
955
|
-
# -
|
956
|
-
# -
|
957
|
-
# -
|
958
|
-
# -
|
959
|
-
# -
|
960
|
-
# -
|
961
|
-
# -
|
962
|
-
# -
|
963
|
-
# -
|
964
|
-
# -
|
965
|
-
# -
|
966
|
-
# -
|
967
|
-
# -
|
968
|
-
# -
|
969
|
-
# -
|
970
|
-
# -
|
971
|
-
# -
|
972
|
-
#
|
973
|
-
#
|
974
|
-
# -
|
975
|
-
# -
|
976
|
-
# -
|
977
|
-
# -
|
978
|
-
#
|
979
|
-
#
|
980
|
-
# -
|
981
|
-
#
|
982
|
-
#
|
983
|
-
# -
|
984
|
-
#
|
985
|
-
#
|
986
|
-
#
|
987
|
-
#
|
988
|
-
#
|
989
|
-
# -
|
990
|
-
# -
|
991
|
-
# -
|
992
|
-
# -
|
993
|
-
# -
|
994
|
-
# -
|
995
|
-
# -
|
996
|
-
# -
|
997
|
-
# -
|
998
|
-
# -
|
999
|
-
#
|
1000
|
-
#
|
1001
|
-
# -
|
1002
|
-
# -
|
1003
|
-
# -
|
1004
|
-
# -
|
1005
|
-
#
|
1006
|
-
#
|
1007
|
-
# -
|
1008
|
-
#
|
1009
|
-
#
|
1010
|
-
# -
|
1011
|
-
#
|
1012
|
-
#
|
1013
|
-
#
|
1014
|
-
#
|
1015
|
-
#
|
1016
|
-
# -
|
1017
|
-
# -
|
1018
|
-
# -
|
1019
|
-
# -
|
1020
|
-
# -
|
1021
|
-
# -
|
1022
|
-
# -
|
1023
|
-
# -
|
1024
|
-
# -
|
1025
|
-
# -
|
1026
|
-
# -
|
1027
|
-
# -
|
1028
|
-
# -
|
1029
|
-
# -
|
1030
|
-
# -
|
1031
|
-
# -
|
1032
|
-
# -
|
1033
|
-
# -
|
1034
|
-
# -
|
1035
|
-
# -
|
1036
|
-
# -
|
1037
|
-
# -
|
1038
|
-
# -
|
1039
|
-
# -
|
1040
|
-
# -
|
1041
|
-
# -
|
1042
|
-
# -
|
1043
|
-
# -
|
1044
|
-
# -
|
1045
|
-
# -
|
1046
|
-
# -
|
1047
|
-
# -
|
1048
|
-
# -
|
1049
|
-
# -
|
1050
|
-
# -
|
1051
|
-
# -
|
1052
|
-
# -
|
1053
|
-
# -
|
1054
|
-
# -
|
1055
|
-
# -
|
1056
|
-
# -
|
1057
|
-
# -
|
1058
|
-
# -
|
1059
|
-
# -
|
1060
|
-
# -
|
1061
|
-
# -
|
1062
|
-
# -
|
1063
|
-
# -
|
1064
|
-
# -
|
1065
|
-
# -
|
1066
|
-
# -
|
1067
|
-
# -
|
1068
|
-
# -
|
1069
|
-
# -
|
1070
|
-
# -
|
1071
|
-
# -
|
1072
|
-
# -
|
1073
|
-
# -
|
1074
|
-
# -
|
1075
|
-
# -
|
1076
|
-
# -
|
1077
|
-
# -
|
1078
|
-
# -
|
1079
|
-
# -
|
1080
|
-
# -
|
1081
|
-
# -
|
1082
|
-
# -
|
1083
|
-
# -
|
1084
|
-
# -
|
1085
|
-
# -
|
1086
|
-
# -
|
1087
|
-
# -
|
1088
|
-
# -
|
1089
|
-
# -
|
1090
|
-
# -
|
1091
|
-
# -
|
1092
|
-
# -
|
1093
|
-
# -
|
1094
|
-
# -
|
1095
|
-
# -
|
1096
|
-
# -
|
1097
|
-
# -
|
1098
|
-
# -
|
1099
|
-
# -
|
1100
|
-
# -
|
1101
|
-
# -
|
1102
|
-
# -
|
1103
|
-
# -
|
1104
|
-
# -
|
1105
|
-
# -
|
1106
|
-
# -
|
1107
|
-
# -
|
1108
|
-
# -
|
1109
|
-
# -
|
1110
|
-
# -
|
1111
|
-
# -
|
1112
|
-
# -
|
1113
|
-
#
|
1114
|
-
#
|
1115
|
-
#
|
1116
|
-
#
|
1117
|
-
#
|
1118
|
-
#
|
1119
|
-
#
|
1120
|
-
#
|
1121
|
-
#
|
1122
|
-
#
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
#
|
1127
|
-
#
|
1128
|
-
#
|
1129
|
-
#
|
1130
|
-
#
|
1131
|
-
# @
|
1132
|
-
#
|
1133
|
-
#
|
1134
|
-
# @
|
1135
|
-
#
|
1136
|
-
#
|
1137
|
-
#
|
1138
|
-
#
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
#
|
1144
|
-
#
|
1145
|
-
#
|
1146
|
-
#
|
1147
|
-
#
|
1148
|
-
#
|
1149
|
-
#
|
1150
|
-
#
|
1151
|
-
#
|
1152
|
-
#
|
1153
|
-
#
|
1154
|
-
#
|
1155
|
-
#
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
#
|
1160
|
-
#
|
1161
|
-
#
|
1162
|
-
#
|
1163
|
-
#
|
1164
|
-
#
|
1165
|
-
#
|
1166
|
-
#
|
1167
|
-
#
|
1168
|
-
#
|
1169
|
-
# @
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
#
|
1174
|
-
#
|
1175
|
-
#
|
1176
|
-
#
|
1177
|
-
#
|
1178
|
-
#
|
1179
|
-
#
|
1180
|
-
#
|
1181
|
-
#
|
1182
|
-
#
|
1183
|
-
#
|
1184
|
-
#
|
1185
|
-
#
|
1186
|
-
#
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
#
|
1192
|
-
#
|
1193
|
-
#
|
1194
|
-
#
|
1195
|
-
#
|
1196
|
-
#
|
1197
|
-
#
|
1198
|
-
#
|
1199
|
-
#
|
1200
|
-
#
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
#
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
#
|
1209
|
-
#
|
1210
|
-
#
|
1211
|
-
#
|
1212
|
-
# @
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
#
|
1217
|
-
#
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
#
|
1222
|
-
#
|
1223
|
-
#
|
1224
|
-
#
|
1225
|
-
#
|
1226
|
-
#
|
1227
|
-
# @
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
#
|
1234
|
-
#
|
1235
|
-
#
|
1236
|
-
#
|
1237
|
-
#
|
1238
|
-
#
|
1239
|
-
#
|
1240
|
-
#
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
#
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
#
|
1249
|
-
#
|
1250
|
-
#
|
1251
|
-
#
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
#
|
1256
|
-
#
|
1257
|
-
#
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
#
|
1262
|
-
#
|
1263
|
-
#
|
1264
|
-
#
|
1265
|
-
#
|
1266
|
-
#
|
1267
|
-
#
|
1268
|
-
# @
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
#
|
1275
|
-
#
|
1276
|
-
#
|
1277
|
-
#
|
1278
|
-
#
|
1279
|
-
#
|
1280
|
-
#
|
1281
|
-
#
|
1282
|
-
#
|
1283
|
-
#
|
1284
|
-
#
|
1285
|
-
#
|
1286
|
-
#
|
1287
|
-
# @
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
#
|
1294
|
-
#
|
1295
|
-
#
|
1296
|
-
#
|
1297
|
-
#
|
1298
|
-
#
|
1299
|
-
#
|
1300
|
-
#
|
1301
|
-
#
|
1302
|
-
#
|
1303
|
-
#
|
1304
|
-
#
|
1305
|
-
#
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1310
|
-
#
|
1311
|
-
#
|
1312
|
-
#
|
1313
|
-
#
|
1314
|
-
#
|
1315
|
-
#
|
1316
|
-
#
|
1317
|
-
#
|
1318
|
-
#
|
1319
|
-
#
|
1320
|
-
#
|
1321
|
-
#
|
1322
|
-
# @
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
#
|
1327
|
-
#
|
1328
|
-
#
|
1329
|
-
#
|
1330
|
-
#
|
1331
|
-
#
|
1332
|
-
#
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
#
|
1337
|
-
#
|
1338
|
-
#
|
1339
|
-
#
|
1340
|
-
#
|
1341
|
-
#
|
1342
|
-
#
|
1343
|
-
#
|
1344
|
-
#
|
1345
|
-
#
|
1346
|
-
#
|
1347
|
-
#
|
1348
|
-
#
|
1349
|
-
#
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
#
|
1354
|
-
#
|
1355
|
-
#
|
1356
|
-
#
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1
|
+
# Copyright:: Copyright 2023 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The Sketchup module contains a number of important utility methods for use in
|
5
|
+
# your Ruby scripts. Many of the classes in the API are implemented beneath
|
6
|
+
# this module. You can think of the Sketchup module as the "root" of the
|
7
|
+
# application tree. Most ruby calls start from the currently active model, and
|
8
|
+
# this is accessed via the Sketchup.active_model method.
|
9
|
+
#
|
10
|
+
# @example
|
11
|
+
# # Grab a handle to the currently active model (aka the one the user is
|
12
|
+
# # looking at in SketchUp.)
|
13
|
+
# model = Sketchup.active_model
|
14
|
+
#
|
15
|
+
# # Grab other handles to commonly used collections inside the model.
|
16
|
+
# entities = model.entities
|
17
|
+
# layers = model.layers
|
18
|
+
# materials = model.materials
|
19
|
+
# component_definitions = model.definitions
|
20
|
+
# selection = model.selection
|
21
|
+
#
|
22
|
+
# # Now that we have our handles, we can start pulling objects and making
|
23
|
+
# # method calls that are useful.
|
24
|
+
# first_entity = entities[0]
|
25
|
+
# UI.messagebox("First thing in your model is a " + first_entity.typename)
|
26
|
+
#
|
27
|
+
# number_materials = materials.length
|
28
|
+
# UI.messagebox("Your model has " + number_materials.to_s + " materials.")
|
29
|
+
#
|
30
|
+
# new_edge = entities.add_line( [0,0,0], [500,500,0])
|
31
|
+
#
|
32
|
+
# @version SketchUp 6.0
|
33
|
+
module Sketchup
|
34
|
+
|
35
|
+
# Class Methods
|
36
|
+
|
37
|
+
# The active_model method returns the currently active SketchUp model. On the
|
38
|
+
# PC, this is the only model that one can have access to via the API, but
|
39
|
+
# Macintosh versions of SketchUp can have multiple models open at once, in
|
40
|
+
# which case the method will return the model that the user currently has
|
41
|
+
# focused.
|
42
|
+
#
|
43
|
+
# @example
|
44
|
+
# model = Sketchup.active_model
|
45
|
+
# if !model
|
46
|
+
# UI.messagebox("Failure")
|
47
|
+
# else
|
48
|
+
# # code acting on the model
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
# @return [Sketchup::Model] active model object if successful, false if
|
52
|
+
# unsuccessful
|
53
|
+
#
|
54
|
+
# @version SketchUp 6.0
|
55
|
+
def self.active_model
|
56
|
+
end
|
57
|
+
|
58
|
+
# The add_observer method is used to add an observer to the current object.
|
59
|
+
#
|
60
|
+
# @example
|
61
|
+
# status = Sketchup.add_observer(observer)
|
62
|
+
#
|
63
|
+
# @param [Object] observer
|
64
|
+
# An observer.
|
65
|
+
#
|
66
|
+
# @return [Boolean] true if successful, false if unsuccessful.
|
67
|
+
#
|
68
|
+
# @version SketchUp 6.0
|
69
|
+
def self.add_observer(observer)
|
70
|
+
end
|
71
|
+
|
72
|
+
# The app_name method is used to retrieve the current application name.
|
73
|
+
#
|
74
|
+
# @example
|
75
|
+
# name = Sketchup.app_name
|
76
|
+
#
|
77
|
+
# @return [String] the name of the application, either
|
78
|
+
# "SketchUp Pro" or "SketchUp".
|
79
|
+
# Note: For versions earlier than SketchUp8 M4
|
80
|
+
# (Mac 8.0.15157 and Windows 8.0.15158) this function will
|
81
|
+
# return "Google SketchUp Pro" or "Google SketchUp".
|
82
|
+
#
|
83
|
+
# @version SketchUp 6.0
|
84
|
+
def self.app_name
|
85
|
+
end
|
86
|
+
|
87
|
+
# The break_edges= method can be used to disable or enable the break edges
|
88
|
+
# feature. Break edges is the SketchUp 7 feature that automatically splits
|
89
|
+
# edges that the user draws which cross over one another.
|
90
|
+
#
|
91
|
+
# This feature is always on by default and cannot be disabled by the user
|
92
|
+
# via the user interface, but you can call this method to disable it. Be
|
93
|
+
# cautious in doing so, however, as the resulting model could then be altered
|
94
|
+
# when the user later draws lines into it with the break edges feature
|
95
|
+
# reactivated.
|
96
|
+
#
|
97
|
+
# @example
|
98
|
+
# Sketchup.break_edges = false
|
99
|
+
#
|
100
|
+
# @param [Boolean] enabled
|
101
|
+
# If true, break edges will be turned on. If false, it
|
102
|
+
# will be deactivated.
|
103
|
+
#
|
104
|
+
# @return [Boolean] true if break edges was turned on.
|
105
|
+
#
|
106
|
+
# @version SketchUp 7.0
|
107
|
+
def self.break_edges=(enabled)
|
108
|
+
end
|
109
|
+
|
110
|
+
# The break_edges? method indicates whether the break edges feature is
|
111
|
+
# currently turned on. Break edges is the SketchUp 7 feature that
|
112
|
+
# automatically splits edges that the user draws which cross over one another.
|
113
|
+
# This feature is always on by default and cannot be disabled by the user
|
114
|
+
# via the user interface.
|
115
|
+
#
|
116
|
+
# @example
|
117
|
+
# is_on = Sketchup.break_edges?
|
118
|
+
#
|
119
|
+
# @return [Boolean]
|
120
|
+
#
|
121
|
+
# @version SketchUp 7.0
|
122
|
+
def self.break_edges?
|
123
|
+
end
|
124
|
+
|
125
|
+
# The create_texture_writer method is used to create a TextureWriter object.
|
126
|
+
#
|
127
|
+
# @example
|
128
|
+
# texturewriter = Sketchup.create_texture_writer
|
129
|
+
#
|
130
|
+
# @return [Sketchup::TextureWriter] a texturewriter object if successful.
|
131
|
+
#
|
132
|
+
# @version SketchUp 6.0
|
133
|
+
def self.create_texture_writer
|
134
|
+
end
|
135
|
+
|
136
|
+
# The debug_mode= method lets you controls whether SketchUp will output
|
137
|
+
# warnings to the console when it detects incorrect usage of the API.
|
138
|
+
# The setting takes effect right away, no need to restart SketchUp.
|
139
|
+
#
|
140
|
+
# @example
|
141
|
+
# Sketchup.debug_mode = true
|
142
|
+
#
|
143
|
+
# @note Changing this value within your extension can cause problems for other
|
144
|
+
# extension developers who rely on the debug information for their own work.
|
145
|
+
# Only use this locally; never change this value in an extension you
|
146
|
+
# publish.
|
147
|
+
#
|
148
|
+
# @param [Boolean] enabled
|
149
|
+
# If true, SketchUp will produce debug warnings.
|
150
|
+
#
|
151
|
+
# @return [Boolean]
|
152
|
+
#
|
153
|
+
# @version SketchUp 2016
|
154
|
+
def self.debug_mode=(enabled)
|
155
|
+
end
|
156
|
+
|
157
|
+
# The debug_mode? controls whether SketchUp will output warnings to the console
|
158
|
+
# when it detects incorrect usage of the API.
|
159
|
+
#
|
160
|
+
# @example
|
161
|
+
# debug_mode = Sketchup.debug_mode?
|
162
|
+
#
|
163
|
+
# @return [Boolean]
|
164
|
+
#
|
165
|
+
# @version SketchUp 2016
|
166
|
+
def self.debug_mode?
|
167
|
+
end
|
168
|
+
|
169
|
+
# The display_name_from_action method is used to gets a user-friendly name
|
170
|
+
# from an action string. See Sketchup.send_action for a list of valid
|
171
|
+
# action strings.
|
172
|
+
#
|
173
|
+
# @example
|
174
|
+
# Sketchup.display_name_from_action("viewRight:")
|
175
|
+
#
|
176
|
+
# @note This method has been non-functional on Mac since SketchUp 8.
|
177
|
+
#
|
178
|
+
# @param [String] action_name
|
179
|
+
# An action string.
|
180
|
+
#
|
181
|
+
# @return [String] a friendly name.
|
182
|
+
#
|
183
|
+
# @version SketchUp 6.0
|
184
|
+
def self.display_name_from_action(action_name)
|
185
|
+
end
|
186
|
+
|
187
|
+
# Returns the ExtensionsManager where you can find all registered
|
188
|
+
# SketchupExtension objects.
|
189
|
+
#
|
190
|
+
# #{extension.loaded?}"
|
191
|
+
# }
|
192
|
+
#
|
193
|
+
# @example
|
194
|
+
# extensions = Sketchup.extensions
|
195
|
+
# extensions.each{ |extension|
|
196
|
+
# puts "The next extension is named: #{extension.name} and its loaded? state is:
|
197
|
+
#
|
198
|
+
# @return [Sketchup::ExtensionsManager] an ExtensionsManager object.
|
199
|
+
#
|
200
|
+
# @version SketchUp 8.0 M2
|
201
|
+
def self.extensions
|
202
|
+
end
|
203
|
+
|
204
|
+
# The file_new method is used to create a new file.
|
205
|
+
#
|
206
|
+
# @example
|
207
|
+
# new_sketchup = Sketchup.file_new
|
208
|
+
#
|
209
|
+
# @return [Module] The Sketchup module.
|
210
|
+
#
|
211
|
+
# @version SketchUp 6.0
|
212
|
+
def self.file_new
|
213
|
+
end
|
214
|
+
|
215
|
+
# The find_support_files method is used to retrieve the relative path and name
|
216
|
+
# of a file within the SketchUp installation directory.
|
217
|
+
#
|
218
|
+
# Forward slashes must be used to delimit between directory names.
|
219
|
+
#
|
220
|
+
# @example
|
221
|
+
# help_file = Sketchup.find_support_file("help.html", "Plugins/")
|
222
|
+
# if help_file
|
223
|
+
# # Print out the help_file full path
|
224
|
+
# UI.messagebox(help_file)
|
225
|
+
#
|
226
|
+
# # Open the help_file in a web browser
|
227
|
+
# UI.openURL("file://" + help_file)
|
228
|
+
# else
|
229
|
+
# UI.messagebox("Failure")
|
230
|
+
# end
|
231
|
+
#
|
232
|
+
# @param [String] filename
|
233
|
+
# Name of the filename you want to find.
|
234
|
+
#
|
235
|
+
# @param [String] directory
|
236
|
+
# directory relative to the SketchUp
|
237
|
+
# installation directory.
|
238
|
+
#
|
239
|
+
# @return [String] the entire path if successful. If unsuccessful,
|
240
|
+
# the method returns false.
|
241
|
+
#
|
242
|
+
# @version SketchUp 6.0
|
243
|
+
def self.find_support_file(filename, directory)
|
244
|
+
end
|
245
|
+
|
246
|
+
# The find_support_files method is used to retrieve the path and name of all
|
247
|
+
# matching files within the SketchUp installation directory.
|
248
|
+
#
|
249
|
+
# Forward slashes must be used to delimit between directory names.
|
250
|
+
#
|
251
|
+
# @example
|
252
|
+
# files = Sketchup.find_support_files('rb', 'Plugins')
|
253
|
+
#
|
254
|
+
# @param [String] filename
|
255
|
+
# Extension of the files to be found.
|
256
|
+
#
|
257
|
+
# @param [String] directory
|
258
|
+
# directory relative to the SketchUp installation
|
259
|
+
# directory. Without this the result will
|
260
|
+
# be empty.
|
261
|
+
#
|
262
|
+
# @return [Array<String>] an array of files. If unsuccessful, the method
|
263
|
+
# returns false.
|
264
|
+
#
|
265
|
+
# @version SketchUp 6.0
|
266
|
+
def self.find_support_files(filename, directory)
|
267
|
+
end
|
268
|
+
|
269
|
+
# The fix_shadow_strings= method lets you control whether shadow rendering
|
270
|
+
# attempts to fix an artifact commonly referred to as "strings". The fix
|
271
|
+
# is actually very model dependent and not controllable from the UI, so this
|
272
|
+
# method can be used to control it.
|
273
|
+
#
|
274
|
+
# @example
|
275
|
+
# Sketchup.fix_shadow_strings = true
|
276
|
+
#
|
277
|
+
# @param [Boolean] enabled
|
278
|
+
# If true, shadow strings fix will be turned on. If
|
279
|
+
# false, it will be deactivated.
|
280
|
+
#
|
281
|
+
# @return [Boolean] true if shadow strings fix was turned on.
|
282
|
+
#
|
283
|
+
# @version SketchUp 8.0 M1
|
284
|
+
def self.fix_shadow_strings=(enabled)
|
285
|
+
end
|
286
|
+
|
287
|
+
# The fix_shadow_strings? method indicates whether the a fix for a shadow
|
288
|
+
# rendering artifact commonly referred to as "strings" is enabled. The fix
|
289
|
+
# is actually very model dependent and not controllable from the UI, so this
|
290
|
+
# method can be used to test it.
|
291
|
+
#
|
292
|
+
# @example
|
293
|
+
# is_on = Sketchup.fix_shadow_strings?
|
294
|
+
#
|
295
|
+
# @return [Boolean]
|
296
|
+
#
|
297
|
+
# @version SketchUp 8.0 M1
|
298
|
+
def self.fix_shadow_strings?
|
299
|
+
end
|
300
|
+
|
301
|
+
# The {.focus} method is used to focus the active model window.
|
302
|
+
#
|
303
|
+
# @example
|
304
|
+
# Sketchup.focus
|
305
|
+
#
|
306
|
+
# @see UI::HtmlDialog.bring_to_front
|
307
|
+
#
|
308
|
+
# @version SketchUp 2021.1
|
309
|
+
def self.focus
|
310
|
+
end
|
311
|
+
|
312
|
+
# The format_angle method takes a number as an angle in radians and formats it
|
313
|
+
# into degrees. For example, format_angle(Math::PI) will return 180.0.
|
314
|
+
#
|
315
|
+
# @example
|
316
|
+
# degrees = Sketchup.format_angle(Math::PI)
|
317
|
+
#
|
318
|
+
# @param [Numeric] number
|
319
|
+
# A number to be formatted.
|
320
|
+
#
|
321
|
+
# @return [String] an angle in degrees if successful, false if unsuccessful
|
322
|
+
#
|
323
|
+
# @version SketchUp 6.0
|
324
|
+
def self.format_angle(number)
|
325
|
+
end
|
326
|
+
|
327
|
+
# The {.format_area} method formats a number as an area using the current units
|
328
|
+
# settings.
|
329
|
+
#
|
330
|
+
# The +number+ must be in square inches.
|
331
|
+
#
|
332
|
+
# @example
|
333
|
+
# number = 3.m * 4.m # This will result in 12m2 in inches.
|
334
|
+
# formatted_area = Sketchup.format_area(number)
|
335
|
+
#
|
336
|
+
# @param [Numeric] number
|
337
|
+
# A number to be formatted.
|
338
|
+
#
|
339
|
+
# @return [String]
|
340
|
+
#
|
341
|
+
# @version SketchUp 6.0
|
342
|
+
def self.format_area(number)
|
343
|
+
end
|
344
|
+
|
345
|
+
# The format_degrees method formats a number as an angle given in degrees. For
|
346
|
+
# example, 10 becomes 10.0. This is the equivalent to a to_f call.
|
347
|
+
#
|
348
|
+
# @example
|
349
|
+
# degrees = Sketchup.format_degrees(number)
|
350
|
+
#
|
351
|
+
# @param [Numeric] number
|
352
|
+
# A number to be formatted.
|
353
|
+
#
|
354
|
+
# @return [String] degrees if successful, false if unsuccessful.
|
355
|
+
#
|
356
|
+
# @version SketchUp 6.0
|
357
|
+
def self.format_degrees(number)
|
358
|
+
end
|
359
|
+
|
360
|
+
# The {.format_length} method formats a number as a length using the current
|
361
|
+
# units settings.
|
362
|
+
#
|
363
|
+
# The default unit setting is inches. For example, 10 becomes 10".
|
364
|
+
#
|
365
|
+
# @example
|
366
|
+
# length = Sketchup.format_length(10)
|
367
|
+
#
|
368
|
+
# @overload format_length(number)
|
369
|
+
#
|
370
|
+
# @param [Numeric] number A number to be formatted.
|
371
|
+
#
|
372
|
+
# @overload format_length(number, precision)
|
373
|
+
#
|
374
|
+
# @param [Numeric] number A number to be formatted.
|
375
|
+
# @param [Integer] number A custom precision. Negative number will strip
|
376
|
+
# trailing zeros.
|
377
|
+
#
|
378
|
+
# @return [String]
|
379
|
+
#
|
380
|
+
# @version SketchUp 6.0
|
381
|
+
def self.format_length(*args)
|
382
|
+
end
|
383
|
+
|
384
|
+
# The {.format_volume} method formats a number as a volume using the current
|
385
|
+
# units settings.
|
386
|
+
#
|
387
|
+
# The +number+ must be in cubic inches.
|
388
|
+
#
|
389
|
+
# @example
|
390
|
+
# number = 3.m * 4.m * 5.m # This will result in 60m3 in inches.
|
391
|
+
# formatted_volume = Sketchup.format_area(number)
|
392
|
+
#
|
393
|
+
# @param [Numeric] number
|
394
|
+
# A number to be formatted.
|
395
|
+
#
|
396
|
+
# @return [String]
|
397
|
+
#
|
398
|
+
# @version SketchUp 2019.2
|
399
|
+
def self.format_volume(number)
|
400
|
+
end
|
401
|
+
|
402
|
+
# The get_datfile_info method is used to retrieve the value for the given key
|
403
|
+
# from Sketchup.dat.
|
404
|
+
#
|
405
|
+
# If the key is not found, default_value is returned.
|
406
|
+
#
|
407
|
+
# @example
|
408
|
+
# value = Sketchup.get_datfile_info(key, default_value)
|
409
|
+
#
|
410
|
+
# @param [String] key
|
411
|
+
# The key whose value you want to retrieve.
|
412
|
+
#
|
413
|
+
# @param [String] default_value
|
414
|
+
# The default value you want returned if key is not
|
415
|
+
# available.
|
416
|
+
#
|
417
|
+
# @return [String] a string value if successful.
|
418
|
+
#
|
419
|
+
# @version SketchUp 6.0
|
420
|
+
def self.get_datfile_info(key, default_value)
|
421
|
+
end
|
422
|
+
|
423
|
+
# The {.get_i18n_datfile_info} method is used to retrieve the value for the
|
424
|
+
# given key from the internationalization file that SketchUp uses to work
|
425
|
+
# in multiple languages.
|
426
|
+
#
|
427
|
+
# If the +key+ is not found, +default_value+ is returned.
|
428
|
+
#
|
429
|
+
# @example
|
430
|
+
# value = Sketchup.get_i18n_datfile_info(key, default_value)
|
431
|
+
#
|
432
|
+
# @param [String] key
|
433
|
+
# The key whose value you want to retrieve.
|
434
|
+
#
|
435
|
+
# @param [String] default_value
|
436
|
+
# The default value you want returned if key is not
|
437
|
+
# available.
|
438
|
+
#
|
439
|
+
# @return [String]
|
440
|
+
#
|
441
|
+
# @version SketchUp 6.0
|
442
|
+
def self.get_i18n_datfile_info(key, default_value)
|
443
|
+
end
|
444
|
+
|
445
|
+
# The os_language method returns the language code for the language SketchUp
|
446
|
+
# is running in. This is an alias for the get_locale method.
|
447
|
+
#
|
448
|
+
# Examples of return values are: en-US, fr, it, de, es, ja, ko, zh-CN, zh-TW,
|
449
|
+
# pt-BR, nl, ru and sv. For an up to date list os supported languages, see
|
450
|
+
# the SketchUp download page.
|
451
|
+
#
|
452
|
+
# @example
|
453
|
+
# language = Sketchup.os_language
|
454
|
+
#
|
455
|
+
# @return [String] a code representing the language SketchUp
|
456
|
+
# is displaying.
|
457
|
+
#
|
458
|
+
# @version SketchUp 6.0
|
459
|
+
def self.get_locale
|
460
|
+
end
|
461
|
+
|
462
|
+
# The get_resource_path is used to retrieve the directory where "resource"
|
463
|
+
# files are stored by SketchUp. Resource files include things like language
|
464
|
+
# localization files.
|
465
|
+
#
|
466
|
+
# @example
|
467
|
+
# directory = Sketchup.get_resource_path("Styles.strings")
|
468
|
+
#
|
469
|
+
# @param [String] filename
|
470
|
+
# The filename of a resource file in the resource directory hierarchy.
|
471
|
+
#
|
472
|
+
# @return [String] the directory path to the resources folder.
|
473
|
+
#
|
474
|
+
# @version SketchUp 6.0
|
475
|
+
def self.get_resource_path(filename)
|
476
|
+
end
|
477
|
+
|
478
|
+
# The get_shortcuts method retrieves an array of all keyboard shortcuts
|
479
|
+
# currently registered with SketchUp. Each shortcut is returned as a
|
480
|
+
# string with the shortcut and the command separated by a tab, similar
|
481
|
+
# to "Ctrl+A\\tEdit/Select All"
|
482
|
+
#
|
483
|
+
# @example
|
484
|
+
# shortcuts = Sketchup.get_shortcuts
|
485
|
+
#
|
486
|
+
# @return [Array<String>] an array of shortcut strings.
|
487
|
+
#
|
488
|
+
# @version SketchUp 6.0
|
489
|
+
def self.get_shortcuts
|
490
|
+
end
|
491
|
+
|
492
|
+
# Installs the contents of a ZIP archive file into SketchUp's Plugins folder.
|
493
|
+
# If the ZIP contains subfolders, these will be preserved. This allows for a
|
494
|
+
# Ruby API plugin or Extension developer to distribute their plugin as a single
|
495
|
+
# file regardless of how many asset files must be included.
|
496
|
+
#
|
497
|
+
# The user will be shown a warning message that they must agree to before the
|
498
|
+
# install proceeds. If they do not agree, an Interrupt error will be raised.
|
499
|
+
# If the user does agree but there is a problem with the unzip process, an
|
500
|
+
# Exception will be raised. You can capture these states via a begin/rescue.
|
501
|
+
# See the example below.
|
502
|
+
#
|
503
|
+
# If the install is successful, any Ruby files that have been added to
|
504
|
+
# the Plugins folder will immediately be executed, saving the user a restart.
|
505
|
+
#
|
506
|
+
# To create an archive file, use your favorite tool (7zip, Winzip, etc.) to zip
|
507
|
+
# up any files and folders in your plugins directory. If the archive contains a
|
508
|
+
# SketchupExtension that you would like users to be able to install from the
|
509
|
+
# Preferences > Extensions panel, rename your file to have a .rbz file
|
510
|
+
# extension.
|
511
|
+
#
|
512
|
+
# @example
|
513
|
+
# path = 'c:/temp/SomePluginPackage.zip'
|
514
|
+
# begin
|
515
|
+
# Sketchup.install_from_archive(path)
|
516
|
+
# rescue Interrupt => error
|
517
|
+
# UI.messagebox("User said 'no': " + error)
|
518
|
+
# rescue Exception => error
|
519
|
+
# UI.messagebox("Error during unzip: " + error)
|
520
|
+
# end
|
521
|
+
#
|
522
|
+
# @param [String] filepath
|
523
|
+
# The path to the RBZ or ZIP file to install.
|
524
|
+
#
|
525
|
+
# @param [Boolean] show_warning
|
526
|
+
# Whether to warn the user not to install untrusted extensions.
|
527
|
+
# In certain cases the warning can be confusing and redundant, e.g. when
|
528
|
+
# automatically updating a trusted extension. When the user has selected
|
529
|
+
# the archive themselves, it is best to warn about the possible risks.
|
530
|
+
#
|
531
|
+
# @raise [Exception] If the archive cannot be installed.
|
532
|
+
#
|
533
|
+
# @raise [Interrupt] If the user cancel the installation.
|
534
|
+
#
|
535
|
+
# @raise [Exception] If the archive cannot be found.
|
536
|
+
#
|
537
|
+
# @return [Boolean]
|
538
|
+
#
|
539
|
+
# @version SketchUp 8.0 M2
|
540
|
+
def self.install_from_archive(filepath, show_warning = true)
|
541
|
+
end
|
542
|
+
|
543
|
+
# This methods indicates whether the host SketchUp application is 64bit.
|
544
|
+
# Useful for extensions that ship with binaries and need to determine
|
545
|
+
# which versions to load.
|
546
|
+
#
|
547
|
+
# @example
|
548
|
+
# # For backward compatibility, check for the existence of the method
|
549
|
+
# # and load 32bit binaries for SketchUp versions that do not have this
|
550
|
+
# # method.
|
551
|
+
# if Sketchup.respond_to?(:is_64bit?) && Sketchup.is_64bit?
|
552
|
+
# # Load 64bit binaries.
|
553
|
+
# else
|
554
|
+
# # Load 32bit binaries.
|
555
|
+
# end
|
556
|
+
#
|
557
|
+
# @return [Boolean]
|
558
|
+
#
|
559
|
+
# @version SketchUp 2015
|
560
|
+
def self.is_64bit?
|
561
|
+
end
|
562
|
+
|
563
|
+
# The is_online method is used to verify a connection to the Internet. This
|
564
|
+
# method can take some time to execute, so be careful not to call it more often
|
565
|
+
# than you need.
|
566
|
+
#
|
567
|
+
# @example
|
568
|
+
# status = Sketchup.is_online
|
569
|
+
#
|
570
|
+
# @return [Boolean] true if successful, false if unsuccessful.
|
571
|
+
#
|
572
|
+
# @version SketchUp 6.0
|
573
|
+
def self.is_online
|
574
|
+
end
|
575
|
+
|
576
|
+
# Returns a boolean flag indicating whether the application is SketchUp Pro.
|
577
|
+
#
|
578
|
+
# @example
|
579
|
+
# if Sketchup.is_pro?
|
580
|
+
# UI.messagebox("You are running SU Pro.")
|
581
|
+
# end
|
582
|
+
#
|
583
|
+
# @note In SketchUp Make this method will return +true+ during the Pro trial
|
584
|
+
# period and revert to +false+ when the trial period is over.
|
585
|
+
#
|
586
|
+
# @return [Boolean]
|
587
|
+
#
|
588
|
+
# @version SketchUp 7.0
|
589
|
+
def self.is_pro?
|
590
|
+
end
|
591
|
+
|
592
|
+
# The is_valid_filename? method is used to determine whether a filename
|
593
|
+
# contains illegal characters.
|
594
|
+
#
|
595
|
+
# @example
|
596
|
+
# status = Sketchup.is_valid_filename?(filename)
|
597
|
+
#
|
598
|
+
# @param [String] filename
|
599
|
+
# A filename string.
|
600
|
+
#
|
601
|
+
# @return [Boolean]
|
602
|
+
#
|
603
|
+
# @version SketchUp 6.0
|
604
|
+
def self.is_valid_filename?(filename)
|
605
|
+
end
|
606
|
+
|
607
|
+
# The load method is used to include encrypted and nonencrypted ruby files.
|
608
|
+
#
|
609
|
+
# You do not need to include the file extension on the path. This method will
|
610
|
+
# look for .rb first (unencrypted) and then .rbe (encrypted) and finally .rbs
|
611
|
+
# (the deprecated scrambled format) files.
|
612
|
+
# See the "Distributing your Plugin" article for details.
|
613
|
+
#
|
614
|
+
# @example
|
615
|
+
# sfile = "application_loader" # file extension not required
|
616
|
+
# status = Sketchup.load(sfile)
|
617
|
+
#
|
618
|
+
# @param [String] path
|
619
|
+
# The path, including the filename, to the file you want
|
620
|
+
# to require.
|
621
|
+
#
|
622
|
+
# @return [Boolean] True if the file is included. False if the
|
623
|
+
# file is not included.
|
624
|
+
#
|
625
|
+
# @version SketchUp 6.0
|
626
|
+
def self.load(path)
|
627
|
+
end
|
628
|
+
|
629
|
+
# The {.open_file} method is used to open a SketchUp model.
|
630
|
+
#
|
631
|
+
# @example
|
632
|
+
# result = Sketchup.open_file("C:\\model.skp")
|
633
|
+
#
|
634
|
+
# @overload open_file(filename)
|
635
|
+
#
|
636
|
+
# @deprecated Prefer +with_status+ overload instead of this variant.
|
637
|
+
# @param [String] filename The model file to open.
|
638
|
+
# @return [Boolean] +true+ if opening the file succeeded,
|
639
|
+
# +false+ otherwise.
|
640
|
+
#
|
641
|
+
# @overload open_file(filename, with_status: true)
|
642
|
+
#
|
643
|
+
# Starting with SketchUp 2021.0 SketchUp attempts to load newer SketchUp
|
644
|
+
# models. If a newer model is loaded some information might have been skipped
|
645
|
+
# and extensions should be careful to not save over the file they loaded from
|
646
|
+
# as information might be lost.
|
647
|
+
#
|
648
|
+
# Success status codes:
|
649
|
+
# * {Sketchup::Model::LOAD_STATUS_SUCCESS}
|
650
|
+
# * {Sketchup::Model::LOAD_STATUS_SUCCESS_MORE_RECENT}
|
651
|
+
#
|
652
|
+
# @version SketchUp 2021.0
|
653
|
+
# @param [String] filename The model file to open.
|
654
|
+
# @return [Integer, false] status code if opening the file succeeded,
|
655
|
+
# +false+ otherwise.
|
656
|
+
#
|
657
|
+
# @version SketchUp 6.0
|
658
|
+
def self.open_file(*args)
|
659
|
+
end
|
660
|
+
|
661
|
+
# The os_language method returns the language code for the language SketchUp
|
662
|
+
# is running in. This is an alias for the get_locale method.
|
663
|
+
#
|
664
|
+
# Examples of return values are: en-US, fr, it, de, es, ja, ko, zh-CN, zh-TW,
|
665
|
+
# pt-BR, nl, ru and sv. For an up to date list os supported languages, see
|
666
|
+
# the SketchUp download page.
|
667
|
+
#
|
668
|
+
# @example
|
669
|
+
# language = Sketchup.os_language
|
670
|
+
#
|
671
|
+
# @return [String] a code representing the language SketchUp
|
672
|
+
# is displaying.
|
673
|
+
#
|
674
|
+
# @version SketchUp 6.0
|
675
|
+
def self.os_language
|
676
|
+
end
|
677
|
+
|
678
|
+
# The parse_length method parses a string as a length.
|
679
|
+
#
|
680
|
+
# For example, "200" becomes 200.0.
|
681
|
+
#
|
682
|
+
# @example
|
683
|
+
# float = Sketchup.parse_length("2'") # Returns 24 (representing inches)
|
684
|
+
# length = float.to_l # Convert to a Length type if needed.
|
685
|
+
#
|
686
|
+
# @param [String] string
|
687
|
+
# The string to be parsed as a number.
|
688
|
+
#
|
689
|
+
# @return [Float] the numerical representation of the string if
|
690
|
+
# successful, or nil if unsuccessful.
|
691
|
+
#
|
692
|
+
# @version SketchUp 6.0
|
693
|
+
def self.parse_length(string)
|
694
|
+
end
|
695
|
+
|
696
|
+
# This methods returns a symbol indicating the current platform.
|
697
|
+
#
|
698
|
+
# It should be used over RUBY_PLATFORM as this returns a different value for
|
699
|
+
# Windows since SketchUp 2014.
|
700
|
+
#
|
701
|
+
# Older SketchUp versions still need to check
|
702
|
+
# <code>RUBY_PLATFORM.include?('mswin')</code> or
|
703
|
+
# <code>RUBY_PLATFORM.include?('darwin')</code>.
|
704
|
+
#
|
705
|
+
# Possible return values:
|
706
|
+
# - :platform_win
|
707
|
+
# - :platform_osx
|
708
|
+
#
|
709
|
+
# @example
|
710
|
+
# module MyExtension
|
711
|
+
# IS_WIN = Sketchup.platform == :platform_win
|
712
|
+
# IS_OSX = Sketchup.platform == :platform_osx
|
713
|
+
# end
|
714
|
+
#
|
715
|
+
# @return [Symbol] Current OS platform.
|
716
|
+
#
|
717
|
+
# @version SketchUp 2014
|
718
|
+
def self.platform
|
719
|
+
end
|
720
|
+
|
721
|
+
# The plugins_disabled= method lets you control whether SketchUp will load
|
722
|
+
# Ruby scripts from the plugins directory at startup time. This is primarily
|
723
|
+
# a trouble-shooting method. If you are having strange behavior in SketchUp
|
724
|
+
# that you suspect is from a bad script, you can type
|
725
|
+
# Sketchup.plugins_disabled=true into the Ruby console and restart SketchUp
|
726
|
+
# to see if the problem is fixed.
|
727
|
+
#
|
728
|
+
# @example
|
729
|
+
# # Type this in the Ruby console then restart SketchUp.
|
730
|
+
# Sketchup.plugins_disabled = true
|
731
|
+
#
|
732
|
+
# # To reactivate plugins, type this into the Ruby console and restart.
|
733
|
+
# Sketchup.plugins_disabled = false
|
734
|
+
#
|
735
|
+
# @param [Boolean] enabled
|
736
|
+
# If true, the plugins directory will not load.
|
737
|
+
#
|
738
|
+
# @return [Boolean] true if plugins were disabled.
|
739
|
+
#
|
740
|
+
# @version SketchUp 8.0 M2
|
741
|
+
def self.plugins_disabled=(enabled)
|
742
|
+
end
|
743
|
+
|
744
|
+
# The plugins_disabled? method indicates whether Ruby scripts in the plugins
|
745
|
+
# directory will be loaded at startup time.
|
746
|
+
#
|
747
|
+
# @example
|
748
|
+
# is_disabled = Sketchup.plugins_disabled?
|
749
|
+
#
|
750
|
+
# @return [Boolean]
|
751
|
+
#
|
752
|
+
# @version SketchUp 8.0 M2
|
753
|
+
def self.plugins_disabled?
|
754
|
+
end
|
755
|
+
|
756
|
+
# The quit method is used to terminate the application. This will pop-up the
|
757
|
+
# usual model save prompts if there are unsaved models open. User can cancel
|
758
|
+
# the model save, in which case the application will not terminate.
|
759
|
+
#
|
760
|
+
# @example
|
761
|
+
# Sketchup.quit
|
762
|
+
# # Do not expect code to execute reliably after this point.
|
763
|
+
#
|
764
|
+
# @return self
|
765
|
+
#
|
766
|
+
# @version SketchUp 2014
|
767
|
+
def self.quit
|
768
|
+
end
|
769
|
+
|
770
|
+
# The read_default method is used to retrieve the string associated with a
|
771
|
+
# value within the specified sub-section section of a .INI file or registry
|
772
|
+
# (within the Software > SketchUp > SketchUp [Version] section).
|
773
|
+
#
|
774
|
+
# @example
|
775
|
+
# result = Sketchup.read_default("section", "variable", "default")
|
776
|
+
#
|
777
|
+
# @param [String] section
|
778
|
+
# A section in an .INI or registry.
|
779
|
+
#
|
780
|
+
# @param [String] variable
|
781
|
+
# A variable within the section.
|
782
|
+
#
|
783
|
+
# @param [Object] default
|
784
|
+
# A default value if the value is not found.
|
785
|
+
#
|
786
|
+
# @return [Object, nil] if unsuccessful, the value of the default
|
787
|
+
# if successful.
|
788
|
+
#
|
789
|
+
# @version SketchUp 6.0
|
790
|
+
def self.read_default(section, variable, default = nil)
|
791
|
+
end
|
792
|
+
|
793
|
+
# The redo method is used redo the last transaction on the redo stack.
|
794
|
+
#
|
795
|
+
# @example
|
796
|
+
# Sketchup.redo
|
797
|
+
#
|
798
|
+
# @return [nil]
|
799
|
+
#
|
800
|
+
# @version SketchUp 2021.0
|
801
|
+
def self.redo
|
802
|
+
end
|
803
|
+
|
804
|
+
# The register_extension method is used to register an extension with
|
805
|
+
# SketchUp's extension manager (in SketchUp preferences).
|
806
|
+
#
|
807
|
+
# @example
|
808
|
+
# utilities_extension = SketchupExtension.new("Utilities Tools",
|
809
|
+
# "Utilities/utilitiesTools.rb")
|
810
|
+
#
|
811
|
+
# utilities_extension.description = "Adds Tools->Utilities to the " +
|
812
|
+
# "SketchUp inteface. The Utilities submenu contains two tools: " +
|
813
|
+
# "Create Face and Query Tool."
|
814
|
+
#
|
815
|
+
# Sketchup.register_extension(utilities_extension, false)
|
816
|
+
#
|
817
|
+
# @note It is recommended to set +load_on_start+ to true unless you have a very
|
818
|
+
# good reason not to.
|
819
|
+
#
|
820
|
+
# @param [SketchupExtension] extension
|
821
|
+
# A SketchupExtension object.
|
822
|
+
#
|
823
|
+
# @param [Boolean] load_on_start
|
824
|
+
# Passing true into this will load the
|
825
|
+
# extension immediately and set it so
|
826
|
+
# that it will load automatically
|
827
|
+
# whenever SketchUp restarts.
|
828
|
+
#
|
829
|
+
# @return [Boolean] +true+ if extension registered properly
|
830
|
+
#
|
831
|
+
# @version SketchUp 6.0
|
832
|
+
def self.register_extension(extension, load_on_start = false)
|
833
|
+
end
|
834
|
+
|
835
|
+
# The register_importer method is used to register an importer with SketchUp.
|
836
|
+
#
|
837
|
+
# @example
|
838
|
+
# status = Sketchup.register_importer(importer)
|
839
|
+
#
|
840
|
+
# @param [Sketchup::Importer] importer
|
841
|
+
# An Importer object representing the importer.
|
842
|
+
#
|
843
|
+
# @return [Boolean] true if successful, false if unsuccessful.
|
844
|
+
#
|
845
|
+
# @version SketchUp 6.0
|
846
|
+
def self.register_importer(importer)
|
847
|
+
end
|
848
|
+
|
849
|
+
# The remove_observer method is used to remove an observer from the current
|
850
|
+
# object.
|
851
|
+
#
|
852
|
+
# @example
|
853
|
+
# status = Sketchup.remove_observer(observer)
|
854
|
+
#
|
855
|
+
# @param [Sketchup::AppObserver] observer
|
856
|
+
# An observer.
|
857
|
+
#
|
858
|
+
# @return [Boolean] true if successful, false if unsuccessful.
|
859
|
+
#
|
860
|
+
# @version SketchUp 6.0
|
861
|
+
def self.remove_observer(observer)
|
862
|
+
end
|
863
|
+
|
864
|
+
# The require method is used to include encrypted and nonencrypted ruby files.
|
865
|
+
# This is an alias of the Sketchup.load method.
|
866
|
+
#
|
867
|
+
# You do not need to include the file extension on the path. This method will
|
868
|
+
# look for .rbe first (encrypted) and then .rbs (the deprecated scrambled
|
869
|
+
# format) and finally .rb (unencrypted) files. The loading order was changed
|
870
|
+
# in SketchUp 2016 when the new .rbe encryption was introduced. Prior to
|
871
|
+
# SketchUp 2016 the loading order was first .rb then .rbs.
|
872
|
+
#
|
873
|
+
# @example
|
874
|
+
# sfile = "application_loader" # file extension not required
|
875
|
+
# status = Sketchup::require(sfile)
|
876
|
+
#
|
877
|
+
# @param [String] path
|
878
|
+
# The path, including the filename, to the file you want
|
879
|
+
# to require.
|
880
|
+
#
|
881
|
+
# @return [Boolean] True if the file is included. False if the
|
882
|
+
# file is not included.
|
883
|
+
#
|
884
|
+
# @version SketchUp 6.0
|
885
|
+
def self.require(path)
|
886
|
+
end
|
887
|
+
|
888
|
+
# The {.size_viewport} method changes the pixel size of the viewport and SketchUp window.
|
889
|
+
# This can be useful for producing a consistent behavior in automatic testing,
|
890
|
+
# regardless of the display resolution.
|
891
|
+
#
|
892
|
+
# @example
|
893
|
+
# model = Sketchup.active_model
|
894
|
+
# Sketchup.resize_viewport(model, 800, 600)
|
895
|
+
#
|
896
|
+
# @param [Sketchup::Model] model
|
897
|
+
#
|
898
|
+
# @param [Integer] width
|
899
|
+
# Width in physical pixels
|
900
|
+
#
|
901
|
+
# @param [Integer] height
|
902
|
+
# Height in physical pixels
|
903
|
+
#
|
904
|
+
# @return [Boolean] +true+ on success. +false+ if the window couldn't reach the desired size,
|
905
|
+
# e.g. because it wouldn't fit the screen.
|
906
|
+
#
|
907
|
+
# @see Sketchup::View#vpwidth
|
908
|
+
#
|
909
|
+
# @see Sketchup::View#vpheight
|
910
|
+
#
|
911
|
+
# @version SketchUp 2023.0
|
912
|
+
def self.resize_viewport(model, width, height)
|
913
|
+
end
|
914
|
+
|
915
|
+
# The save_thumbnail method is used to generate a thumbnail for any SKP file -
|
916
|
+
# not necessarily the loaded model.
|
917
|
+
#
|
918
|
+
# @example
|
919
|
+
# status = Sketchup.save_thumbnail("skp_filename", "image_filename")
|
920
|
+
#
|
921
|
+
# @param [String] skp_filename
|
922
|
+
# The name of the SketchUp file whose model you want
|
923
|
+
# represented in the thumbnail.
|
924
|
+
#
|
925
|
+
# @param [String] img_filename
|
926
|
+
# The name of the file where the thumbnail will be saved.
|
927
|
+
#
|
928
|
+
# @return [Boolean] true if successful, false if unsuccessful.
|
929
|
+
#
|
930
|
+
# @version SketchUp 6.0
|
931
|
+
def self.save_thumbnail(skp_filename, img_filename)
|
932
|
+
end
|
933
|
+
|
934
|
+
# The send_action method sends a message to the message queue to perform some
|
935
|
+
# action asynchronously.
|
936
|
+
#
|
937
|
+
# Valid actions are:
|
938
|
+
# - showRubyPanel:
|
939
|
+
# - viewBack:
|
940
|
+
# - viewBottom:
|
941
|
+
# - viewFront:
|
942
|
+
# - viewIso:
|
943
|
+
# - viewLeft:
|
944
|
+
# - viewRight:
|
945
|
+
# - viewTop:
|
946
|
+
# - viewPerspective:
|
947
|
+
# - viewShowAxes:
|
948
|
+
# - viewShowHidden:
|
949
|
+
# - viewZoomExtents:
|
950
|
+
# - viewZoomToSelection:
|
951
|
+
# - viewUndo:
|
952
|
+
# - selectOrbitTool:
|
953
|
+
# - selectPositionCameraTool:
|
954
|
+
# - selectDollyTool:
|
955
|
+
# - selectTurnTool:
|
956
|
+
# - selectWalkTool:
|
957
|
+
# - selectZoomTool:
|
958
|
+
# - selectFieldOfViewTool:
|
959
|
+
# - selectZoomWindowTool:
|
960
|
+
# - pageAdd:
|
961
|
+
# - pageDelete:
|
962
|
+
# - pageUpdate:
|
963
|
+
# - pageNext:
|
964
|
+
# - pagePrevious:
|
965
|
+
# - renderWireframe:
|
966
|
+
# - renderHiddenLine:
|
967
|
+
# - renderMonochrome:
|
968
|
+
# - renderShaded:
|
969
|
+
# - renderTextures:
|
970
|
+
# - selectArcTool:
|
971
|
+
# - selectArc3PointTool:
|
972
|
+
# - selectArc3PointPieTool:
|
973
|
+
# - selectAxisTool:
|
974
|
+
# - selectCircleTool:
|
975
|
+
# - selectEraseTool:
|
976
|
+
# - selectFreehandTool:
|
977
|
+
# - selectLineTool:
|
978
|
+
# - selectMeasureTool:
|
979
|
+
# - selectMoveTool:
|
980
|
+
# - selectOffsetTool:
|
981
|
+
# - selectPaintTool:
|
982
|
+
# - selectPolygonTool:
|
983
|
+
# - selectProtractorTool:
|
984
|
+
# - selectPushPullTool:
|
985
|
+
# - selectRectangleTool:
|
986
|
+
# - selectRectangle3PointTool:
|
987
|
+
# - selectRotateTool:
|
988
|
+
# - selectScaleTool:
|
989
|
+
# - selectSectionPlaneTool:
|
990
|
+
# - selectTextTool:
|
991
|
+
# - selectDimensionTool:
|
992
|
+
# - selectExtrudeTool:
|
993
|
+
# - selectSelectionTool:
|
994
|
+
# - editUndo:
|
995
|
+
# - editRedo:
|
996
|
+
# - editHide:
|
997
|
+
# - editUnhide:
|
998
|
+
# - fixNonPlanarFaces:
|
999
|
+
#
|
1000
|
+
# Added in SketchUp 8.0+:
|
1001
|
+
# - addBuilding:
|
1002
|
+
# - getPhotoTexture:
|
1003
|
+
# - selectImageIglooTool:
|
1004
|
+
# - selectNorthTool:
|
1005
|
+
#
|
1006
|
+
# Added in SketchUp 2013+:
|
1007
|
+
# - showExtensionStore:
|
1008
|
+
#
|
1009
|
+
# Removed in SketchUp 2013+:
|
1010
|
+
# - addBuilding:
|
1011
|
+
#
|
1012
|
+
# On the PC only, you can also send these numeric values. (Note that these are
|
1013
|
+
# officially "unsupported" and are not guaranteed to work in current or
|
1014
|
+
# future versions of the API.)
|
1015
|
+
#
|
1016
|
+
# - 10501: set view to Top
|
1017
|
+
# - 10502: set view to Front
|
1018
|
+
# - 10503: set view to Rear
|
1019
|
+
# - 10504: set view to Left
|
1020
|
+
# - 10505: set view to Right
|
1021
|
+
# - 10506: set view to Bottom
|
1022
|
+
# - 10507: set view to Axonometric
|
1023
|
+
# - 10510: set render mode to Wire
|
1024
|
+
# - 10511: set render mode to Hidden lines removal
|
1025
|
+
# - 10512: set render mode to Surfaces Shading
|
1026
|
+
# - 10513: set render mode to Transparency
|
1027
|
+
# - 10519: set camera to ortho (removes perspective)
|
1028
|
+
# - 10520: walk tool
|
1029
|
+
# - 10521: display the System Preferences dialog box (Files tab)
|
1030
|
+
# - 10522: removes axes display
|
1031
|
+
# - 10523: pan tool
|
1032
|
+
# - 10525: set the interactive eye height feature
|
1033
|
+
# - 10526: zoom window
|
1034
|
+
# - 10527: zoom extents
|
1035
|
+
# - 10529: zoom out 2
|
1036
|
+
# - 10531: toggle the Standard toolbar
|
1037
|
+
# - 10532: toggle the Camera toolbar
|
1038
|
+
# - 10533: display the Shadows Settings dialog box
|
1039
|
+
# - 10537: toggle the Views toolbar
|
1040
|
+
# - 10538: display the System Preferences dialog box (Display tab)
|
1041
|
+
# - 10545: toggle Shadows
|
1042
|
+
# - 10546: toggle Shadows toolbar
|
1043
|
+
# - 10551: toogle Large icons
|
1044
|
+
# - 10576: toggle Render Mode toolbar
|
1045
|
+
# - 21019: hide Status bar and VCB
|
1046
|
+
# - 21020: show Status bar and VCB
|
1047
|
+
# - 21022: hide Status bar and VCB
|
1048
|
+
# - 21023: place 3d text box
|
1049
|
+
# - 21024: select the Measure tool
|
1050
|
+
# - 21031: select the Freehand Draw tool
|
1051
|
+
# - 21041: select the PushPull tool
|
1052
|
+
# - 21048: select the Move tool
|
1053
|
+
# - 21052: hide selected objects
|
1054
|
+
# - 21056: create face with selected edges closed loop
|
1055
|
+
# - 21057: select the Protractor tool
|
1056
|
+
# - 21060: display Components Window
|
1057
|
+
# - 21061: toggle Draw toolbar
|
1058
|
+
# - 21063: toggle Model Bounding Box display
|
1059
|
+
# - 21065: select the Arc tool
|
1060
|
+
# - 21067: creat a new Page
|
1061
|
+
# - 21069: select the Arc 3 Point tool
|
1062
|
+
# - 21070: select the Arc 3 Point Pie tool
|
1063
|
+
# - 21074: show the Materials Browser Window
|
1064
|
+
# - 21076: display the Preferences dialog box (Text activated)
|
1065
|
+
# - 21077: display the Tip of the day Window
|
1066
|
+
# - 21078: select the Paint Bucket tool
|
1067
|
+
# - 21080: display the Page Manager Window
|
1068
|
+
# - 21082: display the Macros Dialog Box
|
1069
|
+
# - 21086: display the Components Browser Window
|
1070
|
+
# - 21094: select the Rectangle tool
|
1071
|
+
# - 21095: select the Polygon tool
|
1072
|
+
# - 21096: select the Circle tool
|
1073
|
+
# - 21098: open the Open Window
|
1074
|
+
# - 21100: select the Offset tool
|
1075
|
+
# - 21101: select all objects
|
1076
|
+
# - 21107: invert selection
|
1077
|
+
# - 21112: open the Import Window
|
1078
|
+
# - 21124: launch the validity check tool
|
1079
|
+
# - 21126: select the Axes tool
|
1080
|
+
# - 21029: select the Rotate tool
|
1081
|
+
# - 21032: toggle Layer toolbar
|
1082
|
+
# - 21036: display the Save as Window
|
1083
|
+
# - 21046: spin the model a full 360° and display report
|
1084
|
+
# - 21047: fast Pick Time report
|
1085
|
+
# - 21049: open the Export model Window
|
1086
|
+
# - 21169: select the Position Camera tool
|
1087
|
+
# - 21170: display the Preferences, Tour Guide activated
|
1088
|
+
# - 21180: create a new Page just right of selected page
|
1089
|
+
# - 21200: display the Insert Image Window
|
1090
|
+
# - 21233: display Area of selected face
|
1091
|
+
# - 21234: display Area of all faces with selected material
|
1092
|
+
# - 21236: select the Scale tool
|
1093
|
+
# - 21237: display the Export 2D Graphics Window
|
1094
|
+
# - 21245: display a Polygon Offset Factors dialog box
|
1095
|
+
# - 21276: reverse selected face(s)
|
1096
|
+
# - 21287: select the Divide feature
|
1097
|
+
# - 21337: select the Section Plane Placement tool
|
1098
|
+
# - 21354: open the Layer Window
|
1099
|
+
# - 21386: open the Export Animation Window
|
1100
|
+
# - 21405: select the Text tool
|
1101
|
+
# - 21406: display Fog dialog box
|
1102
|
+
# - 21410: select the Dim tool
|
1103
|
+
# - 21433: toggle Edit toolbar
|
1104
|
+
# - 21442: select the FollowMe tool
|
1105
|
+
# - 21448: select the Axes tool
|
1106
|
+
# - 21453: select all objects
|
1107
|
+
# - 21460: display Licence
|
1108
|
+
# - 21462: display Authorization dialog box
|
1109
|
+
# - 21463: display un-authorizing message
|
1110
|
+
# - 21464: display Open Licence files (Network) Window
|
1111
|
+
# - 21466: display Quick reference Card in Adobe Reader
|
1112
|
+
# - 21467: display Licences in use dialog box
|
1113
|
+
# - 21469: zoom extents to selected objects
|
1114
|
+
# - 21476: perform a non-planar check on selected objects
|
1115
|
+
# - 21477: list accelerators in window
|
1116
|
+
# - 21485: erase selected objects
|
1117
|
+
# - 21487: display Edit current material dialog box
|
1118
|
+
# - 21485: erase all new created pages
|
1119
|
+
# - 21488: display Entity Info Window
|
1120
|
+
# - 21490: display Soften Edges Window
|
1121
|
+
# - 21491: display Profiles
|
1122
|
+
# - 21492: display Extended Edges
|
1123
|
+
# - 21493: display Jitter Lines
|
1124
|
+
# - 21494: select Field of view tool
|
1125
|
+
# - 21513: display the outliner
|
1126
|
+
# - 21520: override Tile Rendering Size dialog box
|
1127
|
+
# - 21525: select the FollowMe tool
|
1128
|
+
# - 21542: display the Insert Image Window
|
1129
|
+
# - 21560 and up: causes a runtime Error
|
1130
|
+
#
|
1131
|
+
# @example
|
1132
|
+
# result = Sketchup.send_action("selectArcTool:")
|
1133
|
+
#
|
1134
|
+
# @param [String, Integer] action
|
1135
|
+
# The action to be performed.
|
1136
|
+
#
|
1137
|
+
# @return [Boolean] +true+ if successful, +false+ if unsuccessful
|
1138
|
+
#
|
1139
|
+
# @version SketchUp 6.0
|
1140
|
+
def self.send_action(action)
|
1141
|
+
end
|
1142
|
+
|
1143
|
+
# The {.send_to_layout} method is used to open a file in LayOut.
|
1144
|
+
#
|
1145
|
+
# @example
|
1146
|
+
# result = Sketchup.send_to_layout("C:/models/hexaflexagon.layout")
|
1147
|
+
#
|
1148
|
+
# @param [String] file
|
1149
|
+
# The path and filename to open, either .skp or .layout.
|
1150
|
+
#
|
1151
|
+
# @return [Boolean] true if opening the file succeeded,
|
1152
|
+
# false otherwise. If LayOut is not installed or the file is not present
|
1153
|
+
# this function will return false.
|
1154
|
+
#
|
1155
|
+
# @version SketchUp 2018
|
1156
|
+
def self.send_to_layout(file)
|
1157
|
+
end
|
1158
|
+
|
1159
|
+
# The set_status_text method is used to
|
1160
|
+
# set the text appearing on the status bar within the drawing window.
|
1161
|
+
#
|
1162
|
+
# If no arguments are passed, the status bar content is cleared. Valid
|
1163
|
+
# positions are:
|
1164
|
+
#
|
1165
|
+
# - +SB_PROMPT+ - the text will appear at the left-side of the status bar
|
1166
|
+
# - +SB_VCB_LABEL+ - the text will appear in place of the VCB label
|
1167
|
+
# - +SB_VCB_VALUE+ - the text will appear in the VCB
|
1168
|
+
#
|
1169
|
+
# @example
|
1170
|
+
# result = Sketchup.set_status_text("This is a Test", SB_VCB_VALUE)
|
1171
|
+
# if result
|
1172
|
+
# #code to do something if set_status_text is successful
|
1173
|
+
# end
|
1174
|
+
#
|
1175
|
+
# @overload set_status_text
|
1176
|
+
#
|
1177
|
+
# Clears all status panes.
|
1178
|
+
# @return [nil]
|
1179
|
+
#
|
1180
|
+
# @overload set_status_text(status_text = '', position = SB_PROMPT)
|
1181
|
+
#
|
1182
|
+
# @param [String] status text the status text that will appear.
|
1183
|
+
# @param [Integer] position the position where the text will appear.
|
1184
|
+
# @return [nil]
|
1185
|
+
#
|
1186
|
+
# @version SketchUp 6.0
|
1187
|
+
def self.set_status_text(*args)
|
1188
|
+
end
|
1189
|
+
|
1190
|
+
# The status_text= method is used to set the text appearing on the status
|
1191
|
+
# bar within the drawing window.
|
1192
|
+
#
|
1193
|
+
# This is the same as calling set_status_text with a 2nd parameter of
|
1194
|
+
# SB_PROMPT.
|
1195
|
+
#
|
1196
|
+
# @example
|
1197
|
+
# result = Sketchup.status_text = "This is a Test"
|
1198
|
+
#
|
1199
|
+
# @param [String] status_text
|
1200
|
+
# The status text that will appear.
|
1201
|
+
#
|
1202
|
+
# @return [String]
|
1203
|
+
#
|
1204
|
+
# @version SketchUp 6.0
|
1205
|
+
def self.status_text=(status_text)
|
1206
|
+
end
|
1207
|
+
|
1208
|
+
# The temp_dir method is used to retrieve the OS temporary directory for the
|
1209
|
+
# current user. You can use this directory to write temporary files that are
|
1210
|
+
# not required to persist between SketchUp sessions.
|
1211
|
+
#
|
1212
|
+
# @example
|
1213
|
+
# temp_dir = Sketchup.temp_dir
|
1214
|
+
#
|
1215
|
+
# @return [String] a string containing the full temporary directory path
|
1216
|
+
#
|
1217
|
+
# @version SketchUp 2014
|
1218
|
+
def self.temp_dir
|
1219
|
+
end
|
1220
|
+
|
1221
|
+
# The template method is used to get the file name of the current template.
|
1222
|
+
# Templates are the .skp files that are loaded when the user select File > New.
|
1223
|
+
#
|
1224
|
+
# @example
|
1225
|
+
# name = Sketchup.template
|
1226
|
+
#
|
1227
|
+
# @return [String] the current template
|
1228
|
+
#
|
1229
|
+
# @version SketchUp 6.0
|
1230
|
+
def self.template
|
1231
|
+
end
|
1232
|
+
|
1233
|
+
# The template= method is used to set the file name of the current template.
|
1234
|
+
# Templates are the .skp files that are loaded when the user select File > New.
|
1235
|
+
#
|
1236
|
+
# @example
|
1237
|
+
# status = Sketchup.template = "filename"
|
1238
|
+
#
|
1239
|
+
# @param [String] filename
|
1240
|
+
# The name of the template to set.
|
1241
|
+
#
|
1242
|
+
# @return [String] true if successful, false if unsuccessful.
|
1243
|
+
#
|
1244
|
+
# @version SketchUp 6.0
|
1245
|
+
def self.template=(filename)
|
1246
|
+
end
|
1247
|
+
|
1248
|
+
# The template_dir is used to retrieve the directory where templates are
|
1249
|
+
# stored by the SketchUp install. Templates are the .skp files that are loaded
|
1250
|
+
# when the user select File > New.
|
1251
|
+
#
|
1252
|
+
# @example
|
1253
|
+
# directory = Sketchup.template_dir
|
1254
|
+
#
|
1255
|
+
# @return [String] containing the full template directory path
|
1256
|
+
#
|
1257
|
+
# @version SketchUp 6.0
|
1258
|
+
def self.template_dir
|
1259
|
+
end
|
1260
|
+
|
1261
|
+
# The undo method is used undo the last transaction on the undo stack.
|
1262
|
+
#
|
1263
|
+
# @example
|
1264
|
+
# Sketchup.undo
|
1265
|
+
#
|
1266
|
+
# @return [nil]
|
1267
|
+
#
|
1268
|
+
# @version SketchUp 6.0
|
1269
|
+
def self.undo
|
1270
|
+
end
|
1271
|
+
|
1272
|
+
# The vcb_label= method is used to set the label that appears on the vcb,
|
1273
|
+
# or the "value control box", which is another word for the "measurements"
|
1274
|
+
# text entry box that appears at the bottom on the SketchUp window.
|
1275
|
+
#
|
1276
|
+
# This is the same as calling set_status_text with a 2nd parameter of
|
1277
|
+
# SB_VCB_LABEL.
|
1278
|
+
#
|
1279
|
+
# @example
|
1280
|
+
# result = Sketchup.vcb_label = "This is a Test"
|
1281
|
+
#
|
1282
|
+
# @param [String] label_text
|
1283
|
+
# The label text that will appear.
|
1284
|
+
#
|
1285
|
+
# @return [String]
|
1286
|
+
#
|
1287
|
+
# @version SketchUp 6.0
|
1288
|
+
def self.vcb_label=(label_text)
|
1289
|
+
end
|
1290
|
+
|
1291
|
+
# The vcb_value= method is used to set the value that appears on the vcb,
|
1292
|
+
# or the "value control box", which is another word for the "measurements"
|
1293
|
+
# text entry box that appears at the bottom on the SketchUp window.
|
1294
|
+
#
|
1295
|
+
# This is the same as calling set_status_text with a 2nd parameter of
|
1296
|
+
# SB_VCB_VALUE.
|
1297
|
+
#
|
1298
|
+
# @example
|
1299
|
+
# result = Sketchup.vcb_value = "This is a Test"
|
1300
|
+
#
|
1301
|
+
# @param [String] value
|
1302
|
+
# The text that will appear as the vcb's value.
|
1303
|
+
#
|
1304
|
+
# @return [String]
|
1305
|
+
#
|
1306
|
+
# @version SketchUp 6.0
|
1307
|
+
def self.vcb_value=(value)
|
1308
|
+
end
|
1309
|
+
|
1310
|
+
# Gets the current version of sketchup in decimal form.
|
1311
|
+
#
|
1312
|
+
# @example
|
1313
|
+
# version = Sketchup.version
|
1314
|
+
# if (version)
|
1315
|
+
# UI.messagebox version
|
1316
|
+
# else
|
1317
|
+
# return
|
1318
|
+
# end
|
1319
|
+
#
|
1320
|
+
# @return [String] the decimal form of the version
|
1321
|
+
#
|
1322
|
+
# @version SketchUp 6.0
|
1323
|
+
def self.version
|
1324
|
+
end
|
1325
|
+
|
1326
|
+
# Get the current version of sketchup as a whole number for comparisons. The
|
1327
|
+
# number returned has the major, minor, and build values packed into an integer
|
1328
|
+
# value as follows:
|
1329
|
+
# - Major version = X
|
1330
|
+
# - Minor version = Y
|
1331
|
+
# - Build number = Z
|
1332
|
+
#
|
1333
|
+
# SketchUp 6.0 - SketchUp 2015
|
1334
|
+
# - XXYYYZZZ
|
1335
|
+
#
|
1336
|
+
# SketchUp 2016+
|
1337
|
+
# - XXYZZZZZZZ
|
1338
|
+
#
|
1339
|
+
# @example
|
1340
|
+
# if (15003000...15004000) === Sketchup.version_number
|
1341
|
+
# puts "SketchUp 15.3"
|
1342
|
+
# end
|
1343
|
+
# if Sketchup.version_number >= 1600000000
|
1344
|
+
# puts "New format"
|
1345
|
+
# end
|
1346
|
+
#
|
1347
|
+
# @return [Integer] the whole number form of the version
|
1348
|
+
#
|
1349
|
+
# @version SketchUp 6.0
|
1350
|
+
def self.version_number(*args)
|
1351
|
+
end
|
1352
|
+
|
1353
|
+
# The write_default method is used to set the string associated with a
|
1354
|
+
# variable within the specified sub-section of a .plist file on the Mac
|
1355
|
+
# or the registry on Windows
|
1356
|
+
# (within the Software > SketchUp > SketchUp [Version] section).
|
1357
|
+
#
|
1358
|
+
# @example
|
1359
|
+
# result = Sketchup.write_default("section", "key", "my_value")
|
1360
|
+
#
|
1361
|
+
# @param [String] section
|
1362
|
+
# A section in a .plist file (Mac) or the registry
|
1363
|
+
# (Windows).
|
1364
|
+
#
|
1365
|
+
# @param [String] key
|
1366
|
+
# A key within the section.
|
1367
|
+
#
|
1368
|
+
# @param [Object] value
|
1369
|
+
# The value to store.
|
1370
|
+
#
|
1371
|
+
# @return [Boolean] True if successful, false if unsuccessful.
|
1372
|
+
#
|
1373
|
+
# @version SketchUp 6.0
|
1374
|
+
def self.write_default(section, key, value)
|
1375
|
+
end
|
1376
|
+
|
1377
|
+
end
|