sketchup-api-stubs 0.7.7 → 0.7.9
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 +151 -147
- data/lib/sketchup-api-stubs/stubs/{array.rb → 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 -509
- 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 -691
- data/lib/sketchup-api-stubs/stubs/{geom.rb → Geom.rb} +351 -351
- data/lib/sketchup-api-stubs/stubs/{languagehandler.rb → LanguageHandler.rb} +93 -92
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +595 -573
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +747 -411
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +183 -179
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +517 -515
- 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 -349
- 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 -694
- 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 → Length.rb} +278 -278
- data/lib/sketchup-api-stubs/stubs/{numeric.rb → 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 -157
- 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 -577
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +593 -594
- 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 -425
- 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 -1126
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +261 -0
- 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 -917
- 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 -405
- 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 -327
- 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 -1654
- 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 -478
- 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 -257
- 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 -835
- 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 -71
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1311 -1307
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +45 -45
- data/lib/sketchup-api-stubs/stubs/{sketchup.rb → Sketchup.rb} +1377 -1353
- data/lib/sketchup-api-stubs/stubs/{sketchupextension.rb → SketchupExtension.rb} +353 -353
- data/lib/sketchup-api-stubs/stubs/{string.rb → String.rb} +24 -24
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +389 -317
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +494 -478
- 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 -633
- data/lib/sketchup-api-stubs/stubs/{ui.rb → UI.rb} +683 -672
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +303 -311
- data/lib/sketchup-api-stubs.rb +1 -1
- metadata +20 -16
@@ -0,0 +1,490 @@
|
|
1
|
+
# Copyright:: Copyright 2023 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
|
@@ -0,0 +1,116 @@
|
|
1
|
+
# Copyright:: Copyright 2023 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# An overlay added to a model is invalidated once it's removed from the model.
|
5
|
+
# It cannot be re-added or added to another model. Create another unique
|
6
|
+
# instance for that.
|
7
|
+
#
|
8
|
+
# Contains the registered overlays for a model along with methods to manage
|
9
|
+
# them.
|
10
|
+
#
|
11
|
+
# A model can not have multiple overlays with the same id.
|
12
|
+
#
|
13
|
+
# @api Overlays
|
14
|
+
#
|
15
|
+
# @example
|
16
|
+
# Sketchup.active_model.overlays.each { |overlay|
|
17
|
+
# puts "#{overlay.name} (#{overlay.overlay_id}) Enabled: #{overlay.enabled?}"
|
18
|
+
# }
|
19
|
+
#
|
20
|
+
# @see Sketchup::Overlay
|
21
|
+
# Documentation for overlays for more details.
|
22
|
+
#
|
23
|
+
# @version SketchUp 2023.0
|
24
|
+
class Sketchup::OverlaysManager
|
25
|
+
|
26
|
+
# Includes
|
27
|
+
|
28
|
+
include Enumerable
|
29
|
+
|
30
|
+
# Instance Methods
|
31
|
+
|
32
|
+
#
|
33
|
+
# @api Overlays
|
34
|
+
#
|
35
|
+
# @example
|
36
|
+
# overlay = Sketchup.active_model.overlays[0]
|
37
|
+
#
|
38
|
+
# @return [Sketchup::Overlay]
|
39
|
+
#
|
40
|
+
# @version SketchUp 2023.0
|
41
|
+
def [](index)
|
42
|
+
end
|
43
|
+
alias_method :at, :[]
|
44
|
+
|
45
|
+
#
|
46
|
+
# @api Overlays
|
47
|
+
#
|
48
|
+
# @example
|
49
|
+
# class ExampleOverlay < Sketchup::Overlay
|
50
|
+
# def initialize
|
51
|
+
# super('example_inc.my_overlay', 'Example Overlay')
|
52
|
+
# end
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# overlay = ExampleOverlay.new
|
56
|
+
# Sketchup.active_model.overlays.add(overlay)
|
57
|
+
#
|
58
|
+
# @raise [ArgumentError] If the overlay is already added to a model.
|
59
|
+
#
|
60
|
+
# @return [Boolean] +false+ if an overlay with the same id already exists.
|
61
|
+
#
|
62
|
+
# @version SketchUp 2023.0
|
63
|
+
def add(service)
|
64
|
+
end
|
65
|
+
|
66
|
+
#
|
67
|
+
# @api Overlays
|
68
|
+
#
|
69
|
+
# @example
|
70
|
+
# Sketchup.active_model.overlays.each { |overlay|
|
71
|
+
# puts "#{overlay.name} (#{overlay.overlay_id}) Enabled: #{overlay.enabled?}"
|
72
|
+
# }
|
73
|
+
#
|
74
|
+
# @return [nil]
|
75
|
+
#
|
76
|
+
# @version SketchUp 2023.0
|
77
|
+
#
|
78
|
+
# @yieldparam [Sketchup::Overlay] overlay
|
79
|
+
def each
|
80
|
+
end
|
81
|
+
|
82
|
+
#
|
83
|
+
# @api Overlays
|
84
|
+
#
|
85
|
+
# @example
|
86
|
+
# class ExampleOverlay < Sketchup::Overlay
|
87
|
+
# def initialize
|
88
|
+
# super('example_inc.my_overlay', 'Example Overlay')
|
89
|
+
# end
|
90
|
+
# end
|
91
|
+
#
|
92
|
+
# overlay = ExampleOverlay.new
|
93
|
+
# Sketchup.active_model.overlays.add(overlay)
|
94
|
+
#
|
95
|
+
# Sketchup.active_model.overlays.remove(overlay)
|
96
|
+
#
|
97
|
+
# @return [Boolean]
|
98
|
+
#
|
99
|
+
# @version SketchUp 2023.0
|
100
|
+
def remove(service)
|
101
|
+
end
|
102
|
+
|
103
|
+
#
|
104
|
+
# @api Overlays
|
105
|
+
#
|
106
|
+
# @example
|
107
|
+
# num_overlays = Sketchup.active_model.overlays.size
|
108
|
+
#
|
109
|
+
# @return [Integer]
|
110
|
+
#
|
111
|
+
# @version SketchUp 2023.0
|
112
|
+
def size
|
113
|
+
end
|
114
|
+
alias_method :length, :size
|
115
|
+
|
116
|
+
end
|