sketchup-api-stubs 0.7.8 → 0.7.10

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 (153) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sketchup-api-stubs/sketchup.rb +3 -0
  3. data/lib/sketchup-api-stubs/stubs/Array.rb +1 -1
  4. data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +1 -1
  5. data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +1 -1
  6. data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +1 -1
  7. data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +1 -1
  8. data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +1 -1
  9. data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +1 -1
  10. data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +4 -18
  11. data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +17 -19
  12. data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +1 -1
  13. data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +1 -1
  14. data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +1 -1
  15. data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +3 -3
  16. data/lib/sketchup-api-stubs/stubs/Geom.rb +1 -1
  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 +50 -1
  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/Document.rb +56 -3
  23. data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +1 -1
  24. data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +1 -1
  25. data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +4 -1
  26. data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +1 -1
  27. data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +1 -1
  28. data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +1 -1
  29. data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +1 -1
  30. data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +1 -1
  31. data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +1 -1
  32. data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +1 -1
  33. data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +1 -1
  34. data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +1 -1
  35. data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +1 -1
  36. data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +1 -1
  37. data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +1 -1
  38. data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +73 -1
  39. data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +1 -1
  40. data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +7 -7
  41. data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +1 -1
  42. data/lib/sketchup-api-stubs/stubs/Layout/ReferenceEntity.rb +82 -0
  43. data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +24 -2
  44. data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1 -1
  45. data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +1 -1
  46. data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +1 -1
  47. data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +1 -1
  48. data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +1 -1
  49. data/lib/sketchup-api-stubs/stubs/Layout.rb +1 -1
  50. data/lib/sketchup-api-stubs/stubs/Length.rb +1 -1
  51. data/lib/sketchup-api-stubs/stubs/Numeric.rb +1 -1
  52. data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +1 -1
  53. data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +1 -1
  54. data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +18 -1
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +3 -5
  56. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +4 -9
  57. data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +1 -1
  58. data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +1 -1
  59. data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +1 -1
  60. data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +1 -1
  61. data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +4 -5
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +1 -1
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +44 -4
  64. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +2 -2
  65. data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +1 -1
  66. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +1 -1
  67. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +1 -1
  68. data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +1 -1
  69. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +25 -2
  70. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +1 -1
  71. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +1 -1
  72. data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +1 -1
  73. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +1 -1
  74. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +1 -1
  75. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +1 -1
  76. data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +13 -3
  77. data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +62 -167
  78. data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +1 -1
  79. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +246 -209
  80. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +3 -14
  81. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +1 -1
  82. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +10 -36
  83. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +1 -1
  84. data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +4 -5
  85. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +1 -1
  86. data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +1 -3
  87. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +1 -1
  88. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +16 -26
  89. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +2 -2
  90. data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +1 -1
  91. data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +1 -1
  92. data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +1 -1
  93. data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +1 -1
  94. data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +29 -30
  95. data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +1 -1
  96. data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +2 -2
  97. data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +1 -1
  98. data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +1 -1
  99. data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +1 -1
  100. data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +1 -1
  101. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +1 -1
  102. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +2 -2
  103. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +1 -1
  104. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +9 -7
  105. data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +1 -1
  106. data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +1 -1
  107. data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +2 -3
  108. data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +1 -1
  109. data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +1 -1
  110. data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +28 -23
  111. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +1 -1
  112. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +4 -5
  113. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +5 -18
  114. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +1 -1
  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 +1 -1
  118. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +15 -17
  119. data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +1 -1
  120. data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +21 -18
  121. data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +1 -1
  122. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +18 -9
  123. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +1 -1
  124. data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +1 -1
  125. data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +4 -5
  126. data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +1 -1
  127. data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +1 -1
  128. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +15 -20
  129. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +1 -1
  130. data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +1 -1
  131. data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +1 -1
  132. data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +1 -1
  133. data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +1 -1
  134. data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +1 -1
  135. data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +1 -1
  136. data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +17 -20
  137. data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +1 -1
  138. data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +1 -1
  139. data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +1 -1
  140. data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +1 -1
  141. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +30 -18
  142. data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +1 -1
  143. data/lib/sketchup-api-stubs/stubs/Sketchup.rb +48 -14
  144. data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +2 -2
  145. data/lib/sketchup-api-stubs/stubs/String.rb +1 -1
  146. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +29 -31
  147. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +18 -9
  148. data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +3 -3
  149. data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +5 -4
  150. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +16 -18
  151. data/lib/sketchup-api-stubs/stubs/UI.rb +71 -26
  152. data/lib/sketchup-api-stubs/stubs/_top_level.rb +1 -9
  153. metadata +10 -7
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2022 Trimble Inc.
1
+ # Copyright:: Copyright 2024 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
  # A Vertex. A Vertex represents the end of an Edge or a point inside a Face.
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2022 Trimble Inc.
1
+ # Copyright:: Copyright 2024 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
  # This class contains methods to manipulate the current point of view of the
@@ -31,24 +31,16 @@ class Sketchup::View
31
31
  def add_observer(observer)
32
32
  end
33
33
 
34
- # The animation= method is used to set an animation that is displayed for a
35
- # view. See Animation for details on how to create an animation object.
34
+ # The {#animation=} method is used to set an animation that is displayed for a
35
+ # view. See {Sketchup::Animation} for details on how to create an animation object.
36
36
  #
37
37
  # @example
38
38
  # animation = ViewSpinner.new
39
39
  # model = Sketchup.active_model
40
40
  # view = model.active_view
41
- # anim = view.animation=animation
42
- # if (anim)
43
- # UI.messagebox anim
44
- # else
45
- # UI.messagebox "Failure"
46
- # end
41
+ # anim = view.animation = animation
47
42
  #
48
43
  # @param [#nextFrame] animation
49
- # An Animation object.
50
- #
51
- # @return [#nextFrame] the newly set Animation object
52
44
  #
53
45
  # @version SketchUp 6.0
54
46
  def animation=(animation)
@@ -635,6 +627,24 @@ class Sketchup::View
635
627
  def field_of_view=(fov)
636
628
  end
637
629
 
630
+ # The {#graphics_engine} method is used query the type of the graphics engine that's currently
631
+ # used by this view.
632
+ #
633
+ # @example
634
+ # engine = Sketchup.active_model.active_view.graphics_engine
635
+ # if engine == :graphics_engine_classic
636
+ # puts 'Classic graphics engine'
637
+ # elsif engine == :graphics_engine_2024
638
+ # puts 'New graphics engine'
639
+ # end
640
+ #
641
+ # @return [Symbol] Type of the graphics engine.
642
+ # +:graphics_engine_classic+ or +:graphics_engine_2024+
643
+ #
644
+ # @version SketchUp 2024.0
645
+ def graphics_engine
646
+ end
647
+
638
648
  # The guess_target method is used to guess at what the user is looking at when
639
649
  # you have a perspective view.
640
650
  #
@@ -787,20 +797,22 @@ class Sketchup::View
787
797
  # end
788
798
  # Sketchup.active_model.select_tool(Example::MyTool.new)
789
799
  #
790
- # @note To conserve resources on the user's machine, textures can be loaded
791
- # only when there is a Ruby tool on the tool stack. Make sure to release the
792
- # texture when it's no longer needed. Any textures not already released
793
- # when the last Ruby tool on the tool stack is removed will be automatically
794
- # released by SketchUp.
795
- #
796
800
  # @note Avoid loading and releasing textures within the {Sketchup::Tool#draw}
797
801
  # event as that is not efficient.
798
802
  #
803
+ # @note SketchUp 2020.0-2022.0: To conserve resources on the user's machine,
804
+ # textures can be loaded only when there is a Ruby tool on the tool stack.
805
+ # Make sure to release the texture when it's no longer needed. Any textures
806
+ # not already released when the last Ruby tool on the tool stack is removed
807
+ # will be automatically released by SketchUp. As of SketchUp 2023.0 this
808
+ # automatic cleanup was removed to allow Overlays to draw textures.
809
+ #
799
810
  # @param [Sketchup::ImageRep] image_rep
800
811
  #
801
812
  # @raise [ArgumentError] if the provided {Sketchup::ImageRep} is not valid.
802
813
  #
803
814
  # @raise [RuntimeError] if a Ruby tool was not on the tool stack.
815
+ # (Applies to SketchUp 2020.0-2022.0).
804
816
  #
805
817
  # @return [Integer] A resource ID referring to the image loaded.
806
818
  #
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2022 Trimble Inc.
1
+ # Copyright:: Copyright 2024 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
  # This observer interface is implemented to react to view events.
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2022 Trimble Inc.
1
+ # Copyright:: Copyright 2024 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
@@ -651,8 +651,9 @@ module Sketchup
651
651
  #
652
652
  # @version SketchUp 2021.0
653
653
  # @param [String] filename The model file to open.
654
- # @return [Integer, false] status code if opening the file succeeded,
655
- # +false+ otherwise.
654
+ # @param [Boolean] with_status
655
+ # @return [Integer, false] status code if opening with +with_status+ set to +true+,
656
+ # otherwise +true+ or +false+.
656
657
  #
657
658
  # @version SketchUp 6.0
658
659
  def self.open_file(*args)
@@ -885,6 +886,49 @@ module Sketchup
885
886
  def self.require(path)
886
887
  end
887
888
 
889
+ # The {.resize_viewport} method changes the pixel size of the viewport and SketchUp window.
890
+ # This can be useful for producing a consistent behavior in automatic testing,
891
+ # regardless of the display resolution.
892
+ #
893
+ # @bug In SketchUp 2023.1 this method didn't behave correctly on Windows. No known workarounds.
894
+ #
895
+ # @example
896
+ # model = Sketchup.active_model
897
+ # Sketchup.resize_viewport(model, 800, 600)
898
+ #
899
+ # @note In SketchUp 2024.0 and later this method doesn't behave correctly in all cases on Windows.
900
+ # The passed values are internally converted to logical pixels, rounded and converted back to
901
+ # physical pixels. This means certain sizes, such as 1000 px at 150% scaling, cannot be
902
+ # accurately set.
903
+ #
904
+ # As a workaround in you can use sizes that are evenly divisible with common scale factors,
905
+ # if you depend on pixel perfect sizes.
906
+ #
907
+ # # Changes by 1 px :(
908
+ # ((1000/1.5).round * 1.5).round # => 1001
909
+ # # Survives the round-trip :)
910
+ # ((1500/1.5).round * 1.5).round # => 1500
911
+ # ((1500/1.25).round * 1.25).round # => 1500
912
+ #
913
+ # @param [Sketchup::Model] model
914
+ #
915
+ # @param [Integer] width
916
+ # Width in physical pixels
917
+ #
918
+ # @param [Integer] height
919
+ # Height in physical pixels
920
+ #
921
+ # @return [Boolean] +true+ on success. +false+ if the window couldn't reach the desired size,
922
+ # e.g. because it wouldn't fit the screen.
923
+ #
924
+ # @see Sketchup::View#vpwidth
925
+ #
926
+ # @see Sketchup::View#vpheight
927
+ #
928
+ # @version SketchUp 2023.0
929
+ def self.resize_viewport(model, width, height)
930
+ end
931
+
888
932
  # The save_thumbnail method is used to generate a thumbnail for any SKP file -
889
933
  # not necessarily the loaded model.
890
934
  #
@@ -1011,20 +1055,10 @@ module Sketchup
1011
1055
  # - 10533: display the Shadows Settings dialog box
1012
1056
  # - 10537: toggle the Views toolbar
1013
1057
  # - 10538: display the System Preferences dialog box (Display tab)
1014
- # - 10545: toggle Color ByLayer
1058
+ # - 10545: toggle Shadows
1015
1059
  # - 10546: toggle Shadows toolbar
1016
1060
  # - 10551: toogle Large icons
1017
1061
  # - 10576: toggle Render Mode toolbar
1018
- # - 10596: set Render Mode to No Transparency (Preferences)
1019
- # - 10597: set Render Mode to Wire (Preferences)
1020
- # - 10598: set Render Mode to Transparency (Preferences)
1021
- # - 10599: set Render Mode to Surfaces Shading (Preferences)
1022
- # - 10600: set Render Mode to Texture (Preferences)
1023
- # - 10601: set Render Mode to No Texture (Preferences)
1024
- # - 10602: toggle Shadows
1025
- # - 10603: toggle Profiles
1026
- # - 10604: toggle Extension Lines
1027
- # - 10605: toggle Jitter edges
1028
1062
  # - 21019: hide Status bar and VCB
1029
1063
  # - 21020: show Status bar and VCB
1030
1064
  # - 21022: hide Status bar and VCB
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2022 Trimble Inc.
1
+ # Copyright:: Copyright 2024 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
  # The SketchupExtension class contains methods allowing you to create and
@@ -204,7 +204,7 @@ class SketchupExtension
204
204
  # The relative path to the script that loads your
205
205
  # plugin.
206
206
  #
207
- # @return [Sketchup::Extension] the new Extension object
207
+ # @return [SketchupExtension]
208
208
  #
209
209
  # @version SketchUp 6.0
210
210
  def initialize(title, path)
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2022 Trimble Inc.
1
+ # Copyright:: Copyright 2024 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 2022 Trimble Inc.
1
+ # Copyright:: Copyright 2024 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
@@ -35,36 +35,6 @@
35
35
  # @version SketchUp 6.0
36
36
  class UI::Command
37
37
 
38
- # Class Methods
39
-
40
- # The new method is used to create a new command.
41
- #
42
- # @example
43
- # UI.menu("Draw").add_separator
44
- #
45
- # # Adds a Test submenu to the Draw menu where the Tester menu item appears
46
- # testmenu = UI.menu("Draw").add_submenu("Test")
47
- #
48
- # # This menu item simply displays Hello World on the screen when clicked.
49
- # cmd = UI::Command.new("Tester") { UI.messagebox("Hello World") }
50
- # testmenu.add_item cmd
51
- #
52
- # @note Prior to SketchUp 2019 it was not possible to sub-class {UI::Command}
53
- # due to a bug in how SketchUp initialized the class.
54
- #
55
- # @param [String] menutext
56
- # The text that will appear for this command's menu item
57
- # if it appears on a menu.
58
- #
59
- # @return [UI::Command] the new Command object
60
- #
61
- # @version SketchUp 6.0
62
- #
63
- # @yield Code that executes the command when the menu item or
64
- # toolbar item is selected.
65
- def self.new(menutext)
66
- end
67
-
68
38
  # Instance Methods
69
39
 
70
40
  # The {#extension} method returns the command's associated extension.
@@ -119,6 +89,34 @@ class UI::Command
119
89
  def get_validation_proc
120
90
  end
121
91
 
92
+ # The new method is used to create a new command.
93
+ #
94
+ # @example
95
+ # UI.menu("Draw").add_separator
96
+ #
97
+ # # Adds a Test submenu to the Draw menu where the Tester menu item appears
98
+ # testmenu = UI.menu("Draw").add_submenu("Test")
99
+ #
100
+ # # This menu item simply displays Hello World on the screen when clicked.
101
+ # cmd = UI::Command.new("Tester") { UI.messagebox("Hello World") }
102
+ # testmenu.add_item cmd
103
+ #
104
+ # @note Prior to SketchUp 2019 it was not possible to sub-class {UI::Command}
105
+ # due to a bug in how SketchUp initialized the class.
106
+ #
107
+ # @param [String] menutext
108
+ # The text that will appear for this command's menu item
109
+ # if it appears on a menu.
110
+ #
111
+ # @return [UI::Command] the new Command object
112
+ #
113
+ # @version SketchUp 6.0
114
+ #
115
+ # @yield Code that executes the command when the menu item or
116
+ # toolbar item is selected.
117
+ def initialize(menutext)
118
+ end
119
+
122
120
  # The large_icon method returns the icon file for the command's
123
121
  # large icon.
124
122
  #
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2022 Trimble Inc.
1
+ # Copyright:: Copyright 2024 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 2024.0]
25
+ # CEF 112
24
26
  # [SketchUp 2021.1]
25
27
  # CEF 88
26
28
  # [SketchUp 2019.0]
@@ -30,6 +32,10 @@
30
32
  # [SketchUp 2017.0]
31
33
  # CEF 52
32
34
  #
35
+ # @note The window size is not guaranteed to be pixel perfect in all SketchUp
36
+ # versions and operating systems. Prefer responsive designs that can take
37
+ # up some fluctuations in size.
38
+ #
33
39
  # @version SketchUp 2017
34
40
  class UI::HtmlDialog
35
41
 
@@ -77,20 +83,18 @@ class UI::HtmlDialog
77
83
  # cleared. Re-attach them if you need to open the dialog again.
78
84
  #
79
85
  # @param [String] callback_name
80
- # The name of the callback method to be
81
- # invoked from the html dialog.
86
+ # The name of the callback method to be invoked from the html dialog.
82
87
  #
83
- # @return [Boolean] true if action added successfully, false
84
- # otherwise.
88
+ # @return [Boolean] +true+ if action added successfully, +false+ otherwise.
85
89
  #
86
90
  # @version SketchUp 2017
87
91
  #
88
- # @yield [action_context, ...]
92
+ # @yield [action_context, *args]
89
93
  #
90
94
  # @yieldparam [Object] action_context
91
- # action_context Currently unused.
95
+ # Currently unused.
92
96
  #
93
- # @yieldparam [Object] ...
97
+ # @yieldparam [Array<Object>] args
94
98
  # The parameters sent from JavaScript.
95
99
  def add_action_callback(callback_name)
96
100
  end
@@ -231,6 +235,11 @@ class UI::HtmlDialog
231
235
  # HtmlDialog were not persisted when SketchUp was closed without first
232
236
  # closing the HtmlDialog window.
233
237
  #
238
+ # @bug SketchUp 2023.0 introduced a bug where the position given in {#initialize}
239
+ # is set relative to the SketchUp main window. If you rely on the position to be
240
+ # absolute to the screen then you can use {#set_position} after creating the
241
+ # dialog.
242
+ #
234
243
  # @example With options Hash
235
244
  # dialog = UI::HtmlDialog.new(
236
245
  # {
@@ -311,7 +320,7 @@ class UI::HtmlDialog
311
320
  # A hash containing the initial properties of
312
321
  # the newly created dialog.
313
322
  #
314
- # @return [HtmlDialog]
323
+ # @return [UI::HtmlDialog]
315
324
  #
316
325
  # @version SketchUp 2017
317
326
  def initialize(properties)
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2022 Trimble Inc.
1
+ # Copyright:: Copyright 2024 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
  # {UI::Notification} objects allows you to show native notifications in the
@@ -176,7 +176,7 @@ class UI::Notification
176
176
  # @param [String] title
177
177
  # Sets the title of the button.
178
178
  #
179
- # @param [Block] block
179
+ # @param [Proc] block
180
180
  # Sets the action callback, this will be called when
181
181
  # the user clicks on the dismiss button.
182
182
  #
@@ -222,7 +222,7 @@ class UI::Notification
222
222
  # @param [String] title
223
223
  # Sets the title of the button.
224
224
  #
225
- # @param [Block] block
225
+ # @param [Proc] block
226
226
  # Sets the action callback, this will be called when
227
227
  # the user clicks on the dismiss button.
228
228
  #
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2022 Trimble Inc.
1
+ # Copyright:: Copyright 2024 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
  # The Toolbar class contains methods to create and manipulate SketchUp
@@ -84,7 +84,7 @@ class UI::Toolbar
84
84
  def count
85
85
  end
86
86
 
87
- # The each method is used to iterate through all of the commands
87
+ # The {#each} method is used to iterate through all of the commands
88
88
  # attached to a toolbar.
89
89
  #
90
90
  # @example
@@ -104,8 +104,9 @@ class UI::Toolbar
104
104
  #
105
105
  # @version SketchUp 8.0 M1
106
106
  #
107
- # @yield [key, value] Variables that will hold each key and value as they are
108
- # found.
107
+ # @yieldparam [UI::Command, String] command
108
+ # For separators a string +"|"+ is
109
+ # yielded.
109
110
  def each
110
111
  end
111
112
 
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2022 Trimble Inc.
1
+ # Copyright:: Copyright 2024 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
  # The Ruby WebDialog class allows you to create and interact with DHTML dialog
@@ -177,22 +177,6 @@ class UI::WebDialog
177
177
 
178
178
  # The +new+ method is used to create a new webdialog.
179
179
  #
180
- # 250, left = 0, top = 0, resizable = true)
181
- # @param [String] dialog_title The title to be displayed in the webdialog.
182
- # @param [Boolean] scrollable true if you want to allow scrollbars, false
183
- # if you do not want to allow scrollbars.
184
- # @param [String, nil] pref_key The registry entry where the location and
185
- # size of the dialog will be saved.
186
- # If preferences_key is not included, the
187
- # location and size will not be stored.
188
- # @param [Integer] width The width of the webdialog.
189
- # @param [Integer] height The height of the webdialog.
190
- # @param [Integer] left The number of pixels from the left.
191
- # @param [Integer] top The number of pixels from the top.
192
- # @param [Integer] resizable true if you want the webdialog to be resizable,
193
- # false if not.
194
- # @return [UI::WebDialog]
195
- #
196
180
  # @example
197
181
  # dlg = UI::WebDialog.new("Show sketchup.com", true,
198
182
  # "ShowSketchupDotCom", 739, 641, 150, 150, true);
@@ -207,8 +191,22 @@ class UI::WebDialog
207
191
  # user's OS. On Mac, Safari is embedded, while on the PC whatever version of
208
192
  # Internet Explorer is installed will be embedded.
209
193
  #
210
- # @overload initialize(dialog_title = "", scrollable = true, pref_key = nil, width = 250, height =
194
+ # @overload initialize(dialog_title = "", scrollable = true, pref_key = nil, width = 250, height = 250, left = 0, top = 0, resizable = true)
211
195
  #
196
+ # @param [String] dialog_title The title to be displayed in the webdialog.
197
+ # @param [Boolean] scrollable true if you want to allow scrollbars, false
198
+ # if you do not want to allow scrollbars.
199
+ # @param [String, nil] pref_key The registry entry where the location and
200
+ # size of the dialog will be saved.
201
+ # If preferences_key is not included, the
202
+ # location and size will not be stored.
203
+ # @param [Integer] width The width of the webdialog.
204
+ # @param [Integer] height The height of the webdialog.
205
+ # @param [Integer] left The number of pixels from the left.
206
+ # @param [Integer] top The number of pixels from the top.
207
+ # @param [Integer] resizable true if you want the webdialog to be resizable,
208
+ # false if not.
209
+ # @return [UI::WebDialog]
212
210
  #
213
211
  # @overload initialize(properties)
214
212
  #
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2022 Trimble Inc.
1
+ # Copyright:: Copyright 2024 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
  # The UI module contains a number of methods for creating simple UI elements
@@ -52,23 +52,43 @@ module UI
52
52
  def self.beep
53
53
  end
54
54
 
55
- # The create_cursor method is used to create a cursor from an image file at
55
+ # The {.create_cursor} method is used to create a cursor from an image file at
56
56
  # the specified location. This must be called from within a custom
57
- # Tool. See the Tool class for a complete example.
57
+ # tool. See the {Sketchup::Tool} documentation for a complete example.
58
58
  #
59
- # Since SketchUp 2016 it is possible to provide vector images for the cursors.
60
- # SVG format for Windows and PDF format for OS X.
59
+ # The size of the cursor images should be 32x32 pixels.
60
+ #
61
+ # The coordinates for the cursor's hotspot is based from it's top left corner.
62
+ # For example, a value of (hot_x, hot_y) = (5, 10) would identify the hotpoint
63
+ # of the cursor at 6 pixels from the left edge of your cursor image and 11
64
+ # pixels from the top edge of your cursor image.
65
+ #
66
+ # @bug On macOS raster cursors are always displayed at 24x24.
67
+ #
68
+ # @bug In SketchUp 2023.1 on Mac provided an incorrect hotspot location. The hotspot was scaled by
69
+ # a factor of 32.0/24.0. If a hotspot position was greater than 24, the cursor would not display.
61
70
  #
62
71
  # @example
63
- # cursor_id = nil
64
- # cursor_path = Sketchup.find_support_file("Pointer.png", "Plugins/")
65
- # if cursor_path
66
- # cursor_id = UI.create_cursor(cursor_path, 0, 0)
72
+ # class ExampleTool
73
+ # def initialize
74
+ # @cursor_id = nil
75
+ # # Load vector cursor format depending on platform.
76
+ # ext = Sketchup.platform == :platform_win ? 'svg' : 'pdf'
77
+ # cursor_path = File.join(__dir__, "cursor.#{ext}")
78
+ # @cursor_id = UI.create_cursor(cursor_path, 4, 6)
79
+ # end
80
+ #
81
+ # def onSetCursor
82
+ # UI.set_cursor(@cursor_id)
83
+ # end
67
84
  # end
68
85
  #
69
- # def onSetCursor
70
- # UI.set_cursor(cursor_id)
71
- # end
86
+ # @note Since SketchUp 2016 it is possible to provide vector images for the cursors.
87
+ # SVG format for Windows and PDF format for macOS. This is the recommended format
88
+ # to use since it will scale well with different DPI scaling.
89
+ #
90
+ # @note Because the image is never released, avoid creating new cursors for the same image for any
91
+ # given tool. Cache it and reuse it.
72
92
  #
73
93
  # @param [String] path
74
94
  # File path to an image.
@@ -80,17 +100,29 @@ module UI
80
100
  # @param [Integer] hot_y
81
101
  # A y coordinate that is the "hotpoint" for the cursor
82
102
  # computed from the top edge of the of your cursor image.
83
- # For example, a value of (hot_x, hot_y) = (5,10) would
84
- # identify the hotpoint of the cursor at 5 pixels from
85
- # the left edge of your cursor image and 10 pixels from
86
- # the top edge of your cursor image.
87
103
  #
88
- # @return [Integer] ID associated with the cursor
104
+ # @return [Integer] Id associated with the cursor.
105
+ # Use this with {UI.set_cursor} in {Sketchup::Tool#onSetCursor}.
106
+ #
107
+ # @see UI.set_cursor
108
+ #
109
+ # @see Sketchup::Tool#onSetCursor
89
110
  #
90
111
  # @version SketchUp 6.0
91
112
  def self.create_cursor(path, hot_x, hot_y)
92
113
  end
93
114
 
115
+ # Returns the plain text available on the clipboard, if there is any.
116
+ #
117
+ # @example
118
+ # text = UI.get_clipboard_data
119
+ #
120
+ # @return [String, nil]
121
+ #
122
+ # @version SketchUp 2023.1
123
+ def self.get_clipboard_data
124
+ end
125
+
94
126
  # Creates a dialog box for inputting user information. The dialog box contains
95
127
  # input fields with static text prompts, optional default values, optional
96
128
  # drop down selections, and optional title.
@@ -166,8 +198,11 @@ module UI
166
198
  # is the first step toward adding your own custom items to the bottom
167
199
  # of SketchUp's menus.
168
200
  #
169
- # Valid menu names are: "File", "Edit", "View", "Camera", "Draw", "Tools",
170
- # "Window", "Extensions", "Help" and "Developer".
201
+ # Valid menu names are: +'File'+, +'Edit'+, +'View'+, +'Camera'+, +'Draw'+,
202
+ # +'Tools'+, +'Window'+, +'Extensions'+, +'Help'+ and +'Developer'+.
203
+ #
204
+ # @bug In versions prior to SketchUp 2018 this would crash if you passed an
205
+ # empty string.
171
206
  #
172
207
  # @example
173
208
  # tool_menu = UI.menu("Tools")
@@ -175,19 +210,18 @@ module UI
175
210
  # UI.messagebox("Cheese activated.")
176
211
  # }
177
212
  #
178
- # @note The "Extensions" menu was named "Plugins" prior to SketchUp 2015.
179
- # For backward compatibility "Plugins" still works.
213
+ # @note The +'Extensions'+ menu was named +'Plugins'+ prior to SketchUp 2015.
214
+ # For backward compatibility +'Plugins'+ still works.
180
215
  #
181
- # @note In versions prior to SketchUp 2018 this would crash if you passed an
182
- # empty string.
216
+ # @note +'Developer'+ menu was added with SketchUp 2021.1.
183
217
  #
184
- # @param menu_name
185
- # The name of an existing top level menu.
218
+ # @param [String] menu_name
219
+ # The name of a supported menu.
186
220
  #
187
221
  # @return [Sketchup::Menu]
188
222
  #
189
223
  # @version SketchUp 6.0
190
- def self.menu(menu_name = "Plugins")
224
+ def self.menu(menu_name = "Extensions")
191
225
  end
192
226
 
193
227
  # Creates a dialog box containing static text with a series of buttons for
@@ -480,6 +514,17 @@ module UI
480
514
  def self.select_directory(options = {})
481
515
  end
482
516
 
517
+ # Copies plain text to the clipboard.
518
+ #
519
+ # @example
520
+ # UI.set_clipboard_data('Hello World')
521
+ #
522
+ # @return [Boolean]
523
+ #
524
+ # @version SketchUp 2023.1
525
+ def self.set_clipboard_data(data)
526
+ end
527
+
483
528
  # The {.set_cursor} method is used to change the cursor to a new cursor with a
484
529
  # given cursor id. See UI.create_cursor and the Tool class for details
485
530
  # on creating your own tools with arbitrary cursors.
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2022 Trimble Inc.
1
+ # Copyright:: Copyright 2024 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
 
@@ -205,14 +205,6 @@
205
205
 
206
206
  # Instance Methods
207
207
 
208
- # This function will add a separator to a given menu the first
209
- # time it is called. It is useful for adding a separator before
210
- # the first plugin that is added to a given menu.
211
- #
212
- # @deprecated Avoid adding separators to top level menus. If you require
213
- # grouping use a sub-menu instead.
214
- #
215
- # @param [String] menu_name
216
208
  #
217
209
  # @version SketchUp 6.0
218
210
  def add_separator_to_menu(menu_name)