sketchup-api-stubs 0.7.11 → 0.8.0

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 (71) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sketchup-api-stubs/sketchup.rb +6 -0
  3. data/lib/sketchup-api-stubs/stubs/Array.rb +4 -0
  4. data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +35 -11
  5. data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +1 -1
  6. data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +9 -5
  7. data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +5 -0
  8. data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +10 -0
  9. data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +5 -2
  10. data/lib/sketchup-api-stubs/stubs/Geom.rb +2 -0
  11. data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +4 -4
  12. data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +53 -51
  13. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +2 -1
  14. data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +1 -1
  15. data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +6 -8
  16. data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +50 -0
  17. data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +8 -10
  18. data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +1 -1
  19. data/lib/sketchup-api-stubs/stubs/Layout/ReferenceEntity.rb +8 -10
  20. data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +6 -9
  21. data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1 -1
  22. data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +17 -0
  23. data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +109 -21
  24. data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +17 -11
  25. data/lib/sketchup-api-stubs/stubs/Sketchup/CRSLocation.rb +402 -0
  26. data/lib/sketchup-api-stubs/stubs/Sketchup/CRSMapUnit.rb +83 -0
  27. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +220 -8
  28. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +85 -16
  29. data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +11 -9
  30. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +5 -1
  31. data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +6 -6
  32. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +19 -11
  33. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +8 -9
  34. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +181 -33
  35. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +0 -5
  36. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +8 -1
  37. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +0 -5
  38. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +14 -12
  39. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +100 -19
  40. data/lib/sketchup-api-stubs/stubs/Sketchup/HatchPattern.rb +277 -0
  41. data/lib/sketchup-api-stubs/stubs/Sketchup/HatchPatternData.rb +245 -0
  42. data/lib/sketchup-api-stubs/stubs/Sketchup/HatchPatterns.rb +155 -0
  43. data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +2 -2
  44. data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +144 -0
  45. data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +6 -0
  46. data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +13 -1
  47. data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +2 -4
  48. data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +66 -3
  49. data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +4 -4
  50. data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +112 -25
  51. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +130 -4
  52. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +0 -1
  53. data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +95 -83
  54. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +11 -11
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/Procedure.rb +452 -0
  56. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +29 -3
  57. data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +30 -0
  58. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +15 -13
  59. data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +16 -0
  60. data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +74 -0
  61. data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +49 -8
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +25 -12
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +78 -22
  64. data/lib/sketchup-api-stubs/stubs/Sketchup.rb +55 -4
  65. data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +73 -59
  66. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +119 -164
  67. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +50 -9
  68. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +4 -1
  69. data/lib/sketchup-api-stubs/stubs/UI.rb +15 -8
  70. data/lib/sketchup-api-stubs/stubs/_top_level.rb +8 -0
  71. metadata +9 -7
@@ -457,7 +457,8 @@ class Layout::AutoTextDefinition
457
457
  # @example
458
458
  # doc = Layout::Document.open("C:/path/to/document.layout")
459
459
  # page_number_def = doc.auto_text_definitions.add("RomanPageNumbers",
460
- # Layout::AutoTextDefinition::TYPE_PAGE_NUMBER) number_style = page_number_def.number_style
460
+ # Layout::AutoTextDefinition::TYPE_PAGE_NUMBER)
461
+ # number_style = page_number_def.number_style
461
462
  #
462
463
  # @raise [ArgumentError] if the {Layout::AutoTextDefinition}'s type is not
463
464
  # +Layout::AutoTextDefinition::TYPE_PAGE_NUMBER+,
@@ -568,7 +568,7 @@ class Layout::Document
568
568
  # @overload save
569
569
  #
570
570
  # @raise [ArgumentError] if the {Layout::Document} hasn't been saved with a
571
- # path yet
571
+ # path yet
572
572
  #
573
573
  # @overload save(path, version = Layout::Document::VERSION_CURRENT)
574
574
  #
@@ -37,11 +37,10 @@ class Layout::FormattedText < Layout::Entity
37
37
  # [+ANCHOR_TYPE_CENTER_CENTER+]
38
38
  # [+ANCHOR_TYPE_BOTTOM_CENTER+]
39
39
  #
40
- # Layout::FormattedText::ANCHOR_TYPE_TOP_LEFT)
41
- #
42
40
  # @example
43
41
  # anchor = Geom::Point2d.new(1, 1)
44
42
  # text = Layout::FormattedText.new("C:/Test.txt", anchor,
43
+ # Layout::FormattedText::ANCHOR_TYPE_TOP_LEFT)
45
44
  #
46
45
  # @overload new_from_file(path, bounds)
47
46
  #
@@ -132,12 +131,12 @@ class Layout::FormattedText < Layout::Entity
132
131
  # The {#display_text} method returns the display text representation of the
133
132
  # {Layout::FormattedText}.
134
133
  #
135
- # Layout::FormattedText::ANCHOR_TYPE_TOP_LEFT) doc.add_entity(text, doc.layers.first,
136
- # doc.pages.first) text = text.display_text(doc.pages.first)
137
- #
138
134
  # @example
139
135
  # anchor = Geom::Point2d.new(1, 1)
140
136
  # text = Layout::FormattedText.new("<PageNumber>", anchor,
137
+ # Layout::FormattedText::ANCHOR_TYPE_TOP_LEFT)
138
+ # doc.add_entity(text, doc.layers.first, doc.pages.first)
139
+ # text = text.display_text(doc.pages.first)
141
140
  #
142
141
  # @note Passing an invalid {Layout::Page} will prevent an auto-text tag from
143
142
  # being substituted with its display representation.
@@ -306,12 +305,11 @@ class Layout::FormattedText < Layout::Entity
306
305
  # The {#rtf=} method sets the raw RTF representation of the
307
306
  # {Layout::FormattedText}.
308
307
  #
309
- # text.\par}"
310
- #
311
308
  # @example
312
309
  # anchor = Geom::Point2d.new(1, 1)
313
310
  # text = Layout::FormattedText.new("Test", anchor, Layout::FormattedText::ANCHOR_TYPE_TOP_LEFT)
314
- # text.rtf = "{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard This is some {\b bold}
311
+ # text.rtf = "{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard " \
312
+ # "This is some {\b bold} text.\par}"
315
313
  #
316
314
  # @param [String] rtf_text
317
315
  #
@@ -19,6 +19,56 @@ class Layout::Group < Layout::Entity
19
19
 
20
20
  # Instance Methods
21
21
 
22
+ # The {#clip_mask} method returns the clip mask entity for the
23
+ # {Layout::Group}, or +nil+ if it does not have one.
24
+ #
25
+ # @example
26
+ # doc = Layout::Document.open("C:/path/to/document.layout")
27
+ # entities = doc.shared_entities
28
+ # entities.each { |entity|
29
+ # entity_array.push(entity)
30
+ # }
31
+ # group = Layout::Group.new(entity_array)
32
+ # clip_mask = group.clip_mask
33
+ #
34
+ # @return [Layout::Ellipse, Layout::Path, Layout::Rectangle, nil]
35
+ #
36
+ # @version LayOut 2026.2
37
+ def clip_mask
38
+ end
39
+
40
+ # The {#clip_mask=} method sets a clip mask for the {Layout::Group}.
41
+ # It must not currently exist in a {Layout::Document} or {Layout::Group}.
42
+ #
43
+ # @example
44
+ # doc = Layout::Document.open("C:/path/to/document.layout")
45
+ # entities = doc.shared_entities
46
+ # entities.each { |entity|
47
+ # entity_array.push(entity)
48
+ # }
49
+ # group = Layout::Group.new(entity_array)
50
+ # rect = Layout::Rectangle.new([[2, 2], [3, 3]]);
51
+ # model.clip_mask = rect
52
+ #
53
+ # @param [Layout::Ellipse, Layout::Path, Layout::Rectangle, nil] clip_mask
54
+ #
55
+ # @raise [ArgumentError] if clip_mask is already in a {Layout::Document} or
56
+ # {Layout::Group}
57
+ #
58
+ # @raise [ArgumentError] if clip_mask is not a {Layout::Rectangle},
59
+ # {Layout::Ellipse}, or {Layout::Path}
60
+ #
61
+ # @raise [ArgumentError] if clip_mask and group bounds do not overlap
62
+ #
63
+ # @raise [LockedLayerError] if the {Layout::Group} is on a locked
64
+ # {Layout::Layer}
65
+ #
66
+ # @raise [LockedEntityError] if the {Layout::Group} is locked
67
+ #
68
+ # @version LayOut 2026.2
69
+ def clip_mask=(clip_mask)
70
+ end
71
+
22
72
  # The {#entities} method returns the {Layout::Entities} that belong to the
23
73
  # {Layout::Group}.
24
74
  #
@@ -18,23 +18,21 @@ class Layout::Image < Layout::Entity
18
18
 
19
19
  # Instance Methods
20
20
 
21
- # The {#clip_mask} method returns the clip mask of the {Layout::Image}, or
22
- # +nil+ if it does not have a clip mask.
21
+ # The {#clip_mask} method returns the clip mask entity for the
22
+ # {Layout::Image}, or +nil+ if it does not have one.
23
23
  #
24
24
  # @example
25
25
  # image = Layout::Image.new("my_image.png", [[1, 1], [3, 3]])
26
26
  # clip_mask = image.clip_mask
27
27
  #
28
- # @return [Layout::Entity] The clip mask can be a {Layout::Path},
29
- # {Layout::Rectangle}, or {Layout::Ellipse}.
28
+ # @return [Layout::Ellipse, Layout::Path, Layout::Rectangle, nil]
30
29
  #
31
30
  # @version LayOut 2018
32
31
  def clip_mask
33
32
  end
34
33
 
35
- # The {#clip_mask=} method sets the clip mask of the {Layout::Image}. clip_mask
36
- # can be a {Layout::Rectangle}, {Layout::Ellipse}, or {Layout::Path}, or +nil+,
37
- # and it must not currently exist in a {Layout::Document}, or {Layout::Group}.
34
+ # The {#clip_mask=} method sets the clip mask of the {Layout::Image}.
35
+ # +clip_mask+ must not currently exist in a {Layout::Document} or {Layout::Group}.
38
36
  #
39
37
  # @example
40
38
  # image = Layout::Image.new("my_image.png", [[1, 1], [3, 3]])
@@ -46,9 +44,7 @@ class Layout::Image < Layout::Entity
46
44
  #
47
45
  # @note +clip_mask+ may be +nil+ as of LayOut 2020.1.
48
46
  #
49
- # @param [Layout::Entity, nil] clip_mask
50
- # The clip mask can be a {Layout::Path},
51
- # {Layout::Rectangle}, {Layout::Ellipse}, or +nil+.
47
+ # @param [Layout::Ellipse, Layout::Path, Layout::Rectangle, nil] clip_mask
52
48
  #
53
49
  # @raise [ArgumentError] if clip mask is already in a {Layout::Document} or
54
50
  # {Layout::Group}
@@ -56,6 +52,8 @@ class Layout::Image < Layout::Entity
56
52
  # @raise [ArgumentError] if clip mask is not a {Layout::Path},
57
53
  # {Layout::Rectangle}, or {Layout::Ellipse}
58
54
  #
55
+ # @raise [ArgumentError] if clip_mask and image bounds do not overlap
56
+ #
59
57
  # @raise [LockedLayerError] if the {Layout::Image} is on a locked {Layout::Layer}
60
58
  #
61
59
  # @raise [LockedEntityError] if the {Layout::Image} is locked
@@ -84,7 +84,7 @@ class Layout::Path < Layout::Entity
84
84
  # or +nil+ if path is not an arc.
85
85
  #
86
86
  # @example
87
- # start_angle, radius, start, end = path.arc
87
+ # center, radius, start_angle, end_angle = path.arc
88
88
  #
89
89
  # @return [Array(Geom::Point2d, Float, Float, Float), nil] The center point,
90
90
  # radius, start angle, and end angle
@@ -19,24 +19,22 @@ class Layout::ReferenceEntity < Layout::Entity
19
19
 
20
20
  # Instance Methods
21
21
 
22
- # The {#clip_mask} method returns the clip mask of the {Layout::ReferenceEntity}, or
23
- # +nil+ if it does not have a clip mask.
22
+ # The {#clip_mask} method returns the clip mask entity for the
23
+ # {Layout::ReferenceEntity}, or +nil+ if it does not have one.
24
24
  #
25
25
  # @example
26
26
  # doc = Layout::Document.open("C:/path/to/document.layout")
27
27
  # reference_entity = doc.pages.first.entities.first
28
28
  # clip_mask = image.clip_mask
29
29
  #
30
- # @return [Layout::Entity] The clip mask can be a {Layout::Path},
31
- # {Layout::Rectangle}, or {Layout::Ellipse}.
30
+ # @return [Layout::Ellipse, Layout::Path, Layout::Rectangle, nil]
32
31
  #
33
32
  # @version LayOut 2023.0
34
33
  def clip_mask
35
34
  end
36
35
 
37
- # The {#clip_mask=} method sets the clip mask of the {Layout::ReferenceEntity}. clip_mask
38
- # can be a {Layout::Rectangle}, {Layout::Ellipse}, or {Layout::Path}, or +nil+,
39
- # and it must not currently exist in a {Layout::Document}, or {Layout::Group}.
36
+ # The {#clip_mask=} method sets the clip mask of the {Layout::ReferenceEntity}.
37
+ # +clip_mask+ must not currently exist in a {Layout::Document} or {Layout::Group}.
40
38
  #
41
39
  # @example
42
40
  # doc = Layout::Document.open("C:/path/to/document.layout")
@@ -47,9 +45,7 @@ class Layout::ReferenceEntity < Layout::Entity
47
45
  # clip_mask = Layout::Rectangle.new(bounds)
48
46
  # reference_entity.clip_mask = clip_mask
49
47
  #
50
- # @param [Layout::Entity, nil] clip_mask
51
- # The clip mask can be a {Layout::Path},
52
- # {Layout::Rectangle}, {Layout::Ellipse}, or +nil+.
48
+ # @param [Layout::Ellipse, Layout::Path, Layout::Rectangle, nil] clip_mask
53
49
  #
54
50
  # @raise [ArgumentError] if clip mask is already in a {Layout::Document} or
55
51
  # {Layout::Group}
@@ -57,6 +53,8 @@ class Layout::ReferenceEntity < Layout::Entity
57
53
  # @raise [ArgumentError] if clip mask is not a {Layout::Path},
58
54
  # {Layout::Rectangle}, or {Layout::Ellipse}
59
55
  #
56
+ # @raise [ArgumentError] if clip_mask and reference entity bounds do not overlap
57
+ #
60
58
  # @raise [LockedLayerError] if the {Layout::ReferenceEntity} is on a locked {Layout::Layer}
61
59
  #
62
60
  # @raise [LockedEntityError] if the {Layout::ReferenceEntity} is locked
@@ -61,24 +61,21 @@ class Layout::SketchUpModel < Layout::Entity
61
61
  end
62
62
 
63
63
  # The {#clip_mask} method returns the clip mask entity for the
64
- # {Layout::SketchUpModel}, or +nil+ if it does not have one. clip_mask can be a
65
- # {Layout::Rectangle}, {Layout::Ellipse}, or {Layout::Path}.
64
+ # {Layout::SketchUpModel}, or +nil+ if it does not have one.
66
65
  #
67
66
  # @example
68
67
  # bounds = Geom::Bounds2d.new(1, 1, 3, 3)
69
68
  # model = Layout::SketchUpModel.new("C:/Path/to/model.skp", bounds)
70
69
  # clip_mask = model.clip_mask
71
70
  #
72
- # @return [Layout::Entity]
71
+ # @return [Layout::Ellipse, Layout::Path, Layout::Rectangle, nil]
73
72
  #
74
73
  # @version LayOut 2018
75
74
  def clip_mask
76
75
  end
77
76
 
78
77
  # The {#clip_mask=} method sets a clip mask for the {Layout::SketchUpModel}.
79
- # clip_mask can be a {Layout::Rectangle}, {Layout::Ellipse}, or {Layout::Path},
80
- # or +nil+, and it must not currently exist in a {Layout::Document},
81
- # or {Layout::Group}.
78
+ # +clip_mask+ must not currently exist in a {Layout::Document} or {Layout::Group}.
82
79
  #
83
80
  # @example
84
81
  # bounds = Geom::Bounds2d.new(1, 1, 3, 3)
@@ -88,9 +85,7 @@ class Layout::SketchUpModel < Layout::Entity
88
85
  #
89
86
  # @note +clip_mask+ may be +nil+ as of LayOut 2020.1.
90
87
  #
91
- # @param [Layout::Entity, nil] clip_mask
92
- # The clip mask can be a {Layout::Path},
93
- # {Layout::Rectangle}, {Layout::Ellipse}, or +nil+.
88
+ # @param [Layout::Ellipse, Layout::Path, Layout::Rectangle, nil] clip_mask
94
89
  #
95
90
  # @raise [ArgumentError] if clip_mask is already in a {Layout::Document} or
96
91
  # {Layout::Group}
@@ -98,6 +93,8 @@ class Layout::SketchUpModel < Layout::Entity
98
93
  # @raise [ArgumentError] if clip_mask is not a {Layout::Rectangle},
99
94
  # {Layout::Ellipse}, or {Layout::Path}
100
95
  #
96
+ # @raise [ArgumentError] if clip_mask and model bounds do not overlap
97
+ #
101
98
  # @raise [LockedLayerError] if the {Layout::SketchUpModel} is on a locked
102
99
  # {Layout::Layer}
103
100
  #
@@ -395,7 +395,7 @@ class Layout::Style
395
395
  def end_arrow_type=(arrow_type)
396
396
  end
397
397
 
398
- # The {#fill_color} method returns the solid file color, or +nil+ if the
398
+ # The {#fill_color} method returns the solid fill color, or +nil+ if the
399
399
  # {Layout::Style} does not have a value for that setting.
400
400
  #
401
401
  # @example
@@ -287,4 +287,21 @@ class Layout::Table < Layout::Entity
287
287
  def remove_row(index)
288
288
  end
289
289
 
290
+ # Resizes all rows and columns in the table to fit their text content.
291
+ #
292
+ # @example
293
+ # bounds = Geom::Bounds2d.new(1, 1, 4, 4)
294
+ # table = Layout::Table.new(bounds, 3, 3)
295
+ # table.size_to_fit
296
+ #
297
+ # @raise [Layout::LockedLayerError] if the table is on a locked layer
298
+ #
299
+ # @raise [Layout::LockedEntityError] if the table is locked
300
+ #
301
+ # @return [Layout::Table]
302
+ #
303
+ # @version LayOut 2027.0
304
+ def size_to_fit
305
+ end
306
+
290
307
  end
@@ -16,20 +16,42 @@
16
16
  # desired methods, and add an instance of the observer to the
17
17
  # application class.
18
18
  #
19
- # @example
20
- # # This is an example of an observer that watches the application for
21
- # # new models and shows a messagebox.
19
+ # @example Complete example with class definition and observer attachment
20
+ # # Define an observer class that watches for application-level events.
21
+ # # This is particularly useful for attaching model-specific observers
22
+ # # to ensure all open models are monitored.
22
23
  # class MyAppObserver < Sketchup::AppObserver
24
+ #
23
25
  # def onNewModel(model)
24
- # puts "onNewModel: #{model}"
26
+ # puts "New model created: #{model}"
27
+ # # Attach observers to the new model here
28
+ # # model.selection.add_observer(MySelectionObserver.new)
29
+ # end
25
30
  #
26
- # # Here is where one might attach other observers to the new model.
27
- # model.selection.add_observer(MySelectionObserver.new)
31
+ # def onOpenModel(model)
32
+ # puts "Model opened: #{model}"
33
+ # # Attach observers to the opened model here
34
+ # end
35
+ #
36
+ # def onActivateModel(model)
37
+ # puts "Model activated: #{model}"
38
+ # # Called when switching between models (Mac supports multiple documents)
39
+ # end
40
+ #
41
+ # def onQuit
42
+ # puts "SketchUp is quitting"
43
+ # # Save state or clean up before application exits
44
+ # end
45
+ #
46
+ # # Return true to receive onNewModel/onOpenModel for startup models
47
+ # def expectsStartupModelNotifications
48
+ # return true
28
49
  # end
29
50
  # end
30
51
  #
31
- # # Attach the observer
52
+ # # Create and attach the observer instance
32
53
  # Sketchup.add_observer(MyAppObserver.new)
54
+ # puts "AppObserver attached successfully"
33
55
  #
34
56
  # @version SketchUp 6.0
35
57
  class Sketchup::AppObserver
@@ -43,9 +65,19 @@ class Sketchup::AppObserver
43
65
  # auto-restored models on Mac OS X.
44
66
  #
45
67
  # @example
46
- # def expectsStartupModelNotifications
47
- # return true
68
+ # class MyStartupObserver < Sketchup::AppObserver
69
+ # def onNewModel(model)
70
+ # puts "New model: #{model}"
71
+ # end
72
+ # def onOpenModel(model)
73
+ # puts "Opened model: #{model}"
74
+ # end
75
+ # def expectsStartupModelNotifications
76
+ # true # Return true to receive startup notifications
77
+ # end
48
78
  # end
79
+ # Sketchup.add_observer(MyStartupObserver.new)
80
+ # # Restart SketchUp to see startup model notifications
49
81
  #
50
82
  # @note Prior to SketchUp 2014, {#onNewModel} and {#onOpenModel} were
51
83
  # not being called for the startup models. This issue is now fixed but
@@ -68,9 +100,13 @@ class Sketchup::AppObserver
68
100
  # simultaneously.
69
101
  #
70
102
  # @example
71
- # def onActivateModel(model)
72
- # puts "onActivateModel: #{model}"
103
+ # class MyActivateObserver < Sketchup::AppObserver
104
+ # def onActivateModel(model)
105
+ # puts "Model activated: #{model}"
106
+ # puts "Title: #{model.title}"
107
+ # end
73
108
  # end
109
+ # Sketchup.add_observer(MyActivateObserver.new)
74
110
  #
75
111
  # @param [Sketchup::Model] model
76
112
  # The newly-activated model object.
@@ -81,13 +117,43 @@ class Sketchup::AppObserver
81
117
  def onActivateModel(model)
82
118
  end
83
119
 
120
+ # The {#onCloseModel} method is called just before a model is closed, while
121
+ # the model is still valid. This is useful for cleaning up resources or
122
+ # saving state before the model becomes unavailable.
123
+ #
124
+ # @example
125
+ # class MyCloseObserver < Sketchup::AppObserver
126
+ # def onCloseModel(model)
127
+ # puts "Model closing: #{model}"
128
+ # puts "Title: #{model.title}"
129
+ # puts "Entities: #{model.entities.count}"
130
+ # # Model is still valid here - you can query its properties
131
+ # end
132
+ # end
133
+ # Sketchup.add_observer(MyCloseObserver.new)
134
+ # # Then close the model window
135
+ #
136
+ # @param [Sketchup::Model] model
137
+ # The model being closed.
138
+ #
139
+ # @return [nil]
140
+ #
141
+ # @version SketchUp 2027.0
142
+ def onCloseModel(model)
143
+ end
144
+
84
145
  # The {#onExtensionsLoaded} method is called when SketchUp has finished loading
85
146
  # all extensions when the application starts.
86
147
  #
87
148
  # @example
88
- # def onExtensionsLoaded
89
- # puts "onExtensionsLoaded"
149
+ # class MyExtensionsObserver < Sketchup::AppObserver
150
+ # def onExtensionsLoaded
151
+ # puts "All extensions have been loaded!"
152
+ # puts "Total extensions: #{Sketchup.extensions.count}"
153
+ # end
90
154
  # end
155
+ # Sketchup.add_observer(MyExtensionsObserver.new)
156
+ # # This already fired at startup. Restart SketchUp to see it again.
91
157
  #
92
158
  # @version SketchUp 2022.0
93
159
  def onExtensionsLoaded
@@ -97,9 +163,16 @@ class Sketchup::AppObserver
97
163
  # model.
98
164
  #
99
165
  # @example
100
- # def onNewModel(model)
101
- # puts "onNewModel: #{model}"
166
+ # class MyNewModelObserver < Sketchup::AppObserver
167
+ # def onNewModel(model)
168
+ # puts "New model created: #{model}"
169
+ # end
170
+ # def expectsStartupModelNotifications
171
+ # true # Receive notifications for startup models
172
+ # end
102
173
  # end
174
+ # Sketchup.add_observer(MyNewModelObserver.new)
175
+ # # Then create a new model: File > New
103
176
  #
104
177
  # @param [Sketchup::Model] model
105
178
  # The active model object.
@@ -114,9 +187,17 @@ class Sketchup::AppObserver
114
187
  # model.
115
188
  #
116
189
  # @example
117
- # def onOpenModel(model)
118
- # puts "onOpenModel: #{model}"
190
+ # class MyOpenModelObserver < Sketchup::AppObserver
191
+ # def onOpenModel(model)
192
+ # puts "Model opened: #{model}"
193
+ # puts "Path: #{model.path}"
194
+ # end
195
+ # def expectsStartupModelNotifications
196
+ # true # Receive notifications for startup models
197
+ # end
119
198
  # end
199
+ # Sketchup.add_observer(MyOpenModelObserver.new)
200
+ # # Then open a model: File > Open
120
201
  #
121
202
  # @note If a skp file is loaded via the command line or double-clicking on
122
203
  # a skp in explorer (which is also is the command line) then this
@@ -137,9 +218,12 @@ class Sketchup::AppObserver
137
218
  # need to clean up anything or store your application state upon close.
138
219
  #
139
220
  # @example
140
- # def onQuit()
141
- # puts "onQuit"
221
+ # class MyQuitObserver < Sketchup::AppObserver
222
+ # def onQuit
223
+ # puts "SketchUp is closing!"
224
+ # end
142
225
  # end
226
+ # Sketchup.add_observer(MyQuitObserver.new)
143
227
  #
144
228
  # @return [nil]
145
229
  #
@@ -153,9 +237,13 @@ class Sketchup::AppObserver
153
237
  # or cache your extension state.
154
238
  #
155
239
  # @example
156
- # def onUnloadExtension(extension_name)
157
- # puts "onUnloadExtension: #{extension_name}"
240
+ # class MyUnloadObserver < Sketchup::AppObserver
241
+ # def onUnloadExtension(extension_name)
242
+ # puts "Extension unloaded: #{extension_name}"
243
+ # end
158
244
  # end
245
+ # Sketchup.add_observer(MyUnloadObserver.new)
246
+ # # Then: Window > Extension Manager > Disable an extension
159
247
  #
160
248
  # @param [String] extension_name
161
249
  # The name of the extension just unloaded.
@@ -46,7 +46,7 @@ class Sketchup::ArcCurve < Sketchup::Curve
46
46
  # arccurve = edge.curve
47
47
  # point = arccurve.center
48
48
  #
49
- # @return point - a Point3d at the center of the arc if
49
+ # @return [Geom::Point3d] - a Point3d at the center of the arc if
50
50
  # successful
51
51
  #
52
52
  # @version SketchUp 6.0
@@ -70,8 +70,9 @@ class Sketchup::ArcCurve < Sketchup::Curve
70
70
  def circular?
71
71
  end
72
72
 
73
- # The {#end_angle} method is used to retrieve the angle of the end of the arc
74
- # measured from the X axis in radians.
73
+ # The {#end_angle} method is used to retrieve the angle (in radians) of the
74
+ # end of the arc, measured from the X axis of the coordinate system for this
75
+ # curve.
75
76
  #
76
77
  # @example
77
78
  # # Create a 1/2 circle, normal to the Z axis
@@ -89,6 +90,8 @@ class Sketchup::ArcCurve < Sketchup::Curve
89
90
  #
90
91
  # @return [Float]
91
92
  #
93
+ # @see #xaxis
94
+ #
92
95
  # @version SketchUp 6.0
93
96
  def end_angle
94
97
  end
@@ -108,7 +111,7 @@ class Sketchup::ArcCurve < Sketchup::Curve
108
111
  # arccurve = edge.curve
109
112
  # v = arccurve.normal
110
113
  #
111
- # @return vector - a Vector3d object if successful
114
+ # @return [Geom::Vector3d]
112
115
  #
113
116
  # @version SketchUp 6.0
114
117
  def normal
@@ -130,7 +133,7 @@ class Sketchup::ArcCurve < Sketchup::Curve
130
133
  # arccurve = edge.curve
131
134
  # plane = arccurve.plane
132
135
  #
133
- # @return plane - the plane of the arc if successful
136
+ # @return [Float, Float, Float, Float]
134
137
  #
135
138
  # @version SketchUp 6.0
136
139
  def plane
@@ -150,14 +153,15 @@ class Sketchup::ArcCurve < Sketchup::Curve
150
153
  # arccurve = edge.curve
151
154
  # radius = arccurve.radius
152
155
  #
153
- # @return radius - the radius of the arc if successful
156
+ # @return [Float]
154
157
  #
155
158
  # @version SketchUp 6.0
156
159
  def radius
157
160
  end
158
161
 
159
- # The start_angle method is used to retrieve the angle of the start of the
160
- # arc, measured from the X axis in radians.
162
+ # The {#start_angle} method is used to retrieve the angle (in radians) of the
163
+ # start of the arc, measured from the X axis of the coordinate system for this
164
+ # curve.
161
165
  #
162
166
  # @example
163
167
  # # Create a 1/4 circle, radius of 5, normal to the Z axis
@@ -173,7 +177,9 @@ class Sketchup::ArcCurve < Sketchup::Curve
173
177
  # arccurve = edge.curve
174
178
  # start_angle = arccurve.start_angle
175
179
  #
176
- # @return angle - the angle of the start of the arc if successful
180
+ # @return [Float] the angle of the start of the arc.
181
+ #
182
+ # @see #xaxis
177
183
  #
178
184
  # @version SketchUp 6.0
179
185
  def start_angle
@@ -195,7 +201,7 @@ class Sketchup::ArcCurve < Sketchup::Curve
195
201
  # arccurve = edge.curve
196
202
  # v = arccurve.xaxis
197
203
  #
198
- # @return vector - a Vector3d object if successful
204
+ # @return [Geom::Vector3d]
199
205
  #
200
206
  # @version SketchUp 6.0
201
207
  def xaxis
@@ -217,7 +223,7 @@ class Sketchup::ArcCurve < Sketchup::Curve
217
223
  # arccurve = edge.curve
218
224
  # v = arccurve.yaxis
219
225
  #
220
- # @return vector - a Vector3d object if successful
226
+ # @return [Geom::Vector3d]
221
227
  #
222
228
  # @version SketchUp 6.0
223
229
  def yaxis