sketchup-api-stubs 0.7.8 → 0.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/sketchup-api-stubs/sketchup.rb +3 -0
- data/lib/sketchup-api-stubs/stubs/Array.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +4 -18
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +17 -19
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +3 -3
- data/lib/sketchup-api-stubs/stubs/Geom.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +50 -1
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +56 -3
- data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +4 -1
- data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +73 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +7 -7
- data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/ReferenceEntity.rb +82 -0
- data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +24 -2
- data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Length.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Numeric.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +18 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +3 -5
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +4 -9
- data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +4 -5
- data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +44 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +25 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +13 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +62 -167
- data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +246 -209
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +3 -14
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +10 -36
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +4 -5
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +1 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +16 -26
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +29 -30
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +9 -7
- data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +2 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +28 -23
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +4 -5
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +5 -18
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +1 -1
- 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 +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +15 -17
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +21 -18
- data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +18 -9
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +4 -5
- data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +15 -20
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +17 -20
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +30 -18
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup.rb +48 -14
- data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/String.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +29 -31
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +18 -9
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +3 -3
- data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +5 -4
- data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +16 -18
- data/lib/sketchup-api-stubs/stubs/UI.rb +71 -26
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +1 -9
- metadata +10 -7
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright:: Copyright
|
1
|
+
# Copyright:: Copyright 2024 Trimble Inc.
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
4
|
# This is the interface to a SketchUp model. The model is the 3D drawing that
|
@@ -394,7 +394,7 @@ class Sketchup::Model
|
|
394
394
|
def classifications
|
395
395
|
end
|
396
396
|
|
397
|
-
# The close method is used to close this model. On Mac OS, only the active
|
397
|
+
# The {#close} method is used to close this model. On Mac OS, only the active
|
398
398
|
# model can be closed. On Windows, since there can be only one document open,
|
399
399
|
# this method will perform a File/New operation.
|
400
400
|
#
|
@@ -403,10 +403,14 @@ class Sketchup::Model
|
|
403
403
|
# model = Sketchup.active_model
|
404
404
|
# model.close
|
405
405
|
#
|
406
|
+
# @note As of SketchUp 2024.0 this method will ensure the next model window
|
407
|
+
# gets focus if there is one. Before that `Sketchup.active_model` might
|
408
|
+
# return `nil` after calling this method even though more models where open.
|
409
|
+
#
|
406
410
|
# @param [Boolean] ignore_changes
|
407
|
-
# If true
|
411
|
+
# If `true`, model changes will be
|
408
412
|
# ignored and save prompts will be suppressed.
|
409
|
-
# If false
|
413
|
+
# If `false`, changes will not be ignored and save
|
410
414
|
# prompts will be displayed normally.
|
411
415
|
#
|
412
416
|
# @return [nil]
|
@@ -943,7 +947,8 @@ class Sketchup::Model
|
|
943
947
|
def latlong_to_point(lnglat_array)
|
944
948
|
end
|
945
949
|
|
946
|
-
# The {#layers method retrieves a collection of all Layers objects
|
950
|
+
# The {#layers} method retrieves a collection of all {Sketchup::Layers} objects
|
951
|
+
# in the model.
|
947
952
|
#
|
948
953
|
# @example
|
949
954
|
# model = Sketchup.active_model
|
@@ -1096,6 +1101,20 @@ class Sketchup::Model
|
|
1096
1101
|
def options
|
1097
1102
|
end
|
1098
1103
|
|
1104
|
+
#
|
1105
|
+
# @api Overlays
|
1106
|
+
#
|
1107
|
+
# @example
|
1108
|
+
# Sketchup.active_model.overlays.each { |overlay|
|
1109
|
+
# puts "#{overlay.name} (#{overlay.overlay_id}) Enabled: #{overlay.enabled?}"
|
1110
|
+
# }
|
1111
|
+
#
|
1112
|
+
# @return [Sketchup::OverlaysManager]
|
1113
|
+
#
|
1114
|
+
# @version SketchUp 2023.0
|
1115
|
+
def overlays
|
1116
|
+
end
|
1117
|
+
|
1099
1118
|
# The {#pages} method retrieves a {Sketchup::Pages} object containing all of
|
1100
1119
|
# the pages in the model.
|
1101
1120
|
#
|
@@ -1279,6 +1298,9 @@ class Sketchup::Model
|
|
1279
1298
|
# @note A bug in SketchUp 2016 and older caused the +.skb+ backup file
|
1280
1299
|
# written during save to be empty. The +.skp+ file was however valid.
|
1281
1300
|
#
|
1301
|
+
# @note Starting with SketchUp 2021, SketchUp is using a the same file format across versions.
|
1302
|
+
# For instance, SketchUp 2021 can open a file made in SketchUp 2022.
|
1303
|
+
#
|
1282
1304
|
# @overload save
|
1283
1305
|
#
|
1284
1306
|
# Save model to the path it is already associated with.
|
@@ -1335,24 +1357,7 @@ class Sketchup::Model
|
|
1335
1357
|
# The path of the file to save the model copy to.
|
1336
1358
|
#
|
1337
1359
|
# @param [Integer] version
|
1338
|
-
#
|
1339
|
-
# If not provided, latest file format will be used.
|
1340
|
-
# Possible values are:
|
1341
|
-
# - Sketchup::Model::VERSION_3,
|
1342
|
-
# - Sketchup::Model::VERSION_4,
|
1343
|
-
# - Sketchup::Model::VERSION_5,
|
1344
|
-
# - Sketchup::Model::VERSION_6,
|
1345
|
-
# - Sketchup::Model::VERSION_7,
|
1346
|
-
# - Sketchup::Model::VERSION_8,
|
1347
|
-
# - Sketchup::Model::VERSION_2013,
|
1348
|
-
# - Sketchup::Model::VERSION_2014,
|
1349
|
-
# - Sketchup::Model::VERSION_2015,
|
1350
|
-
# - Sketchup::Model::VERSION_2016,
|
1351
|
-
# - Sketchup::Model::VERSION_2017,
|
1352
|
-
# - Sketchup::Model::VERSION_2018,
|
1353
|
-
# - Sketchup::Model::VERSION_2019,
|
1354
|
-
# - Sketchup::Model::VERSION_2020,
|
1355
|
-
# - Sketchup::Model::VERSION_2021
|
1360
|
+
# See {Sketchup::Model#save} for supported values.
|
1356
1361
|
#
|
1357
1362
|
# @return [Boolean] true if successful, false if unsuccessful
|
1358
1363
|
#
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright:: Copyright
|
1
|
+
# Copyright:: Copyright 2024 Trimble Inc.
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
4
|
# The OptionsManager class manages various kinds of OptionsProviders on a
|
@@ -65,19 +65,18 @@ class Sketchup::OptionsManager
|
|
65
65
|
def count
|
66
66
|
end
|
67
67
|
|
68
|
-
# The each method is used to iterate through options providers.
|
68
|
+
# The {#each} method is used to iterate through options providers.
|
69
69
|
#
|
70
70
|
# @example
|
71
71
|
# model = Sketchup.active_model
|
72
72
|
# manager = model.options
|
73
73
|
# manager.each { |provider| puts provider.name }
|
74
74
|
#
|
75
|
-
# @return nil
|
75
|
+
# @return [nil]
|
76
76
|
#
|
77
77
|
# @version SketchUp 6.0
|
78
78
|
#
|
79
|
-
# @
|
80
|
-
# as they are found.
|
79
|
+
# @yieldparam [Sketchup::OptionsProvider] provider
|
81
80
|
def each
|
82
81
|
end
|
83
82
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright:: Copyright
|
1
|
+
# Copyright:: Copyright 2024 Trimble Inc.
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
4
|
# An +OptionsProvider+ class provides various kinds of options on a
|
@@ -111,8 +111,6 @@ class Sketchup::OptionsProvider
|
|
111
111
|
#
|
112
112
|
# @version SketchUp 6.0
|
113
113
|
#
|
114
|
-
# @yield [key, value]
|
115
|
-
#
|
116
114
|
# @yieldparam [String] key
|
117
115
|
#
|
118
116
|
# @yieldparam [Object] value
|
@@ -128,8 +126,6 @@ class Sketchup::OptionsProvider
|
|
128
126
|
#
|
129
127
|
# @version SketchUp 6.0
|
130
128
|
#
|
131
|
-
# @yield [key]
|
132
|
-
#
|
133
129
|
# @yieldparam [String] key
|
134
130
|
def each_key
|
135
131
|
end
|
@@ -147,27 +143,23 @@ class Sketchup::OptionsProvider
|
|
147
143
|
#
|
148
144
|
# @version SketchUp 6.0
|
149
145
|
#
|
150
|
-
# @yield [key, value]
|
151
|
-
#
|
152
146
|
# @yieldparam [String] key
|
153
147
|
#
|
154
148
|
# @yieldparam [Object] value
|
155
149
|
def each_pair
|
156
150
|
end
|
157
151
|
|
158
|
-
# The each_value method is used to iterate through all of the attribute
|
152
|
+
# The {#each_value} method is used to iterate through all of the attribute
|
159
153
|
# values.
|
160
154
|
#
|
161
|
-
# Throws an exception if there are no keys.
|
162
|
-
#
|
163
155
|
# @example
|
164
156
|
# provider.each_value { |value| puts value }
|
165
157
|
#
|
166
|
-
# @return nil
|
158
|
+
# @return [nil]
|
167
159
|
#
|
168
160
|
# @version SketchUp 6.0
|
169
161
|
#
|
170
|
-
# @
|
162
|
+
# @yieldparam [Object] value
|
171
163
|
def each_value
|
172
164
|
end
|
173
165
|
|
@@ -208,16 +200,11 @@ class Sketchup::OptionsProvider
|
|
208
200
|
def key?(name)
|
209
201
|
end
|
210
202
|
|
211
|
-
# The keys method is used to retrieve an array with all of the attribute keys.
|
203
|
+
# The {#keys} method is used to retrieve an array with all of the attribute keys.
|
212
204
|
#
|
213
205
|
# @example
|
214
206
|
# keys = provider.keys
|
215
207
|
# key = keys[0]
|
216
|
-
# if (key)
|
217
|
-
# UI.messagebox key
|
218
|
-
# else
|
219
|
-
# UI.messagebox "Failure"
|
220
|
-
# end
|
221
208
|
#
|
222
209
|
# @return keys - an array of keys within the options provider if
|
223
210
|
# successful
|
@@ -0,0 +1,490 @@
|
|
1
|
+
# Copyright:: Copyright 2024 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# An Overlay provides contextual model information directly in the viewport.
|
5
|
+
# This can be presented in 2D and 3D.
|
6
|
+
#
|
7
|
+
# Examples can be annotations or analytical model information such as geometry
|
8
|
+
# analysis, energy analysis, etc.
|
9
|
+
#
|
10
|
+
# The overlay feature is not intended as a mechanism to provide custom entities
|
11
|
+
# to SketchUp. Whatever overlays draw is not pickable nor exportable.
|
12
|
+
#
|
13
|
+
# It is also not allowed to perform model changes from overlay events. Doing
|
14
|
+
# so will result in a +RuntimeError+ being thrown.
|
15
|
+
#
|
16
|
+
# @api Overlays
|
17
|
+
#
|
18
|
+
# @example
|
19
|
+
# class ExampleOverlay < Sketchup::Overlay
|
20
|
+
#
|
21
|
+
# def initialize
|
22
|
+
# super('example_inc.my_overlay', 'Example Overlay')
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
# def draw(view)
|
26
|
+
# rectangle = [
|
27
|
+
# [100, 100, 0], [300, 100, 0], [300, 200, 0], [100, 200, 0]
|
28
|
+
# ]
|
29
|
+
# view.drawing_color = 'blue'
|
30
|
+
# view.draw2d(GL_QUADS, rectangle)
|
31
|
+
# point = Geom::Point3d.new(120, 120, 0)
|
32
|
+
# view.draw_text(point, "Hello Overlay", size: 20, bold: true, color: 'white')
|
33
|
+
# end
|
34
|
+
#
|
35
|
+
# end
|
36
|
+
#
|
37
|
+
# # Using an observer to create a new overlay per model.
|
38
|
+
# class ExampleAppObserver < Sketchup::AppObserver
|
39
|
+
#
|
40
|
+
# def expectsStartupModelNotifications
|
41
|
+
# true
|
42
|
+
# end
|
43
|
+
#
|
44
|
+
# def register_overlay(model)
|
45
|
+
# overlay = ExampleOverlay.new
|
46
|
+
# model.overlays.add(overlay)
|
47
|
+
# end
|
48
|
+
# alias_method :onNewModel, :register_overlay
|
49
|
+
# alias_method :onOpenModel, :register_overlay
|
50
|
+
#
|
51
|
+
# end
|
52
|
+
#
|
53
|
+
# observer = ExampleAppObserver.new
|
54
|
+
# Sketchup.add_observer(observer)
|
55
|
+
#
|
56
|
+
# # The following line is needed if you copy+paste in the Ruby Console or
|
57
|
+
# # at the moment the extension is installed:
|
58
|
+
# observer.register_overlay(Sketchup.active_model)
|
59
|
+
#
|
60
|
+
# @version SketchUp 2023.0
|
61
|
+
class Sketchup::Overlay
|
62
|
+
|
63
|
+
# Instance Methods
|
64
|
+
|
65
|
+
# This is a short user facing description of the overlay that will appear in the UI.
|
66
|
+
#
|
67
|
+
# @api Overlays
|
68
|
+
#
|
69
|
+
# @example
|
70
|
+
# Sketchup.active_model.overlays.each { |overlay|
|
71
|
+
# puts "#{overlay.name}: #{overlay.description}"
|
72
|
+
# }
|
73
|
+
#
|
74
|
+
# @return [String]
|
75
|
+
#
|
76
|
+
# @version SketchUp 2023.0
|
77
|
+
def description
|
78
|
+
end
|
79
|
+
|
80
|
+
# Sets a short user facing description of the overlay that will appear in the UI.
|
81
|
+
# Set this before adding to the {Sketchup::OverlaysManager}.
|
82
|
+
#
|
83
|
+
# @api Overlays
|
84
|
+
#
|
85
|
+
# @example
|
86
|
+
# Sketchup.active_model.overlays.each { |overlay|
|
87
|
+
# puts "#{overlay.name}: #{overlay.description}"
|
88
|
+
# }
|
89
|
+
#
|
90
|
+
# @return [String]
|
91
|
+
#
|
92
|
+
# @version SketchUp 2023.0
|
93
|
+
def description=(description)
|
94
|
+
end
|
95
|
+
|
96
|
+
#
|
97
|
+
# @abstract It is called whenever the view updates.
|
98
|
+
#
|
99
|
+
# @api Overlays
|
100
|
+
#
|
101
|
+
# @example
|
102
|
+
# class ExampleOverlay < Sketchup::Overlay
|
103
|
+
#
|
104
|
+
# def initialize
|
105
|
+
# super('example_inc.my_overlay', 'Example Overlay')
|
106
|
+
# end
|
107
|
+
#
|
108
|
+
# def draw(view)
|
109
|
+
# # Draw a square.
|
110
|
+
# points = [
|
111
|
+
# Geom::Point3d.new(0, 0, 0),
|
112
|
+
# Geom::Point3d.new(9, 0, 0),
|
113
|
+
# Geom::Point3d.new(9, 9, 0),
|
114
|
+
# Geom::Point3d.new(0, 9, 0)
|
115
|
+
# ]
|
116
|
+
# # Fill
|
117
|
+
# view.drawing_color = Sketchup::Color.new(255, 128, 128)
|
118
|
+
# view.draw(GL_QUADS, points)
|
119
|
+
# # Outline
|
120
|
+
# view.line_stipple = '' # Solid line
|
121
|
+
# view.drawing_color = Sketchup::Color.new(64, 0, 0)
|
122
|
+
# view.draw(GL_LINE_LOOP, points)
|
123
|
+
# end
|
124
|
+
#
|
125
|
+
# end
|
126
|
+
#
|
127
|
+
# @note This is called very often. Perform minimal amount of computation in
|
128
|
+
# this event. Cache the data needed to draw what the overlay needs whenever
|
129
|
+
# possible.
|
130
|
+
#
|
131
|
+
# @note If you draw outside the model bounds you need to implement
|
132
|
+
# {Sketchup::Overlay#getExtents} which return a bounding box large enough to
|
133
|
+
# include the points you draw. Otherwise your drawing will be clipped.
|
134
|
+
#
|
135
|
+
# @param [Sketchup::View] view
|
136
|
+
# A View object where the method was invoked.
|
137
|
+
#
|
138
|
+
# @see getExtents
|
139
|
+
#
|
140
|
+
# @see Sketchup::View#draw
|
141
|
+
#
|
142
|
+
# @version SketchUp 2023.0
|
143
|
+
def draw(view)
|
144
|
+
end
|
145
|
+
|
146
|
+
#
|
147
|
+
# @api Overlays
|
148
|
+
#
|
149
|
+
# @note In most cases, extensions doesn't need to expose any new UI for
|
150
|
+
# enabling them. This can be done from the Overlays panel. However, in some
|
151
|
+
# cases the extension might have additional UI related to the overlays and
|
152
|
+
# might want to offer a way to toggle its overlays along with the rest of
|
153
|
+
# the UI.
|
154
|
+
#
|
155
|
+
# @param [Boolean] enabled
|
156
|
+
#
|
157
|
+
# @raise [RuntimeError] if the overlay is not added to a model.
|
158
|
+
#
|
159
|
+
# @version SketchUp 2023.0
|
160
|
+
def enabled=(enabled)
|
161
|
+
end
|
162
|
+
|
163
|
+
#
|
164
|
+
# @api Overlays
|
165
|
+
#
|
166
|
+
# @example
|
167
|
+
# Sketchup.active_model.overlays.each { |overlay|
|
168
|
+
# puts "#{overlay.name} (#{overlay.overlay_id}) Enabled: #{overlay.enabled?}"
|
169
|
+
# }
|
170
|
+
#
|
171
|
+
# @return [Boolean]
|
172
|
+
#
|
173
|
+
# @version SketchUp 2023.0
|
174
|
+
def enabled?
|
175
|
+
end
|
176
|
+
|
177
|
+
# In order to accurately draw things, SketchUp needs to know the extents of
|
178
|
+
# what it is drawing. If the overlay is doing its own drawing, it may need to
|
179
|
+
# implement this method to tell SketchUp the extents of what it will be
|
180
|
+
# drawing. If you don't implement this method, you may find that part of what
|
181
|
+
# the overlay is drawing gets clipped to the extents of the rest of the
|
182
|
+
# model.
|
183
|
+
#
|
184
|
+
# This must return a {Geom::BoundingBox}. In a typical implementation, you
|
185
|
+
# will create a new {Geom::BoundingBox}, add points to set the extents of the
|
186
|
+
# drawing that the overlay will do and then return it.
|
187
|
+
#
|
188
|
+
# @abstract The method should be implementing sub-classes ensure what is drawn
|
189
|
+
# in 3D space doesn't appear clipped. If the overlay only draws in 2D this
|
190
|
+
# isn't needed.
|
191
|
+
#
|
192
|
+
# @api Overlays
|
193
|
+
#
|
194
|
+
# @example
|
195
|
+
# class ExampleOverlay < Sketchup::Overlay
|
196
|
+
#
|
197
|
+
# def initialize
|
198
|
+
# super('example_inc.my_overlay', 'Example Overlay')
|
199
|
+
# @points = [ [0, 0, 0], [9, 0, 0], [9, 9, 0], [0, 9, 0] ]
|
200
|
+
# end
|
201
|
+
#
|
202
|
+
# def getExtents
|
203
|
+
# bb = Sketchup.active_model.bounds
|
204
|
+
# bb.add(@points)
|
205
|
+
# return bb
|
206
|
+
# end
|
207
|
+
#
|
208
|
+
# def draw(view)
|
209
|
+
# view.draw(GL_QUADS, @points)
|
210
|
+
# end
|
211
|
+
#
|
212
|
+
# end
|
213
|
+
#
|
214
|
+
# @note This is called very often. Perform minimal amount of computation in
|
215
|
+
# this event. Cache the data needed to compute the bounds of what the overlay
|
216
|
+
# draws whenever possible.
|
217
|
+
#
|
218
|
+
# @return [Geom::BoundingBox]
|
219
|
+
#
|
220
|
+
# @version SketchUp 2023.0
|
221
|
+
def getExtents
|
222
|
+
end
|
223
|
+
|
224
|
+
#
|
225
|
+
# @api Overlays
|
226
|
+
#
|
227
|
+
# @example
|
228
|
+
# class ExampleOverlay < Sketchup::Overlay
|
229
|
+
#
|
230
|
+
# def initialize
|
231
|
+
# description = "A short sentence describing the overlay."
|
232
|
+
# super('example_inc.my_overlay', 'Example Overlay', description: description)
|
233
|
+
# end
|
234
|
+
#
|
235
|
+
# end
|
236
|
+
#
|
237
|
+
# overlay = ExampleOverlay.new
|
238
|
+
#
|
239
|
+
# @param [String] id
|
240
|
+
# The string should be unique per overlay subclass.
|
241
|
+
# A good pattern would be something like: +"company_name.extension_name.overlay_name"+.
|
242
|
+
#
|
243
|
+
# @param [String] name
|
244
|
+
# This is a user facing display name that will appear in the UI.
|
245
|
+
# Make it short and representative for what the overlay does.
|
246
|
+
#
|
247
|
+
# @param [String] description
|
248
|
+
# This is a user facing description that will appear in the UI.
|
249
|
+
# Make it short and representative for what the overlay does.
|
250
|
+
#
|
251
|
+
# @raise [ArgumentError] if +id+ or +name+ is an empty string
|
252
|
+
#
|
253
|
+
# @version SketchUp 2023.0
|
254
|
+
def initialize(id, name, description: "")
|
255
|
+
end
|
256
|
+
|
257
|
+
# This is a user facing display name that will appear in the UI.
|
258
|
+
#
|
259
|
+
# @api Overlays
|
260
|
+
#
|
261
|
+
# @example
|
262
|
+
# Sketchup.active_model.overlays.each { |overlay|
|
263
|
+
# puts "#{overlay.name} (#{overlay.overlay_id}) Enabled: #{overlay.enabled?}"
|
264
|
+
# }
|
265
|
+
#
|
266
|
+
# @return [String]
|
267
|
+
#
|
268
|
+
# @version SketchUp 2023.0
|
269
|
+
def name
|
270
|
+
end
|
271
|
+
|
272
|
+
# The {#onMouseEnter} method is called by SketchUp when the mouse enters the
|
273
|
+
# viewport.
|
274
|
+
#
|
275
|
+
# @abstract It can be used by implementing sub-classes to react to
|
276
|
+
# mouse movement in the viewport.
|
277
|
+
#
|
278
|
+
# @api Overlays
|
279
|
+
#
|
280
|
+
# @example
|
281
|
+
# class ExampleOverlay < Sketchup::Overlay
|
282
|
+
#
|
283
|
+
# def initialize
|
284
|
+
# super('example_inc.my_overlay', 'Example Overlay')
|
285
|
+
# end
|
286
|
+
#
|
287
|
+
# def onMouseEnter(flags, x, y, view)
|
288
|
+
# puts "onMouseEnter: flags = #{flags}"
|
289
|
+
# puts " x = #{x}"
|
290
|
+
# puts " y = #{y}"
|
291
|
+
# puts " view = #{view}"
|
292
|
+
# end
|
293
|
+
#
|
294
|
+
# end
|
295
|
+
#
|
296
|
+
# @param [Integer] flags
|
297
|
+
# A bit mask that tells the state of the modifier
|
298
|
+
# keys and other mouse buttons at the time.
|
299
|
+
#
|
300
|
+
# @param [Integer] x
|
301
|
+
# The X coordinate on the screen where the event occurred.
|
302
|
+
#
|
303
|
+
# @param [Integer] y
|
304
|
+
# The Y coordinate on the screen where the event occurred.
|
305
|
+
#
|
306
|
+
# @param [Sketchup::View] view
|
307
|
+
#
|
308
|
+
# @version SketchUp 2023.0
|
309
|
+
def onMouseEnter(flags, x, y, view)
|
310
|
+
end
|
311
|
+
|
312
|
+
# The {#onMouseLeave} method is called by SketchUp when the mouse enters the
|
313
|
+
# viewport.
|
314
|
+
#
|
315
|
+
# @abstract It can be used by implementing sub-classes to react to
|
316
|
+
# mouse movement in the viewport.
|
317
|
+
#
|
318
|
+
# @api Overlays
|
319
|
+
#
|
320
|
+
# @example
|
321
|
+
# class ExampleOverlay < Sketchup::Overlay
|
322
|
+
#
|
323
|
+
# def initialize
|
324
|
+
# super('example_inc.my_overlay', 'Example Overlay')
|
325
|
+
# end
|
326
|
+
#
|
327
|
+
# def onMouseLeave(view)
|
328
|
+
# puts "onMouseLeave"
|
329
|
+
# end
|
330
|
+
#
|
331
|
+
# end
|
332
|
+
#
|
333
|
+
# @param [Sketchup::View] view
|
334
|
+
#
|
335
|
+
# @version SketchUp 2023.0
|
336
|
+
def onMouseLeave(view)
|
337
|
+
end
|
338
|
+
|
339
|
+
# Try to make this method as efficient as possible because this method is
|
340
|
+
# called often.
|
341
|
+
#
|
342
|
+
# @abstract It can be used by implementing sub-classes to react to
|
343
|
+
# mouse movement in the viewport.
|
344
|
+
#
|
345
|
+
# @api Overlays
|
346
|
+
#
|
347
|
+
# @example
|
348
|
+
# class ExampleOverlay < Sketchup::Overlay
|
349
|
+
#
|
350
|
+
# def initialize
|
351
|
+
# super('example_inc.my_overlay', 'Example Overlay')
|
352
|
+
# end
|
353
|
+
#
|
354
|
+
# def onMouseMove(flags, x, y, view)
|
355
|
+
# puts "onMouseMove: flags = #{flags}"
|
356
|
+
# puts " x = #{x}"
|
357
|
+
# puts " y = #{y}"
|
358
|
+
# puts " view = #{view}"
|
359
|
+
# end
|
360
|
+
#
|
361
|
+
# end
|
362
|
+
#
|
363
|
+
# @param [Integer] flags
|
364
|
+
# A bit mask that tells the state of the modifier
|
365
|
+
# keys and other mouse buttons at the time.
|
366
|
+
#
|
367
|
+
# @param [Integer] x
|
368
|
+
# The X coordinate on the screen where the event occurred.
|
369
|
+
#
|
370
|
+
# @param [Integer] y
|
371
|
+
# The Y coordinate on the screen where the event occurred.
|
372
|
+
#
|
373
|
+
# @param [Sketchup::View] view
|
374
|
+
#
|
375
|
+
# @version SketchUp 2023.0
|
376
|
+
def onMouseMove(flags, x, y, view)
|
377
|
+
end
|
378
|
+
|
379
|
+
#
|
380
|
+
# @api Overlays
|
381
|
+
#
|
382
|
+
# @example Implementing
|
383
|
+
# class ExampleOverlay < Sketchup::Overlay
|
384
|
+
#
|
385
|
+
# def initialize
|
386
|
+
# super('example_inc.my_overlay', 'Example Overlay')
|
387
|
+
# end
|
388
|
+
#
|
389
|
+
# end
|
390
|
+
#
|
391
|
+
# @example Accessing
|
392
|
+
# Sketchup.active_model.overlays.each { |overlay|
|
393
|
+
# puts "#{overlay.name} (#{overlay.overlay_id}) Enabled: #{overlay.enabled?}"
|
394
|
+
# }
|
395
|
+
#
|
396
|
+
# @return [String]
|
397
|
+
#
|
398
|
+
# @version SketchUp 2023.0
|
399
|
+
def overlay_id
|
400
|
+
end
|
401
|
+
|
402
|
+
# Describes the source associated with the overlay. This is automatically inferred
|
403
|
+
# when the overlay instance is initialized.
|
404
|
+
#
|
405
|
+
# @api Overlays
|
406
|
+
#
|
407
|
+
# @example
|
408
|
+
# Sketchup.active_model.overlays.each { |overlay|
|
409
|
+
# puts "#{overlay.name} (Extension: #{overlay.source})"
|
410
|
+
# }
|
411
|
+
#
|
412
|
+
# @return [String]
|
413
|
+
#
|
414
|
+
# @version SketchUp 2023.0
|
415
|
+
def source
|
416
|
+
end
|
417
|
+
|
418
|
+
#
|
419
|
+
# @abstract It can be used by implementing sub-classes to react when the overlay
|
420
|
+
# becomes active, for instance when the user turns it on.
|
421
|
+
#
|
422
|
+
# @api Overlays
|
423
|
+
#
|
424
|
+
# @example
|
425
|
+
# class ExampleOverlay < Sketchup::Overlay
|
426
|
+
#
|
427
|
+
# def initialize
|
428
|
+
# super('example_inc.my_overlay', 'Example Overlay')
|
429
|
+
# end
|
430
|
+
#
|
431
|
+
# def start
|
432
|
+
# puts "Overlay #{self} started"
|
433
|
+
# end
|
434
|
+
#
|
435
|
+
# end
|
436
|
+
#
|
437
|
+
# @version SketchUp 2023.0
|
438
|
+
def start
|
439
|
+
end
|
440
|
+
|
441
|
+
#
|
442
|
+
# @abstract It can be used by implementing sub-classes to react when the overlay
|
443
|
+
# becomes inactive, for instance when the user turns it off.
|
444
|
+
#
|
445
|
+
# @api Overlays
|
446
|
+
#
|
447
|
+
# @example
|
448
|
+
# class ExampleOverlay < Sketchup::Overlay
|
449
|
+
#
|
450
|
+
# def initialize
|
451
|
+
# super('example_inc.my_overlay', 'Example Overlay')
|
452
|
+
# end
|
453
|
+
#
|
454
|
+
# def stop(view)
|
455
|
+
# puts "Overlay #{self} stopped"
|
456
|
+
# end
|
457
|
+
#
|
458
|
+
# end
|
459
|
+
#
|
460
|
+
# @version SketchUp 2023.0
|
461
|
+
def stop
|
462
|
+
end
|
463
|
+
|
464
|
+
# Indicates whether the overlay is valid. An overlay becomes invalid after
|
465
|
+
# being removed from the model and cannot be reused.
|
466
|
+
#
|
467
|
+
# @api Overlays
|
468
|
+
#
|
469
|
+
# @example
|
470
|
+
# class ExampleOverlay < Sketchup::Overlay
|
471
|
+
# def initialize
|
472
|
+
# super('example_inc.my_overlay', 'Example Overlay')
|
473
|
+
# end
|
474
|
+
# end
|
475
|
+
#
|
476
|
+
# overlay = ExampleOverlay.new
|
477
|
+
# p overlay.valid? # => true
|
478
|
+
# Sketchup.active_model.overlays.add(overlay)
|
479
|
+
# p overlay.valid? # => true
|
480
|
+
#
|
481
|
+
# Sketchup.active_model.overlays.remove(overlay)
|
482
|
+
# p overlay.valid? # => false
|
483
|
+
#
|
484
|
+
# @return [Boolean]
|
485
|
+
#
|
486
|
+
# @version SketchUp 2023.0
|
487
|
+
def valid?
|
488
|
+
end
|
489
|
+
|
490
|
+
end
|