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.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sketchup-api-stubs/sketchup.rb +151 -147
  3. data/lib/sketchup-api-stubs/stubs/{array.rb → Array.rb} +741 -741
  4. data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +322 -322
  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 +509 -509
  11. data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +476 -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 -351
  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 +747 -411
  20. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +183 -179
  21. data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
  22. data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +517 -515
  23. data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
  24. data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +148 -148
  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 -370
  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 -225
  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 -209
  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/ReferenceEntity.rb +82 -0
  43. data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +692 -694
  44. data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1519 -1519
  45. data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
  46. data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
  47. data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
  48. data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
  49. data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
  50. data/lib/sketchup-api-stubs/stubs/{length.rb → Length.rb} +278 -278
  51. data/lib/sketchup-api-stubs/stubs/{numeric.rb → Numeric.rb} +249 -249
  52. data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +144 -144
  53. data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +169 -157
  54. data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +209 -209
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +150 -152
  56. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +281 -286
  57. data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
  58. data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +302 -302
  59. data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +478 -478
  60. data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
  61. data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +121 -122
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +294 -294
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +659 -577
  64. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +593 -594
  65. data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
  66. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +257 -257
  67. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
  68. data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +201 -201
  69. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +449 -425
  70. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +74 -74
  71. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +104 -104
  72. data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +165 -165
  73. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +306 -306
  74. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +42 -42
  75. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
  76. data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +406 -396
  77. data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +397 -502
  78. data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
  79. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1239 -1126
  80. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +261 -0
  81. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -127
  82. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +545 -545
  83. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -60
  84. data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +125 -126
  85. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +937 -917
  86. data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +102 -104
  87. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +750 -750
  88. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +282 -292
  89. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +62 -62
  90. data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
  91. data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +468 -468
  92. data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +266 -266
  93. data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +189 -189
  94. data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +406 -405
  95. data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +84 -84
  96. data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +306 -306
  97. data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +326 -327
  98. data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +422 -422
  99. data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +427 -427
  100. data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +249 -249
  101. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
  102. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +48 -48
  103. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
  104. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +114 -112
  105. data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
  106. data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +414 -414
  107. data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +317 -318
  108. data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +142 -142
  109. data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +93 -93
  110. data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1652 -1654
  111. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +357 -357
  112. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +130 -131
  113. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +271 -284
  114. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
  115. data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +490 -0
  116. data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +116 -0
  117. data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +797 -797
  118. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +361 -363
  119. data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -77
  120. data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +478 -478
  121. data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
  122. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +361 -364
  123. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +45 -45
  124. data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
  125. data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +458 -459
  126. data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
  127. data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +212 -212
  128. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +255 -257
  129. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +59 -59
  130. data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -40
  131. data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +69 -69
  132. data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +217 -217
  133. data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +262 -262
  134. data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +217 -217
  135. data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
  136. data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +834 -835
  137. data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
  138. data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +156 -156
  139. data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +75 -71
  140. data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
  141. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1311 -1307
  142. data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +45 -45
  143. data/lib/sketchup-api-stubs/stubs/{sketchup.rb → Sketchup.rb} +1377 -1353
  144. data/lib/sketchup-api-stubs/stubs/{sketchupextension.rb → SketchupExtension.rb} +353 -353
  145. data/lib/sketchup-api-stubs/stubs/{string.rb → String.rb} +24 -24
  146. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +389 -317
  147. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +494 -478
  148. data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +269 -269
  149. data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +241 -240
  150. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +635 -633
  151. data/lib/sketchup-api-stubs/stubs/{ui.rb → UI.rb} +683 -672
  152. data/lib/sketchup-api-stubs/stubs/_top_level.rb +303 -311
  153. data/lib/sketchup-api-stubs.rb +1 -1
  154. metadata +20 -16
@@ -1,357 +1,357 @@
1
- # Copyright:: Copyright 2021 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
1
+ # Copyright:: Copyright 2023 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