sketchup-api-stubs 0.7.10 → 0.7.11

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 (159) 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 +1 -1
  4. data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +2 -2
  5. data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +25 -15
  6. data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +17 -32
  7. data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +1 -1
  8. data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +62 -39
  9. data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +136 -104
  10. data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +56 -30
  11. data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +76 -52
  12. data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +35 -31
  13. data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +8 -16
  14. data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +135 -110
  15. data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +207 -222
  16. data/lib/sketchup-api-stubs/stubs/Geom.rb +6 -6
  17. data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +1 -1
  18. data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +1 -1
  19. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +11 -7
  20. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +1 -1
  21. data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +1 -1
  22. data/lib/sketchup-api-stubs/stubs/Layout/Dictionary.rb +234 -0
  23. data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +124 -10
  24. data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +1 -1
  25. data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +1 -1
  26. data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +112 -4
  27. data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +1 -1
  28. data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +1 -1
  29. data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +4 -4
  30. data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +1 -1
  31. data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +1 -1
  32. data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +1 -1
  33. data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +1 -1
  34. data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +1 -1
  35. data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +56 -9
  36. data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +1 -1
  37. data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +1 -1
  38. data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +100 -1
  39. data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +13 -14
  40. data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +1 -1
  41. data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +5 -3
  42. data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +1 -1
  43. data/lib/sketchup-api-stubs/stubs/Layout/ReferenceEntity.rb +1 -1
  44. data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +1 -1
  45. data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +47 -1
  46. data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +1 -1
  47. data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +1 -1
  48. data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +1 -1
  49. data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +1 -1
  50. data/lib/sketchup-api-stubs/stubs/Layout.rb +1 -1
  51. data/lib/sketchup-api-stubs/stubs/Length.rb +9 -1
  52. data/lib/sketchup-api-stubs/stubs/Numeric.rb +1 -1
  53. data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +65 -13
  54. data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +1 -1
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +1 -1
  56. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +2 -7
  57. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +16 -3
  58. data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +13 -13
  59. data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +8 -14
  60. data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +10 -15
  61. data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +1 -1
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +2 -2
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +1 -1
  64. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +28 -14
  65. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +15 -8
  66. data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +1 -1
  67. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +7 -12
  68. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +1 -1
  69. data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +1 -1
  70. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +4 -10
  71. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +1 -1
  72. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +1 -1
  73. data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +17 -15
  74. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +17 -17
  75. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +1 -1
  76. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +3 -3
  77. data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +11 -14
  78. data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +2 -2
  79. data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +10 -10
  80. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +59 -19
  81. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +1 -1
  82. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +1 -1
  83. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +3 -3
  84. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +1 -1
  85. data/lib/sketchup-api-stubs/stubs/Sketchup/Environment.rb +406 -0
  86. data/lib/sketchup-api-stubs/stubs/Sketchup/Environments.rb +185 -0
  87. data/lib/sketchup-api-stubs/stubs/Sketchup/EnvironmentsObserver.rb +113 -0
  88. data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +3 -6
  89. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +94 -25
  90. data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +2 -2
  91. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +16 -26
  92. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +24 -17
  93. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +11 -9
  94. data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +1 -1
  95. data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +4 -67
  96. data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +2 -2
  97. data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +2 -2
  98. data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +34 -8
  99. data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +1 -1
  100. data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +4 -3
  101. data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +14 -8
  102. data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +3 -45
  103. data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +1 -19
  104. data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +1 -9
  105. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +1 -1
  106. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +10 -3
  107. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +1 -1
  108. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +1 -1
  109. data/lib/sketchup-api-stubs/stubs/Sketchup/LoadHandler.rb +70 -0
  110. data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +1 -1
  111. data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +831 -130
  112. data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +35 -22
  113. data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +1 -1
  114. data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +1 -1
  115. data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +146 -88
  116. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +20 -5
  117. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +14 -11
  118. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +1 -1
  119. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +1 -1
  120. data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +17 -44
  121. data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +1 -13
  122. data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +158 -16
  123. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +48 -21
  124. data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +1 -1
  125. data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +61 -40
  126. data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +1 -1
  127. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +13 -1
  128. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +1 -1
  129. data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +1 -1
  130. data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +84 -91
  131. data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +1 -1
  132. data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +1 -2
  133. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +9 -5
  134. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +1 -1
  135. data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +1 -1
  136. data/lib/sketchup-api-stubs/stubs/Sketchup/Snap.rb +125 -0
  137. data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +20 -1
  138. data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +59 -13
  139. data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +29 -8
  140. data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +13 -31
  141. data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +9 -9
  142. data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +229 -139
  143. data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +1 -1
  144. data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +1 -1
  145. data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +1 -1
  146. data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +23 -22
  147. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +336 -99
  148. data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +34 -8
  149. data/lib/sketchup-api-stubs/stubs/Sketchup.rb +71 -36
  150. data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +11 -11
  151. data/lib/sketchup-api-stubs/stubs/String.rb +1 -1
  152. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +21 -9
  153. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +80 -5
  154. data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +14 -3
  155. data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +20 -3
  156. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +9 -6
  157. data/lib/sketchup-api-stubs/stubs/UI.rb +77 -14
  158. data/lib/sketchup-api-stubs/stubs/_top_level.rb +7 -7
  159. metadata +10 -24
@@ -1,39 +1,65 @@
1
- # Copyright:: Copyright 2024 Trimble Inc.
1
+ # Copyright:: Copyright 2026 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
- # This observer interface is implemented to react to view events.
4
+ # This observer interface is implemented to react to {Sketchup::View} events.
5
5
  #
6
6
  # @abstract To implement this observer, create a Ruby class of this type,
7
7
  # override the desired methods, and add an instance of the observer to the
8
- # view object.
8
+ # {Sketchup::View} object.
9
9
  #
10
10
  # @example
11
- # # This is an example of an observer that watches tool interactions.
12
11
  # class MyViewObserver < Sketchup::ViewObserver
13
12
  # def onViewChanged(view)
14
13
  # puts "onViewChanged: #{view}"
15
14
  # end
16
15
  # end
17
16
  #
18
- # # Attach the observer.
19
17
  # Sketchup.active_model.active_view.add_observer(MyViewObserver.new)
20
18
  #
19
+ # @see Sketchup::View#add_observer
20
+ #
21
21
  # @version SketchUp 6.0
22
22
  class Sketchup::ViewObserver
23
23
 
24
24
  # Instance Methods
25
25
 
26
+ # The {#onScaleFactorChange} method is called whenever the view DPI of the view
27
+ # changes. This can be the SketchUp window being moved to another monitor with
28
+ # a different DPI or the user changing the DPI settings of the monitor.
29
+ #
30
+ # @example
31
+ # class MyViewObserver < Sketchup::ViewObserver
32
+ # def onScaleFactorChange(view)
33
+ # puts "onScaleFactorChange: #{view}"
34
+ # puts "UI.scale_factor(view): #{UI.scale_factor(view)}"
35
+ # end
36
+ # end
37
+ #
38
+ # Sketchup.active_model.active_view.add_observer(MyViewObserver.new)
39
+ #
40
+ # @param [Sketchup::View] view
41
+ #
42
+ # @return [nil]
43
+ #
44
+ # @version SketchUp 2025.0
45
+ def onScaleFactorChange(view)
46
+ end
47
+
26
48
  # The {#onViewChanged} method is called whenever the view is altered, such as
27
- # when the user uses the Pan, Orbit, or Zoom tools are used.
49
+ # when the user uses the Pan, Orbit, or Zoom tools.
28
50
  #
29
51
  # @bug Prior to SketchUp 2019.2 this event did not trigger when the viewport
30
52
  # size changed.
31
53
  #
32
54
  # @example
33
- # def onViewChanged(view)
34
- # puts "onViewChanged: #{view}"
55
+ # class MyViewObserver < Sketchup::ViewObserver
56
+ # def onViewChanged(view)
57
+ # puts "onViewChanged: #{view}"
58
+ # end
35
59
  # end
36
60
  #
61
+ # Sketchup.active_model.active_view.add_observer(MyViewObserver.new)
62
+ #
37
63
  # @param [Sketchup::View] view
38
64
  #
39
65
  # @return [nil]
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2024 Trimble Inc.
1
+ # Copyright:: Copyright 2026 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
  # The Sketchup module contains a number of important utility methods for use in
@@ -22,10 +22,10 @@
22
22
  # # Now that we have our handles, we can start pulling objects and making
23
23
  # # method calls that are useful.
24
24
  # first_entity = entities[0]
25
- # UI.messagebox("First thing in your model is a " + first_entity.typename)
25
+ # puts "First thing in your model is a #{first_entity.typename}"
26
26
  #
27
27
  # number_materials = materials.length
28
- # UI.messagebox("Your model has " + number_materials.to_s + " materials.")
28
+ # puts "Your model has #{number_materials} materials."
29
29
  #
30
30
  # new_edge = entities.add_line( [0,0,0], [500,500,0])
31
31
  #
@@ -43,7 +43,7 @@ module Sketchup
43
43
  # @example
44
44
  # model = Sketchup.active_model
45
45
  # if !model
46
- # UI.messagebox("Failure")
46
+ # puts "Failure"
47
47
  # else
48
48
  # # code acting on the model
49
49
  # end
@@ -221,12 +221,12 @@ module Sketchup
221
221
  # help_file = Sketchup.find_support_file("help.html", "Plugins/")
222
222
  # if help_file
223
223
  # # Print out the help_file full path
224
- # UI.messagebox(help_file)
224
+ # puts help_file
225
225
  #
226
226
  # # Open the help_file in a web browser
227
227
  # UI.openURL("file://" + help_file)
228
228
  # else
229
- # UI.messagebox("Failure")
229
+ # puts "Failure"
230
230
  # end
231
231
  #
232
232
  # @param [String] filename
@@ -388,7 +388,7 @@ module Sketchup
388
388
  #
389
389
  # @example
390
390
  # number = 3.m * 4.m * 5.m # This will result in 60m3 in inches.
391
- # formatted_volume = Sketchup.format_area(number)
391
+ # formatted_volume = Sketchup.format_volume(number)
392
392
  #
393
393
  # @param [Numeric] number
394
394
  # A number to be formatted.
@@ -514,9 +514,9 @@ module Sketchup
514
514
  # begin
515
515
  # Sketchup.install_from_archive(path)
516
516
  # rescue Interrupt => error
517
- # UI.messagebox("User said 'no': " + error)
517
+ # puts "User said 'no': #{error}"
518
518
  # rescue Exception => error
519
- # UI.messagebox("Error during unzip: " + error)
519
+ # puts "Error during unzip: #{error}"
520
520
  # end
521
521
  #
522
522
  # @param [String] filepath
@@ -577,7 +577,7 @@ module Sketchup
577
577
  #
578
578
  # @example
579
579
  # if Sketchup.is_pro?
580
- # UI.messagebox("You are running SU Pro.")
580
+ # puts "You are running SU Pro."
581
581
  # end
582
582
  #
583
583
  # @note In SketchUp Make this method will return +true+ during the Pro trial
@@ -604,13 +604,17 @@ module Sketchup
604
604
  def self.is_valid_filename?(filename)
605
605
  end
606
606
 
607
- # The load method is used to include encrypted and nonencrypted ruby files.
607
+ # The {.load} method is used to load Ruby files.
608
+ # Unlike Ruby's own +load+ method it also supports SketchUp's encrypted .rbe files.
608
609
  #
609
- # You do not need to include the file extension on the path. This method will
610
+ # You do not need to include the file extension in the path. This method will
610
611
  # look for .rb first (unencrypted) and then .rbe (encrypted) and finally .rbs
611
612
  # (the deprecated scrambled format) files.
612
613
  # See the "Distributing your Plugin" article for details.
613
614
  #
615
+ # @bug Unlike Ruby's +load+ method, this method currently can't load the same file twice.
616
+ # Instead works similar to Ruby's `require` method.
617
+ #
614
618
  # @example
615
619
  # sfile = "application_loader" # file extension not required
616
620
  # status = Sketchup.load(sfile)
@@ -655,6 +659,19 @@ module Sketchup
655
659
  # @return [Integer, false] status code if opening with +with_status+ set to +true+,
656
660
  # otherwise +true+ or +false+.
657
661
  #
662
+ # @overload open_file(filename, with_status: true, show_version_warning_dialog: true)
663
+ #
664
+ # Starting with SketchUp 2026.0 SketchUp we added control over displaying the
665
+ # messages about version compatibility.
666
+ #
667
+ # @version SketchUp 2026.0
668
+ # @param [String] filename The model file to open.
669
+ # @param [Boolean] with_status
670
+ # @param [Boolean] show_version_warning_dialog by default set to true and will display the dialog
671
+ # box
672
+ # @return [Integer, false] status code if opening with +with_status+ set to +true+,
673
+ # otherwise +true+ or +false+.
674
+ #
658
675
  # @version SketchUp 6.0
659
676
  def self.open_file(*args)
660
677
  end
@@ -768,13 +785,18 @@ module Sketchup
768
785
  def self.quit
769
786
  end
770
787
 
771
- # The read_default method is used to retrieve the string associated with a
788
+ # The {.read_default} method is used to retrieve the string associated with a
772
789
  # value within the specified sub-section section of a .INI file or registry
773
790
  # (within the Software > SketchUp > SketchUp [Version] section).
774
791
  #
775
792
  # @example
776
793
  # result = Sketchup.read_default("section", "variable", "default")
777
794
  #
795
+ # @note Be aware that the method is not capable of handling Length objects. You
796
+ # can convert the value to a Float before writing and convert back to Length when
797
+ # reading the value. Don't store the value as a String as this rounds the value and formats it
798
+ # in a way that can't be read if the system setting for decimal separator changes.
799
+ #
778
800
  # @param [String] section
779
801
  # A section in an .INI or registry.
780
802
  #
@@ -802,8 +824,8 @@ module Sketchup
802
824
  def self.redo
803
825
  end
804
826
 
805
- # The register_extension method is used to register an extension with
806
- # SketchUp's extension manager (in SketchUp preferences).
827
+ # The {.register_extension} method is used to register an extension with
828
+ # SketchUp's Extension Manager.
807
829
  #
808
830
  # @example
809
831
  # utilities_extension = SketchupExtension.new("Utilities Tools",
@@ -862,10 +884,10 @@ module Sketchup
862
884
  def self.remove_observer(observer)
863
885
  end
864
886
 
865
- # The require method is used to include encrypted and nonencrypted ruby files.
866
- # This is an alias of the Sketchup.load method.
887
+ # The {.require} method is used to load Ruby files once.
888
+ # Unlike Ruby's own +require+ method it also supports SketchUp's encrypted .rbe files.
867
889
  #
868
- # You do not need to include the file extension on the path. This method will
890
+ # You do not need to include the file extension in the path. This method will
869
891
  # look for .rbe first (encrypted) and then .rbs (the deprecated scrambled
870
892
  # format) and finally .rb (unencrypted) files. The loading order was changed
871
893
  # in SketchUp 2016 when the new .rbe encryption was introduced. Prior to
@@ -892,10 +914,14 @@ module Sketchup
892
914
  #
893
915
  # @bug In SketchUp 2023.1 this method didn't behave correctly on Windows. No known workarounds.
894
916
  #
895
- # @example
917
+ # @example Physical pixels
896
918
  # model = Sketchup.active_model
897
919
  # Sketchup.resize_viewport(model, 800, 600)
898
920
  #
921
+ # @example Logical pixels
922
+ # model = Sketchup.active_model
923
+ # Sketchup.resize_viewport(model, 800, 600, logical_pixels: true)
924
+ #
899
925
  # @note In SketchUp 2024.0 and later this method doesn't behave correctly in all cases on Windows.
900
926
  # The passed values are internally converted to logical pixels, rounded and converted back to
901
927
  # physical pixels. This means certain sizes, such as 1000 px at 150% scaling, cannot be
@@ -910,13 +936,19 @@ module Sketchup
910
936
  # ((1500/1.5).round * 1.5).round # => 1500
911
937
  # ((1500/1.25).round * 1.25).round # => 1500
912
938
  #
913
- # @param [Sketchup::Model] model
939
+ # @overload resize_viewport(model, width, height)
940
+ #
941
+ # @param [Sketchup::Model] model
942
+ # @param [Integer] width Width in physical pixels
943
+ # @param [Integer] height Height in physical pixels
914
944
  #
915
- # @param [Integer] width
916
- # Width in physical pixels
945
+ # @overload resize_viewport(model, width, height, logical_pixels: false)
917
946
  #
918
- # @param [Integer] height
919
- # Height in physical pixels
947
+ # @version SketchUp 2025.0
948
+ # @param [Sketchup::Model] model
949
+ # @param [Integer] width
950
+ # @param [Integer] height
951
+ # @param [Boolean] logical_pixels Set to true to set size using logical pixels.
920
952
  #
921
953
  # @return [Boolean] +true+ on success. +false+ if the window couldn't reach the desired size,
922
954
  # e.g. because it wouldn't fit the screen.
@@ -925,8 +957,10 @@ module Sketchup
925
957
  #
926
958
  # @see Sketchup::View#vpheight
927
959
  #
960
+ # @see UI.scale_factor
961
+ #
928
962
  # @version SketchUp 2023.0
929
- def self.resize_viewport(model, width, height)
963
+ def self.resize_viewport(*args)
930
964
  end
931
965
 
932
966
  # The save_thumbnail method is used to generate a thumbnail for any SKP file -
@@ -1059,7 +1093,7 @@ module Sketchup
1059
1093
  # - 10546: toggle Shadows toolbar
1060
1094
  # - 10551: toogle Large icons
1061
1095
  # - 10576: toggle Render Mode toolbar
1062
- # - 21019: hide Status bar and VCB
1096
+ # - 21019: select the Eraser tool
1063
1097
  # - 21020: show Status bar and VCB
1064
1098
  # - 21022: hide Status bar and VCB
1065
1099
  # - 21023: place 3d text box
@@ -1179,9 +1213,9 @@ module Sketchup
1179
1213
  # If no arguments are passed, the status bar content is cleared. Valid
1180
1214
  # positions are:
1181
1215
  #
1182
- # - +SB_PROMPT+ - the text will appear at the left-side of the status bar
1183
- # - +SB_VCB_LABEL+ - the text will appear in place of the VCB label
1184
- # - +SB_VCB_VALUE+ - the text will appear in the VCB
1216
+ # - {SB_PROMPT} - the text will appear at the left-side of the status bar
1217
+ # - {SB_VCB_LABEL} - the text will appear in place of the VCB label
1218
+ # - {SB_VCB_VALUE} - the text will appear in the VCB
1185
1219
  #
1186
1220
  # @example
1187
1221
  # result = Sketchup.set_status_text("This is a Test", SB_VCB_VALUE)
@@ -1328,11 +1362,6 @@ module Sketchup
1328
1362
  #
1329
1363
  # @example
1330
1364
  # version = Sketchup.version
1331
- # if (version)
1332
- # UI.messagebox version
1333
- # else
1334
- # return
1335
- # end
1336
1365
  #
1337
1366
  # @return [String] the decimal form of the version
1338
1367
  #
@@ -1364,10 +1393,10 @@ module Sketchup
1364
1393
  # @return [Integer] the whole number form of the version
1365
1394
  #
1366
1395
  # @version SketchUp 6.0
1367
- def self.version_number(*args)
1396
+ def self.version_number
1368
1397
  end
1369
1398
 
1370
- # The write_default method is used to set the string associated with a
1399
+ # The {.write_default} method is used to set the string associated with a
1371
1400
  # variable within the specified sub-section of a .plist file on the Mac
1372
1401
  # or the registry on Windows
1373
1402
  # (within the Software > SketchUp > SketchUp [Version] section).
@@ -1375,6 +1404,12 @@ module Sketchup
1375
1404
  # @example
1376
1405
  # result = Sketchup.write_default("section", "key", "my_value")
1377
1406
  #
1407
+ # @note Be aware that the method is not capable of handling Length objects.
1408
+ # You can convert the value to a Float before writing and convert back to Length
1409
+ # when reading the value. Don't store the value as a String as this rounds the
1410
+ # value and formats it in a way that can't be read if the system setting for
1411
+ # decimal separator changes.
1412
+ #
1378
1413
  # @param [String] section
1379
1414
  # A section in a .plist file (Mac) or the registry
1380
1415
  # (Windows).
@@ -1,10 +1,10 @@
1
- # Copyright:: Copyright 2024 Trimble Inc.
1
+ # Copyright:: Copyright 2026 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
  # The SketchupExtension class contains methods allowing you to create and
5
5
  # manipulate SketchUp extensions. Extensions are Ruby scripts that can be
6
6
  # loaded and unloaded using the Extension manager (Extensions panel of the
7
- # Preferences dialog box). Generally you should register your ruby scripts as
7
+ # Extension Manager dialog box). Generally you should register your ruby scripts as
8
8
  # an extension to give SketchUp users the ability to disable it through the
9
9
  # user interface.
10
10
  #
@@ -40,11 +40,11 @@ class SketchupExtension
40
40
 
41
41
  # Loads the extension, meaning the underlying ruby script is immediately
42
42
  # interpreted. This is the equivalent of checking the extension's checkbox
43
- # in the Preferences > Extensions list.
43
+ # in the Extension Manager.
44
44
  #
45
45
  # @example
46
46
  # # This will register the extension, a necessary step for it to appear
47
- # # in SketchUp's Preferences > Extensions list
47
+ # # in SketchUp's Extension Manager > Extensions list
48
48
  # ext_c = SketchupExtension.new('Stair Tools C', 'StairTools/core.rb')
49
49
  # Sketchup.register_extension(ext_c, false)
50
50
  #
@@ -214,9 +214,9 @@ class SketchupExtension
214
214
  #
215
215
  # @example
216
216
  # ext = SketchupExtension.new('Stair Tools', 'StairTools/core.rb')
217
- # UI.messagebox("load_on_start? is false: #{ext.load_on_start?.to_s}")
217
+ # puts "load_on_start? is false: #{ext.load_on_start?.to_s}"
218
218
  # Sketchup.register_extension(ext, true)
219
- # UI.messagebox("load_on_start? is now true: #{ext.load_on_start?.to_s}")
219
+ # puts "load_on_start? is now true: #{ext.load_on_start?.to_s}"
220
220
  #
221
221
  # @return [Boolean]
222
222
  #
@@ -229,9 +229,9 @@ class SketchupExtension
229
229
  #
230
230
  # @example
231
231
  # ext = SketchupExtension.new('Stair Tools', 'StairTools/core.rb')
232
- # UI.messagebox("loaded? is false: #{ext.loaded?.to_s}")
232
+ # puts "loaded? is false: #{ext.loaded?.to_s}"
233
233
  # Sketchup.register_extension(ext, true)
234
- # UI.messagebox("loaded? is now true: #{ext.loaded?.to_s}")
234
+ # puts "loaded? is now true: #{ext.loaded?.to_s}"
235
235
  #
236
236
  # @return [Boolean]
237
237
  #
@@ -277,9 +277,9 @@ class SketchupExtension
277
277
  #
278
278
  # @example
279
279
  # ext = SketchupExtension.new('Stair Tools', 'StairTools/core.rb')
280
- # UI.messagebox("My registered? is false: #{ext.registered?.to_s}")
280
+ # puts "My registered? is false: #{ext.registered?.to_s}"
281
281
  # Sketchup.register_extension(ext, true)
282
- # UI.messagebox("Now registered? is now true: #{ext.registered?.to_s}")
282
+ # puts "Now registered? is now true: #{ext.registered?.to_s}"
283
283
  #
284
284
  # @return [Boolean]
285
285
  #
@@ -288,7 +288,7 @@ class SketchupExtension
288
288
  end
289
289
 
290
290
  # Unloads the extension. This is the equivalent of unchecking the extension's
291
- # checkbox in the Preferences > Extensions list.
291
+ # checkbox in the Extension Manager > Extensions list.
292
292
  #
293
293
  # Note that technically the extension is not "unloaded" in the sense that it
294
294
  # stops running during the current SketchUp session, but the next time the
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2024 Trimble Inc.
1
+ # Copyright:: Copyright 2026 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
  # The String class contains a method used to parse a string as a length value.
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2024 Trimble Inc.
1
+ # Copyright:: Copyright 2026 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
  # The Command class is the preferred class for adding tools to the menus and
@@ -124,8 +124,11 @@ class UI::Command
124
124
  # toolbar = UI::Toolbar.new "Test"
125
125
  # # This command displays Hello World on the screen when clicked
126
126
  # cmd = UI::Command.new("Test") { UI.messagebox("Hello World") }
127
- # cmd.small_icon = "ToolPencilSmall.png"
128
- # cmd.large_icon = "ToolPencilLarge.png"
127
+ # # Use __dir__ to set the icon paths relative to the current file's directory
128
+ # # __dir__ returns the directory of the file where it is called
129
+ # # File.join is used to construct file paths in a platform-independent way
130
+ # cmd.small_icon = File.join(__dir__, "icons", "ToolPencilSmall.png")
131
+ # cmd.large_icon = File.join(__dir__, "icons", "ToolPencilLarge.png")
129
132
  # toolbar = toolbar.add_item cmd
130
133
  # toolbar.show
131
134
  # puts cmd.large_icon
@@ -149,8 +152,11 @@ class UI::Command
149
152
  # toolbar = UI::Toolbar.new "Test"
150
153
  # # This command displays Hello World on the screen when clicked
151
154
  # cmd = UI::Command.new("Test") { UI.messagebox("Hello World") }
152
- # cmd.small_icon = "ToolPencilSmall.png"
153
- # cmd.large_icon = "ToolPencilLarge.png"
155
+ # # Use __dir__ to set the icon paths relative to the current file's directory
156
+ # # __dir__ returns the directory of the file where it is called
157
+ # # File.join is used to construct file paths in a platform-independent way
158
+ # cmd.small_icon = File.join(__dir__, "icons", "ToolPencilSmall.png")
159
+ # cmd.large_icon = File.join(__dir__, "icons", "ToolPencilLarge.png")
154
160
  # toolbar = toolbar.add_item cmd
155
161
  # toolbar.show
156
162
  #
@@ -260,8 +266,11 @@ class UI::Command
260
266
  # toolbar = UI::Toolbar.new "Test"
261
267
  # # This toolbar command displays Hello World on the screen when clicked.
262
268
  # cmd = UI::Command.new("Tester") { UI.messagebox("Hello World") }
263
- # cmd.small_icon = "ToolPencilSmall.png"
264
- # cmd.large_icon = "ToolPencilLarge.png"
269
+ # # Use __dir__ to set the icon paths relative to the current file's directory
270
+ # # __dir__ returns the directory of the file where it is called
271
+ # # File.join is used to construct file paths in a platform-independent way
272
+ # cmd.small_icon = File.join(__dir__, "icons", "ToolPencilSmall.png")
273
+ # cmd.large_icon = File.join(__dir__, "icons", "ToolPencilLarge.png")
265
274
  # toolbar = toolbar.add_item cmd
266
275
  # toolbar.show
267
276
  # puts cmd.small_icon
@@ -285,8 +294,11 @@ class UI::Command
285
294
  # toolbar = UI::Toolbar.new "Test"
286
295
  # # This toolbar command displays Hello World on the screen when clicked.
287
296
  # cmd = UI::Command.new("Tester") { UI.messagebox("Hello World") }
288
- # cmd.small_icon = "ToolPencilSmall.png"
289
- # cmd.large_icon = "ToolPencilLarge.png"
297
+ # # Use __dir__ to set the icon paths relative to the current file's directory
298
+ # # __dir__ returns the directory of the file where it is called
299
+ # # File.join is used to construct file paths in a platform-independent way
300
+ # cmd.small_icon = File.join(__dir__, "icons", "ToolPencilSmall.png")
301
+ # cmd.large_icon = File.join(__dir__, "icons", "ToolPencilLarge.png")
290
302
  # toolbar = toolbar.add_item cmd
291
303
  # toolbar.show
292
304
  #
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2024 Trimble Inc.
1
+ # Copyright:: Copyright 2026 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
  # The Ruby HtmlDialog class allows you to create and interact with HTML dialog
@@ -21,6 +21,8 @@
21
21
  #
22
22
  # HtmlDialog uses the following versions of CEF (Chromium Embedded Framework):
23
23
  #
24
+ # [SketchUp 2025.0]
25
+ # CEF 128
24
26
  # [SketchUp 2024.0]
25
27
  # CEF 112
26
28
  # [SketchUp 2021.1]
@@ -32,6 +34,28 @@
32
34
  # [SketchUp 2017.0]
33
35
  # CEF 52
34
36
  #
37
+ # Starting with SketchUp 2026.1, HtmlDialog exposes a small set of built-in callbacks (mirroring
38
+ # the legacy +skp:+ protocol used by {UI::WebDialog}).
39
+ #
40
+ # * +sketchup.launchEW(id)+ – Opens the Extension Warehouse dialog and show a specified
41
+ # extension's page.
42
+ # * +sketchup.installRBZ(url)+ – Downloads and installs a Ruby extension
43
+ # from the given +.rbz+ URL. (User will be prompted just like using the
44
+ # Extension Manager.)
45
+ #
46
+ # @example
47
+ # html = <<-HTML
48
+ # <button onclick="sketchup.launchEW('b5825acd-ba7c-4544-b255-e9935ddfd63b')">
49
+ # Open Advanced Camera Tools in EW
50
+ # </button>
51
+ # <button onclick="sketchup.installRBZ('https://example.com/my_extension.rbz')">
52
+ # Install My Extension
53
+ # </button>
54
+ # HTML
55
+ # dlg = UI::HtmlDialog.new(dialog_title: 'EW Example')
56
+ # dlg.set_html(html)
57
+ # dlg.show
58
+ #
35
59
  # @note The window size is not guaranteed to be pixel perfect in all SketchUp
36
60
  # versions and operating systems. Prefer responsive designs that can take
37
61
  # up some fluctuations in size.
@@ -68,6 +92,7 @@ class UI::HtmlDialog
68
92
  # dialog.add_action_callback("say") { |action_context, param1, param2|
69
93
  # puts "JavaScript said #{param1} and #{param2}"
70
94
  # }
95
+ # dialog.show # should be called directly after binding callbacks
71
96
  #
72
97
  # @example JavaScript
73
98
  # sketchup.say('Hello World', 42);
@@ -79,8 +104,32 @@ class UI::HtmlDialog
79
104
  # }
80
105
  # });
81
106
  #
107
+ # @example A complete example containing both Ruby and JavaScript
108
+ # html = <<-HTML
109
+ # <h1>Hello World</h1>
110
+ # <p><button onclick="sketchup.say('Hello World', 42)">Say Hello</button></p>
111
+ # <p><button onclick="sketchup.say('Hello World', 66, { onCompleted: function() {
112
+ # console.log('Ruby side done.'); } })">Say Hello with Callback</button></p>
113
+ # HTML
114
+ #
115
+ # options = {
116
+ # :dialog_title => "Example Dialog",
117
+ # :preferences_key => "example.htmldialog",
118
+ # :style => UI::HtmlDialog::STYLE_DIALOG
119
+ # }
120
+ #
121
+ # dialog = UI::HtmlDialog.new(options)
122
+ # dialog.set_html(html)
123
+ # dialog.center
124
+ #
125
+ # dialog.add_action_callback("say") { |action_context, param1, param2|
126
+ # puts "JavaScript said #{param1} and #{param2}"
127
+ # }
128
+ #
129
+ # dialog.show # should be called directly after binding callbacks
130
+ #
82
131
  # @note When an HtmlDialog is closed, all callbacks to that instance are
83
- # cleared. Re-attach them if you need to open the dialog again.
132
+ # cleared. Attach or re-attach them before you show the dialog.
84
133
  #
85
134
  # @param [String] callback_name
86
135
  # The name of the callback method to be invoked from the html dialog.
@@ -197,6 +246,24 @@ class UI::HtmlDialog
197
246
  def get_size
198
247
  end
199
248
 
249
+ # The {#hide} method is used to hide a dialog box without closing it.
250
+ # This preserves the dialog's state and allows it to be shown again later
251
+ # without recreating the dialog.
252
+ #
253
+ # @example
254
+ # dialog.hide
255
+ #
256
+ # @note Modal dialogs cannot be hidden. Attempting to hide a modal dialog
257
+ # will raise an ArgumentError.
258
+ #
259
+ # @raise [ArgumentError] if the dialog is modal
260
+ #
261
+ # @return [nil]
262
+ #
263
+ # @version SketchUp 2026.1
264
+ def hide
265
+ end
266
+
200
267
  # The new method is used to create a new HtmlDialog.
201
268
  #
202
269
  # In SketchUp 2021.1 +use_content_size+ was added.
@@ -257,7 +324,7 @@ class UI::HtmlDialog
257
324
  # :max_height => 1000,
258
325
  # :style => UI::HtmlDialog::STYLE_DIALOG
259
326
  # })
260
- # dialog.set_url("http://www.sketchup.com")
327
+ # dialog.set_url("https://www.sketchup.com")
261
328
  # dialog.show
262
329
  #
263
330
  # @example With keyword style argument
@@ -335,6 +402,8 @@ class UI::HtmlDialog
335
402
  #
336
403
  # @return [Boolean]
337
404
  #
405
+ # @see #set_on_closed
406
+ #
338
407
  # @version SketchUp 2017
339
408
  #
340
409
  # @yieldreturn [Boolean] Return a boolean to indicate if the dialogs should
@@ -394,13 +463,19 @@ class UI::HtmlDialog
394
463
 
395
464
  # The {#set_on_closed} method is used to attach a block that will be
396
465
  # executed when a dialog is already in the process of closing, do any last
397
- # minute operations within this block such as saving the current state.
466
+ # minute operations within this block such as releasing resources or performing cleanup tasks.
398
467
  #
399
468
  # @example
400
- # dialog.set_on_closed { save_selection }
469
+ # dialog.set_on_closed do
470
+ # File.delete('temp_file.txt') if File.exist?('temp_file.txt')
471
+ # end
472
+ #
473
+ # @note For saving state before window closes use {#set_can_close} instead.
401
474
  #
402
475
  # @return [Boolean]
403
476
  #
477
+ # @see #set_can_close
478
+ #
404
479
  # @version SketchUp 2017
405
480
  def set_on_closed
406
481
  end
@@ -1,11 +1,20 @@
1
- # Copyright:: Copyright 2024 Trimble Inc.
1
+ # Copyright:: Copyright 2026 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
  # {UI::Notification} objects allows you to show native notifications in the
5
5
  # desktop. Notifications can have a message, icon and accept and/or dismiss
6
6
  # buttons with callback blocks.
7
7
  #
8
+ # Supported icon formats include: .bmp, .png, .jpg.
9
+ # Vector icons are supported as .svg on Windows and .pdf on Mac.
10
+ # Recommended icon size is 48x48 pixels. Icons larger than these sizes will be automatically
11
+ # downscaled to fit within the limits.
12
+ #
13
+ # @bug Prior to SketchUp 2026.0 oversized icons are cropped on Windows.
14
+ #
8
15
  # @example
16
+ # sketchup_extension = Sketchup.extensions[extension_id]
17
+ # Sketchup.register_extension(sketchup_extension, true)
9
18
  # # For consistency, the accept (yes) and the dismiss (no) buttons
10
19
  # # are always displayed in the same order.
11
20
  # message = "A new version of pizza is available. Install now?"
@@ -107,6 +116,7 @@ class UI::Notification
107
116
  # @notification.show
108
117
  #
109
118
  # @note In order to insert line breaks into the message you need to use +\\r\\n+.
119
+ # From SketchUp 2019 and onwards +\\n+ also works on both Mac and Windows.
110
120
  #
111
121
  # @param [SketchupExtension] sketchup_extension
112
122
  # {SketchupExtension} instance used to identify
@@ -150,6 +160,7 @@ class UI::Notification
150
160
  # @notification.show
151
161
  #
152
162
  # @note In order to insert line breaks into the message you need to use +\\r\\n+.
163
+ # From SketchUp 2019 and onwards +\\n+ also works on both Mac and Windows.
153
164
  #
154
165
  # @param [String] message
155
166
  # String providing the new message.
@@ -163,7 +174,7 @@ class UI::Notification
163
174
  # Shows a button in the notification with the given title and callback block,
164
175
  # both arguments are required.
165
176
  #
166
- # @bug Prior to SketchUp 2019 both the accept and dismiss buttons were
177
+ # @bug Prior to SketchUp 2019 both the Accept and Dismiss buttons were
167
178
  # displayed, even if only one had been implemented.
168
179
  #
169
180
  # @example
@@ -178,7 +189,7 @@ class UI::Notification
178
189
  #
179
190
  # @param [Proc] block
180
191
  # Sets the action callback, this will be called when
181
- # the user clicks on the dismiss button.
192
+ # the user clicks on the accept button.
182
193
  #
183
194
  # @raise [RuntimeError] When calling on_accept when the notification has
184
195
  # already been shown.