sketchup-api-stubs 0.7.4 → 0.7.8

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.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sketchup-api-stubs/sketchup.rb +148 -145
  3. data/lib/sketchup-api-stubs/stubs/{array.rb → Array.rb} +741 -741
  4. data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +322 -318
  5. data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +172 -172
  6. data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +126 -126
  7. data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
  8. data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +400 -400
  9. data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +661 -661
  10. data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +523 -492
  11. data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +478 -478
  12. data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +263 -263
  13. data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +141 -141
  14. data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +522 -522
  15. data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +693 -691
  16. data/lib/sketchup-api-stubs/stubs/{geom.rb → Geom.rb} +351 -348
  17. data/lib/sketchup-api-stubs/stubs/{languagehandler.rb → LanguageHandler.rb} +93 -92
  18. data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +595 -573
  19. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +698 -411
  20. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +183 -174
  21. data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
  22. data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +516 -514
  23. data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
  24. data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +148 -143
  25. data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +353 -353
  26. data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +354 -349
  27. data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -311
  28. data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
  29. data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -91
  30. data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +370 -371
  31. data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +218 -218
  32. data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +128 -128
  33. data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +225 -220
  34. data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +567 -567
  35. data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +10 -10
  36. data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +11 -11
  37. data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +183 -183
  38. data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +387 -387
  39. data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +209 -204
  40. data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +344 -344
  41. data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +174 -174
  42. data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +692 -694
  43. data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1519 -1519
  44. data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
  45. data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
  46. data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
  47. data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
  48. data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
  49. data/lib/sketchup-api-stubs/stubs/{length.rb → Length.rb} +278 -278
  50. data/lib/sketchup-api-stubs/stubs/{numeric.rb → Numeric.rb} +249 -249
  51. data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +144 -140
  52. data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +169 -157
  53. data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +209 -209
  54. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +152 -152
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +286 -281
  56. data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
  57. data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +302 -328
  58. data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +478 -577
  59. data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
  60. data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +122 -122
  61. data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +294 -281
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +619 -562
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +593 -593
  64. data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
  65. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +257 -257
  66. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
  67. data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +201 -194
  68. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +426 -329
  69. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +74 -72
  70. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +104 -102
  71. data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +165 -165
  72. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +306 -312
  73. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +42 -38
  74. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
  75. data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +396 -390
  76. data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +502 -508
  77. data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
  78. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1205 -1119
  79. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +272 -0
  80. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -125
  81. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +545 -544
  82. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -59
  83. data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +126 -125
  84. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +937 -750
  85. data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +104 -104
  86. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +750 -697
  87. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +292 -285
  88. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +62 -62
  89. data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
  90. data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +468 -409
  91. data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +266 -226
  92. data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +189 -190
  93. data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +407 -393
  94. data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +84 -82
  95. data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +306 -303
  96. data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +326 -285
  97. data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +422 -0
  98. data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +427 -244
  99. data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +249 -136
  100. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
  101. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +48 -48
  102. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
  103. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +112 -112
  104. data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
  105. data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +414 -416
  106. data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +318 -311
  107. data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +142 -141
  108. data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +93 -95
  109. data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1651 -1638
  110. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +357 -356
  111. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +131 -132
  112. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +284 -284
  113. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
  114. data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +797 -770
  115. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +363 -353
  116. data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -76
  117. data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +477 -456
  118. data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
  119. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +364 -364
  120. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +45 -44
  121. data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
  122. data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +459 -454
  123. data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
  124. data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +212 -212
  125. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +260 -257
  126. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +59 -57
  127. data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -0
  128. data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +69 -69
  129. data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +217 -211
  130. data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +262 -262
  131. data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +217 -225
  132. data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
  133. data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +837 -829
  134. data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
  135. data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +156 -154
  136. data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +75 -61
  137. data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
  138. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1317 -1301
  139. data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +45 -43
  140. data/lib/sketchup-api-stubs/stubs/{sketchup.rb → Sketchup.rb} +1360 -1310
  141. data/lib/sketchup-api-stubs/stubs/{sketchupextension.rb → SketchupExtension.rb} +353 -353
  142. data/lib/sketchup-api-stubs/stubs/{string.rb → String.rb} +24 -24
  143. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +389 -310
  144. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +496 -356
  145. data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +269 -229
  146. data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +240 -240
  147. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +635 -633
  148. data/lib/sketchup-api-stubs/stubs/{ui.rb → UI.rb} +683 -667
  149. data/lib/sketchup-api-stubs/stubs/_top_level.rb +311 -311
  150. data/lib/sketchup-api-stubs.rb +1 -1
  151. metadata +15 -12
@@ -1,356 +1,357 @@
1
- # Copyright:: Copyright 2020 Trimble Inc.
2
- # License:: The MIT License (MIT)
3
-
4
- # This observer interface is implemented to react to model events. To
5
- # implement this observer, create a Ruby class of this type, override the
6
- # desired methods, and add an instance of the observer to the model.
7
- #
8
- # Note that the observers related to transactions (aka undoable operations)
9
- # are primarily for reporting and debugging. Performing any edit operations
10
- # of your own (such as modifying the model) inside the observer callback
11
- # should be avoided, as it could cause crashes or model corruption. The most
12
- # common use for these callbacks is to help debug problems where your
13
- # Ruby script's {Sketchup::Model#start_operation} and
14
- # {Sketchup::Model#commit_operation} calls are somehow conflicting with
15
- # SketchUp's native undo operations. You can set up an observer set to watch
16
- # precisely what is going on.
17
- #
18
- # @example
19
- # # This is an example of an observer that watches the
20
- # # component placement event.
21
- # class MyModelObserver < Sketchup::ModelObserver
22
- # def onPlaceComponent(instance)
23
- # puts "onPlaceComponent: #{instance}"
24
- # end
25
- # end
26
- #
27
- # # Attach the observer.
28
- # Sketchup.active_model.add_observer(MyModelObserver.new)
29
- #
30
- # @version SketchUp 6.0
31
- class Sketchup::ModelObserver
32
-
33
- # Instance Methods
34
-
35
- # The {#onActivePathChanged} method is invoked when the user opens or closes a
36
- # {Sketchup::ComponentInstance} or {Sketchup::Group} for editing.
37
- #
38
- # When the user opens an instance for editing the positions and transformations
39
- # of the entities in the opened instance will be relative to global world
40
- # coordinates instead of the local coordinates relative to their parent.
41
- #
42
- # See {Sketchup::Model#active_path} and {Sketchup::Model#edit_transform} for
43
- # methods that report the current edit origin vs. the global origin, etc.
44
- #
45
- # By using this observer callback, you can keep track of the various nested
46
- # transformations as your users double click to drill into and out of
47
- # component edits.
48
- #
49
- # @example
50
- # # As the user double clicks into component edits, show the "path" along
51
- # # the model hierarchy they have followed to get here.
52
- # def onActivePathChanged(model)
53
- # puts "onActivePathChanged: #{model}"
54
- # end
55
- #
56
- # @param [Sketchup::Model] model
57
- #
58
- # @return [nil]
59
- #
60
- # @see Sketchup::Model#active_path
61
- #
62
- # @see Sketchup::Model#edit_transform
63
- def onActivePathChanged(model)
64
- end
65
-
66
- # The {#onAfterComponentSaveAs} method is invoked when the user context-clicks >
67
- # Save As on a component instance. It is called just after the component is
68
- # written to disk, so you can restore the component to some state before
69
- # returning control to the user.
70
- #
71
- # @example
72
- # def onAfterComponentSaveAs(model)
73
- # puts "onAfterComponentSaveAs: #{model}"
74
- # end
75
- #
76
- # @param [Sketchup::Model] model
77
- #
78
- # @return [nil]
79
- #
80
- # @see #onBeforeComponentSaveAs
81
- #
82
- # @version SketchUp 7.0
83
- def onAfterComponentSaveAs(model)
84
- end
85
-
86
- # The {#onBeforeComponentSaveAs} method is invoked when the user
87
- # context-clicks > Save As on a component instance. It is called just before
88
- # the component is written to disk, so you can make changes within the handler
89
- # and it will make it into the save.
90
- #
91
- # For example, you may decide that you want to add some attribute to every
92
- # component that is saved out, but you do not want that attribute sticking
93
- # around inside the current model. Within {#onBeforeComponentSaveAs} you could
94
- # add the attribute, and within {#onAfterComponentSaveAs} you could delete that
95
- # attribute.
96
- #
97
- # The callback is not sent the component that is to be saved, but the
98
- # model's selection will contain it.
99
- #
100
- # @example
101
- # def onBeforeComponentSaveAs(model)
102
- # puts "onBeforeComponentSaveAs: #{model}"
103
- # end
104
- #
105
- # @param [Sketchup::Model] model
106
- #
107
- # @return [nil]
108
- #
109
- # @version SketchUp 7.0
110
- def onBeforeComponentSaveAs(model)
111
- end
112
-
113
- # The {#onDeleteModel} method is invoked when a model is deleted.
114
- #
115
- # @example
116
- # def onDeleteModel(model)
117
- # puts "onDeleteModel: #{model}"
118
- # end
119
- #
120
- # @param [Sketchup::Model] model
121
- #
122
- # @return [nil]
123
- #
124
- # @version SketchUp 6.0
125
- def onDeleteModel(model)
126
- end
127
-
128
- # The {#onEraseAll} method is invoked when everything in a model is erased.
129
- #
130
- # @example
131
- # def onEraseAll(model)
132
- # puts "onEraseAll: #{model}"
133
- # end
134
- #
135
- # @param [Sketchup::Model] model
136
- #
137
- # @return [nil]
138
- #
139
- # @version SketchUp 6.0
140
- def onEraseAll(model)
141
- end
142
-
143
- # The {#onExplode method} is invoked whenever a component anywhere in this
144
- # model is exploded. This is an easier way to watch explode events vs.
145
- # attaching an InstanceObserver to every instance in the model.
146
- #
147
- # Since the callback does not return what was exploded, one solution is to
148
- # place a selection observer that keeps track of which entities whose
149
- # explosion you are interested in are in the selection. Since SketchUp's
150
- # user interface only provides a means of exploding the selection, this
151
- # method is a reliable way to know what was just exploded.
152
- #
153
- # Another method would be to watch
154
- # {Sketchup::ComponentDefinition.count_instances} to determine what just
155
- # changed, as any components that were exploded will now be less an instance.
156
- #
157
- # @example
158
- # def onExplode(model)
159
- # puts "onExplode: #{model}"
160
- # end
161
- #
162
- # @param [Sketchup::Model] model
163
- #
164
- # @return [nil]
165
- #
166
- # @version SketchUp 7.0
167
- def onExplode(model)
168
- end
169
-
170
- # The {#onPidChanged} method is invoked when a persistent id in the model
171
- # changes. For example when entities are grouped.
172
- #
173
- # @example
174
- # def onPidChanged(model, old_pid, new_pid)
175
- # puts "onPidChanged: #{model}, #{old_pid} => #{new_pid}"
176
- # end
177
- #
178
- # @param [Sketchup::Model] model
179
- #
180
- # @param [Integer] old_pid
181
- #
182
- # @param [Integer] new_pid
183
- #
184
- # @return [nil]
185
- #
186
- # @version SketchUp 2017
187
- def onPidChanged(model, old_pid, new_pid)
188
- end
189
-
190
- # The {#onPlaceComponent} method is invoked when a component is "placed" into
191
- # the model, meaning it is dragged from the Component Browser.
192
- #
193
- # @example
194
- # def onPlaceComponent(model)
195
- # puts "onPlaceComponent: #{model}"
196
- # end
197
- #
198
- # @param [Sketchup::Model] model
199
- #
200
- # @return [nil]
201
- #
202
- # @version SketchUp 7.0
203
- def onPlaceComponent(model)
204
- end
205
-
206
- # The {#onPostSaveModel} method is invoked after a model has been saved to disk.
207
- #
208
- # @example
209
- # def onPostSaveModel(model)
210
- # puts "onPostSaveModel: #{model}"
211
- # end
212
- #
213
- # @param [Sketchup::Model] model
214
- #
215
- # @return [nil]
216
- #
217
- # @version SketchUp 8.0
218
- def onPostSaveModel(model)
219
- end
220
-
221
- # The {#onPreSaveModel} method is invoked before a model is saved to disk.
222
- #
223
- # @example
224
- # def onPreSaveModel(model)
225
- # puts "onPreSaveModel: #{model}"
226
- # end
227
- #
228
- # @param [Sketchup::Model] model
229
- #
230
- # @return [nil]
231
- #
232
- # @version SketchUp 8.0
233
- def onPreSaveModel(model)
234
- end
235
-
236
- # The {#onSaveModel} method is invoked after a model has been saved to disk.
237
- #
238
- # @example
239
- # def onSaveModel(model)
240
- # puts "onSaveModel: #{model}"
241
- # end
242
- #
243
- # @param [Sketchup::Model] model
244
- #
245
- # @return [nil]
246
- #
247
- # @version SketchUp 6.0
248
- def onSaveModel(model)
249
- end
250
-
251
- # The {#onTransactionAbort} method is invoked when a transaction is aborted.
252
- #
253
- # @example
254
- # def onTransactionAbort(model)
255
- # puts "onTransactionAbort: #{model}"
256
- # end
257
- #
258
- # @param [Sketchup::Model] model
259
- #
260
- # @return [nil]
261
- #
262
- # @see Sketchup::Model#abort_operation
263
- #
264
- # @version SketchUp 6.0
265
- def onTransactionAbort(model)
266
- end
267
-
268
- # The {#onTransactionCommit} method is invoked when a transaction is completed.
269
- #
270
- # @example
271
- # def onTransactionCommit(model)
272
- # puts "onTransactionCommit: #{model}"
273
- # end
274
- #
275
- # @param [Sketchup::Model] model
276
- #
277
- # @return [nil]
278
- #
279
- # @see Sketchup::Model#commit_operation
280
- #
281
- # @version SketchUp 6.0
282
- def onTransactionCommit(model)
283
- end
284
-
285
- # The {#onTransactionEmpty} method is invoked when a transaction
286
- # (aka an undoable operation) starts and then is committed without anything
287
- # being altered in between.
288
- #
289
- # @example
290
- # def onTransactionEmpty(model)
291
- # puts "onTransactionEmpty: #{model}"
292
- # end
293
- #
294
- # @param [Sketchup::Model] model
295
- #
296
- # @return [nil]
297
- #
298
- # @see Sketchup::Model#start_operation
299
- #
300
- # @version SketchUp 6.0
301
- def onTransactionEmpty(model)
302
- end
303
-
304
- # The {#onTransactionRedo} method is invoked when the user "redoes" a
305
- # transaction (aka undo operation.) You can programmatically fire a redo by
306
- # calling +Sketchup.sendAction("editRedo")+.
307
- #
308
- # @example
309
- # def onTransactionRedo(model)
310
- # puts "onTransactionRedo: #{model}"
311
- # end
312
- #
313
- # @param [Sketchup::Model] model
314
- #
315
- # @return [nil]
316
- #
317
- # @version SketchUp 6.0
318
- def onTransactionRedo(model)
319
- end
320
-
321
- # The {#onTransactionStart} method is invoked when a transaction
322
- # (aka an undoable operation) starts.
323
- #
324
- # @example
325
- # def onTransactionStart(model)
326
- # puts "onTransactionStart: #{model}"
327
- # end
328
- #
329
- # @param [Sketchup::Model] model
330
- #
331
- # @return [nil]
332
- #
333
- # @see Sketchup::Model#start_operation
334
- #
335
- # @version SketchUp 6.0
336
- def onTransactionStart(model)
337
- end
338
-
339
- # The {#onTransactionUndo method} is invoked when the user "undoes" a
340
- # transaction (aka undo operation.) You can programmatically fire an undo by
341
- # calling +Sketchup.sendAction("editUndo")+.
342
- #
343
- # @example
344
- # def onTransactionUndo(model)
345
- # puts "onTransactionUndo: #{model}"
346
- # end
347
- #
348
- # @param [Sketchup::Model] model
349
- #
350
- # @return [nil]
351
- #
352
- # @version SketchUp 6.0
353
- def onTransactionUndo(model)
354
- end
355
-
356
- end
1
+ # Copyright:: Copyright 2022 Trimble Inc.
2
+ # License:: The MIT License (MIT)
3
+
4
+ # This observer interface is implemented to react to model events.
5
+ #
6
+ # Note that the observers related to transactions (aka undoable operations)
7
+ # are primarily for reporting and debugging. Performing any edit operations
8
+ # of your own (such as modifying the model) inside the observer callback
9
+ # should be avoided, as it could cause crashes or model corruption. The most
10
+ # common use for these callbacks is to help debug problems where your
11
+ # Ruby script's {Sketchup::Model#start_operation} and
12
+ # {Sketchup::Model#commit_operation} calls are somehow conflicting with
13
+ # SketchUp's native undo operations. You can set up an observer set to watch
14
+ # precisely what is going on.
15
+ #
16
+ # @abstract To implement this observer, create a Ruby class of this type, override the
17
+ # desired methods, and add an instance of the observer to the model.
18
+ #
19
+ # @example
20
+ # # This is an example of an observer that watches the
21
+ # # component placement event.
22
+ # class MyModelObserver < Sketchup::ModelObserver
23
+ # def onPlaceComponent(instance)
24
+ # puts "onPlaceComponent: #{instance}"
25
+ # end
26
+ # end
27
+ #
28
+ # # Attach the observer.
29
+ # Sketchup.active_model.add_observer(MyModelObserver.new)
30
+ #
31
+ # @version SketchUp 6.0
32
+ class Sketchup::ModelObserver
33
+
34
+ # Instance Methods
35
+
36
+ # The {#onActivePathChanged} method is invoked when the user opens or closes a
37
+ # {Sketchup::ComponentInstance} or {Sketchup::Group} for editing.
38
+ #
39
+ # When the user opens an instance for editing the positions and transformations
40
+ # of the entities in the opened instance will be relative to global world
41
+ # coordinates instead of the local coordinates relative to their parent.
42
+ #
43
+ # See {Sketchup::Model#active_path} and {Sketchup::Model#edit_transform} for
44
+ # methods that report the current edit origin vs. the global origin, etc.
45
+ #
46
+ # By using this observer callback, you can keep track of the various nested
47
+ # transformations as your users double click to drill into and out of
48
+ # component edits.
49
+ #
50
+ # @example
51
+ # # As the user double clicks into component edits, show the "path" along
52
+ # # the model hierarchy they have followed to get here.
53
+ # def onActivePathChanged(model)
54
+ # puts "onActivePathChanged: #{model}"
55
+ # end
56
+ #
57
+ # @param [Sketchup::Model] model
58
+ #
59
+ # @return [nil]
60
+ #
61
+ # @see Sketchup::Model#active_path
62
+ #
63
+ # @see Sketchup::Model#edit_transform
64
+ def onActivePathChanged(model)
65
+ end
66
+
67
+ # The {#onAfterComponentSaveAs} method is invoked when the user context-clicks >
68
+ # Save As on a component instance. It is called just after the component is
69
+ # written to disk, so you can restore the component to some state before
70
+ # returning control to the user.
71
+ #
72
+ # @example
73
+ # def onAfterComponentSaveAs(model)
74
+ # puts "onAfterComponentSaveAs: #{model}"
75
+ # end
76
+ #
77
+ # @param [Sketchup::Model] model
78
+ #
79
+ # @return [nil]
80
+ #
81
+ # @see #onBeforeComponentSaveAs
82
+ #
83
+ # @version SketchUp 7.0
84
+ def onAfterComponentSaveAs(model)
85
+ end
86
+
87
+ # The {#onBeforeComponentSaveAs} method is invoked when the user
88
+ # context-clicks > Save As on a component instance. It is called just before
89
+ # the component is written to disk, so you can make changes within the handler
90
+ # and it will make it into the save.
91
+ #
92
+ # For example, you may decide that you want to add some attribute to every
93
+ # component that is saved out, but you do not want that attribute sticking
94
+ # around inside the current model. Within {#onBeforeComponentSaveAs} you could
95
+ # add the attribute, and within {#onAfterComponentSaveAs} you could delete that
96
+ # attribute.
97
+ #
98
+ # The callback is not sent the component that is to be saved, but the
99
+ # model's selection will contain it.
100
+ #
101
+ # @example
102
+ # def onBeforeComponentSaveAs(model)
103
+ # puts "onBeforeComponentSaveAs: #{model}"
104
+ # end
105
+ #
106
+ # @param [Sketchup::Model] model
107
+ #
108
+ # @return [nil]
109
+ #
110
+ # @version SketchUp 7.0
111
+ def onBeforeComponentSaveAs(model)
112
+ end
113
+
114
+ # The {#onDeleteModel} method is invoked when a model is deleted.
115
+ #
116
+ # @example
117
+ # def onDeleteModel(model)
118
+ # puts "onDeleteModel: #{model}"
119
+ # end
120
+ #
121
+ # @param [Sketchup::Model] model
122
+ #
123
+ # @return [nil]
124
+ #
125
+ # @version SketchUp 6.0
126
+ def onDeleteModel(model)
127
+ end
128
+
129
+ # The {#onEraseAll} method is invoked when everything in a model is erased.
130
+ #
131
+ # @example
132
+ # def onEraseAll(model)
133
+ # puts "onEraseAll: #{model}"
134
+ # end
135
+ #
136
+ # @param [Sketchup::Model] model
137
+ #
138
+ # @return [nil]
139
+ #
140
+ # @version SketchUp 6.0
141
+ def onEraseAll(model)
142
+ end
143
+
144
+ # The {#onExplode method} is invoked whenever a component anywhere in this
145
+ # model is exploded. This is an easier way to watch explode events vs.
146
+ # attaching an InstanceObserver to every instance in the model.
147
+ #
148
+ # Since the callback does not return what was exploded, one solution is to
149
+ # place a selection observer that keeps track of which entities whose
150
+ # explosion you are interested in are in the selection. Since SketchUp's
151
+ # user interface only provides a means of exploding the selection, this
152
+ # method is a reliable way to know what was just exploded.
153
+ #
154
+ # Another method would be to watch
155
+ # {Sketchup::ComponentDefinition.count_instances} to determine what just
156
+ # changed, as any components that were exploded will now be less an instance.
157
+ #
158
+ # @example
159
+ # def onExplode(model)
160
+ # puts "onExplode: #{model}"
161
+ # end
162
+ #
163
+ # @param [Sketchup::Model] model
164
+ #
165
+ # @return [nil]
166
+ #
167
+ # @version SketchUp 7.0
168
+ def onExplode(model)
169
+ end
170
+
171
+ # The {#onPidChanged} method is invoked when a persistent id in the model
172
+ # changes. For example when entities are grouped.
173
+ #
174
+ # @example
175
+ # def onPidChanged(model, old_pid, new_pid)
176
+ # puts "onPidChanged: #{model}, #{old_pid} => #{new_pid}"
177
+ # end
178
+ #
179
+ # @param [Sketchup::Model] model
180
+ #
181
+ # @param [Integer] old_pid
182
+ #
183
+ # @param [Integer] new_pid
184
+ #
185
+ # @return [nil]
186
+ #
187
+ # @version SketchUp 2017
188
+ def onPidChanged(model, old_pid, new_pid)
189
+ end
190
+
191
+ # The {#onPlaceComponent} method is invoked when a component is "placed" into
192
+ # the model, meaning it is dragged from the Component Browser.
193
+ #
194
+ # @example
195
+ # def onPlaceComponent(model)
196
+ # puts "onPlaceComponent: #{model}"
197
+ # end
198
+ #
199
+ # @param [Sketchup::Model] model
200
+ #
201
+ # @return [nil]
202
+ #
203
+ # @version SketchUp 7.0
204
+ def onPlaceComponent(model)
205
+ end
206
+
207
+ # The {#onPostSaveModel} method is invoked after a model has been saved to disk.
208
+ #
209
+ # @example
210
+ # def onPostSaveModel(model)
211
+ # puts "onPostSaveModel: #{model}"
212
+ # end
213
+ #
214
+ # @param [Sketchup::Model] model
215
+ #
216
+ # @return [nil]
217
+ #
218
+ # @version SketchUp 8.0
219
+ def onPostSaveModel(model)
220
+ end
221
+
222
+ # The {#onPreSaveModel} method is invoked before a model is saved to disk.
223
+ #
224
+ # @example
225
+ # def onPreSaveModel(model)
226
+ # puts "onPreSaveModel: #{model}"
227
+ # end
228
+ #
229
+ # @param [Sketchup::Model] model
230
+ #
231
+ # @return [nil]
232
+ #
233
+ # @version SketchUp 8.0
234
+ def onPreSaveModel(model)
235
+ end
236
+
237
+ # The {#onSaveModel} method is invoked after a model has been saved to disk.
238
+ #
239
+ # @example
240
+ # def onSaveModel(model)
241
+ # puts "onSaveModel: #{model}"
242
+ # end
243
+ #
244
+ # @param [Sketchup::Model] model
245
+ #
246
+ # @return [nil]
247
+ #
248
+ # @version SketchUp 6.0
249
+ def onSaveModel(model)
250
+ end
251
+
252
+ # The {#onTransactionAbort} method is invoked when a transaction is aborted.
253
+ #
254
+ # @example
255
+ # def onTransactionAbort(model)
256
+ # puts "onTransactionAbort: #{model}"
257
+ # end
258
+ #
259
+ # @param [Sketchup::Model] model
260
+ #
261
+ # @return [nil]
262
+ #
263
+ # @see Sketchup::Model#abort_operation
264
+ #
265
+ # @version SketchUp 6.0
266
+ def onTransactionAbort(model)
267
+ end
268
+
269
+ # The {#onTransactionCommit} method is invoked when a transaction is completed.
270
+ #
271
+ # @example
272
+ # def onTransactionCommit(model)
273
+ # puts "onTransactionCommit: #{model}"
274
+ # end
275
+ #
276
+ # @param [Sketchup::Model] model
277
+ #
278
+ # @return [nil]
279
+ #
280
+ # @see Sketchup::Model#commit_operation
281
+ #
282
+ # @version SketchUp 6.0
283
+ def onTransactionCommit(model)
284
+ end
285
+
286
+ # The {#onTransactionEmpty} method is invoked when a transaction
287
+ # (aka an undoable operation) starts and then is committed without anything
288
+ # being altered in between.
289
+ #
290
+ # @example
291
+ # def onTransactionEmpty(model)
292
+ # puts "onTransactionEmpty: #{model}"
293
+ # end
294
+ #
295
+ # @param [Sketchup::Model] model
296
+ #
297
+ # @return [nil]
298
+ #
299
+ # @see Sketchup::Model#start_operation
300
+ #
301
+ # @version SketchUp 6.0
302
+ def onTransactionEmpty(model)
303
+ end
304
+
305
+ # The {#onTransactionRedo} method is invoked when the user "redoes" a
306
+ # transaction (aka undo operation.) You can programmatically fire a redo by
307
+ # calling +Sketchup.sendAction("editRedo")+.
308
+ #
309
+ # @example
310
+ # def onTransactionRedo(model)
311
+ # puts "onTransactionRedo: #{model}"
312
+ # end
313
+ #
314
+ # @param [Sketchup::Model] model
315
+ #
316
+ # @return [nil]
317
+ #
318
+ # @version SketchUp 6.0
319
+ def onTransactionRedo(model)
320
+ end
321
+
322
+ # The {#onTransactionStart} method is invoked when a transaction
323
+ # (aka an undoable operation) starts.
324
+ #
325
+ # @example
326
+ # def onTransactionStart(model)
327
+ # puts "onTransactionStart: #{model}"
328
+ # end
329
+ #
330
+ # @param [Sketchup::Model] model
331
+ #
332
+ # @return [nil]
333
+ #
334
+ # @see Sketchup::Model#start_operation
335
+ #
336
+ # @version SketchUp 6.0
337
+ def onTransactionStart(model)
338
+ end
339
+
340
+ # The {#onTransactionUndo method} is invoked when the user "undoes" a
341
+ # transaction (aka undo operation.) You can programmatically fire an undo by
342
+ # calling +Sketchup.sendAction("editUndo")+.
343
+ #
344
+ # @example
345
+ # def onTransactionUndo(model)
346
+ # puts "onTransactionUndo: #{model}"
347
+ # end
348
+ #
349
+ # @param [Sketchup::Model] model
350
+ #
351
+ # @return [nil]
352
+ #
353
+ # @version SketchUp 6.0
354
+ def onTransactionUndo(model)
355
+ end
356
+
357
+ end