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,12 +1,13 @@
1
- # Copyright:: Copyright 2024 Trimble Inc.
1
+ # Copyright:: Copyright 2026 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
5
- # model. The drawing methods here (draw_line, draw_polyline, etc) are meant to
6
- # be invoked within a tool's Tool.draw method. Calling them outside Tool.draw
7
- # will have no effect.
5
+ # model. The drawing methods here ({#draw_line}, {#draw_polyline}, etc) are
6
+ # meant to be invoked within a tool's {Sketchup::Tool#draw} method. Calling
7
+ # them outside {Sketchup::Tool#draw} will have no effect.
8
8
  #
9
- # You access the View by calling the Model.active_view method.
9
+ # You access the {Sketchup::View} by calling the {Sketchup::Model#active_view}
10
+ # method.
10
11
  #
11
12
  # @example
12
13
  # view = Sketchup.active_model.active_view
@@ -14,6 +15,13 @@
14
15
  # @version SketchUp 6.0
15
16
  class Sketchup::View
16
17
 
18
+ # Constants
19
+
20
+ CORNER_BOTTOM_LEFT = nil # Stub value.
21
+ CORNER_BOTTOM_RIGHT = nil # Stub value.
22
+ CORNER_TOP_LEFT = nil # Stub value.
23
+ CORNER_TOP_RIGHT = nil # Stub value.
24
+
17
25
  # Instance Methods
18
26
 
19
27
  # The add_observer method is used to add an observer to the current object.
@@ -95,45 +103,95 @@ class Sketchup::View
95
103
  def camera=(arg)
96
104
  end
97
105
 
98
- # The center method is used to retrieve the coordinates of the center of the
99
- # view in pixels. It is returned as an array of 2 values for x and y.
106
+ # The {#center} method is used to retrieve the coordinates of the center of the
107
+ # view in pixels.
100
108
  #
101
109
  # @example
102
110
  # model = Sketchup.active_model
103
111
  # view = model.active_view
104
- # c = view.center
112
+ # center = view.center
105
113
  #
106
- # @return [Geom::Point3d] the center of the view
114
+ # @overload center()
107
115
  #
108
- # @version SketchUp 6.0
116
+ # @note Signature for versions prior to SketchUp 2025.0
117
+ # @version SketchUp 6.0
118
+ # @return [Array(Integer, Integer)] Physical pixels.
119
+ #
120
+ # @overload center()
121
+ #
122
+ # @version SketchUp 2025.0
123
+ # @return [Array(Float, Float)] Logical pixels.
109
124
  def center
110
125
  end
111
126
 
112
- # The corner method is used to retrieve the coordinates of one of the corners
113
- # of the view. The argument is an index between 0 and 3 that identifies which
127
+ # The {#corner} method is used to retrieve the coordinates of one of the corners
128
+ # of the view. The argument is an index between +0+ and +3+ that identifies which
114
129
  # corner you want. This method returns an array with two integers which are
115
- # the coordinates of the corner of the view in the view space. If the view
116
- # uses a Camera with a fixed aspect ratio, then the corners are the corners of
117
- # the viewing are of the camera which might be different than the actual
118
- # corners of the view itself.
119
- #
120
- # The index numbers are as follows:
121
- # - 0: top left,
122
- # - 1: top right,
123
- # - 2: bottom left,
124
- # - 3: bottom right.
130
+ # the coordinates of the corner of the view in the view space.
131
+ #
132
+ # The indices are as follows:
133
+ # - 0: {CORNER_TOP_LEFT}
134
+ # - 1: {CORNER_TOP_RIGHT}
135
+ # - 2: {CORNER_BOTTOM_LEFT}
136
+ # - 3: {CORNER_BOTTOM_RIGHT}
137
+ #
138
+ # @example New preferred style using constants
139
+ # # From SketchUp 2025.0:
140
+ # point = Sketchup.active_model.active_view.corner(Sketchup::View::CORNER_BOTTOM_LEFT)
141
+ #
142
+ # @example Old style using hard coded indices
143
+ # # For SketchUp 2024.0 and older: (Works with newer versions too)
144
+ # point = Sketchup.active_model.active_view.corner(2)
145
+ #
146
+ # @note If the view uses a {Sketchup::Camera} with a fixed aspect ratio, then the
147
+ # corners are the corners of the viewing are of the camera which might be different
148
+ # than the actual corners of the view itself.
149
+ #
150
+ # @overload corner(index)
151
+ #
152
+ # @note Signature for versions prior to SketchUp 2025.0
153
+ # @version SketchUp 6.0
154
+ # @param [Integer] index
155
+ # A value between (or including) +0+ and +3+ identifying the
156
+ # corner whose coordinate you want to retrieve.
157
+ # @return [Array(Integer, Integer)] a 2D array +[x, y]+ representing the screen point in physical
158
+ # pixels.
159
+ #
160
+ # @overload corner(index)
161
+ #
162
+ # @version SketchUp 2025.0
163
+ # @param [Integer] index
164
+ # A value between (or including) +0+ and +3+ identifying the
165
+ # corner whose coordinate you want to retrieve.
166
+ # @return [Array(Float, Float)] a 2D array +[x, y]+ representing the screen point in logical
167
+ # pixels.
168
+ def corner(arg)
169
+ end
170
+
171
+ # The {#device_height} method is used to retrieve the height of the viewport for the
172
+ # view in physical pixels.
125
173
  #
126
174
  # @example
127
- # point = view.corner index
175
+ # model = Sketchup.active_model
176
+ # view = model.active_view
177
+ # height = view.device_height
128
178
  #
129
- # @param [Integer] index
130
- # A value between (or including) 0 and 3 identifying the
131
- # corner whose coordinate you want to retrieve.
179
+ # @return [Integer] the height of the viewport in physical pixels.
132
180
  #
133
- # @return [Array(Integer, Integer)] a 2d array [w,h] representing the screen point
181
+ # @version SketchUp 2025.0
182
+ def device_height
183
+ end
184
+
185
+ # The {#device_width} method is used to retrieve the width of the viewport for the
186
+ # view in physical pixels.
134
187
  #
135
- # @version SketchUp 6.0
136
- def corner(index)
188
+ # @example
189
+ # width = view.device_width
190
+ #
191
+ # @return [Integer] the width of the viewport in physical pixels.
192
+ #
193
+ # @version SketchUp 2025.0
194
+ def device_width
137
195
  end
138
196
 
139
197
  # The {#draw} method is used to do basic drawing. This method can only be
@@ -275,6 +333,7 @@ class Sketchup::View
275
333
  # The second parameter is an {Array} of {Geom::Point3d} objects (or several
276
334
  # individual {Geom::Point3d} objects). These {Geom::Point3d} objects are in
277
335
  # screen space, not 3D space.
336
+ #
278
337
  # The X value corresponds to the number of pixels from the left edge of the
279
338
  # drawing area. The Y value corresponds to the number of pixels down from
280
339
  # the top of the drawing area. The Z value is not used.
@@ -284,10 +343,16 @@ class Sketchup::View
284
343
  # Geom::Point3d.new(0, 0, 0),
285
344
  # Geom::Point3d.new(8, 0, 0),
286
345
  # Geom::Point3d.new(8, 4, 0),
287
- # Geom::Point3d.new(0, 4, 0)
346
+ # Geom::Point3d.new(0, 4, 0),
288
347
  # ]
289
348
  # view.draw2d(GL_LINE_STRIP, points)
290
349
  #
350
+ # @note Prior to SketchUp 2025.0 this method accepted the +points+ as physical
351
+ # screen coordinates. As of SketchUp 2025.0 the +points+ are expected to be
352
+ # in logical screen coordinates. Older versions need to apply the scaling
353
+ # factor from {UI.scale_factor} to the points before passing them to this
354
+ # method.
355
+ #
291
356
  # @overload draw2d(openglenum, points)
292
357
  #
293
358
  # @param [Integer] openglenum
@@ -394,23 +459,31 @@ class Sketchup::View
394
459
  def draw_lines(*args)
395
460
  end
396
461
 
397
- # This method is used to draw points.
398
- #
399
- # This method is usually invoked within the draw method of a tool.
462
+ # This method is used to draw points in model space.
400
463
  #
401
464
  # @example
402
- # point3 = Geom::Point3d.new 0,0,0
403
- # # returns a view
404
- # status = view.draw_points(point3, 10, 1, "red")
465
+ # point = Geom::Point3d.new(0, 0, 0)
466
+ # view.draw_points(point, 10, 1, "red")
467
+ #
468
+ # @note Prior to SketchUp 2025.0 this method accepted the +size+ as physical
469
+ # pixels. As of SketchUp 2025.0 the +points+ are expected to be in logical pixels.
470
+ # Older versions need to apply the scaling factor from {UI.scale_factor} to the
471
+ # size before passing them to this method.
405
472
  #
406
473
  # @param [Array<Geom::Point3d>] points
474
+ # Model coordinates.
407
475
  #
408
476
  # @param [Integer] size
409
477
  # Size of the point in pixels.
410
478
  #
411
479
  # @param [Integer] style
412
- # 1 = open square, 2 = filled square, 3 = "+", 4 = "X", 5 = "*",
413
- # 6 = open triangle, 7 = filled triangle.
480
+ # - +1+ = open square
481
+ # - +2+ = filled square
482
+ # - +3+ = plus shape "+"
483
+ # - +4+ = cross shape "X"
484
+ # - +5+ = star shape "*"
485
+ # - +6+ = open triangle
486
+ # - +7+ = filled triangle
414
487
  #
415
488
  # @param [Sketchup::Color] color
416
489
  #
@@ -490,7 +563,15 @@ class Sketchup::View
490
563
  # end
491
564
  # end
492
565
  #
493
- # @example Cross Platform Font Size
566
+ # @example Cross Platform Font Size in SketchUp 2025.0 and newer
567
+ # class ExampleTool
568
+ # def draw(view)
569
+ # draw_text(view, [100, 200, 0], "Hello Pixel World", pixel_size: 20)
570
+ # draw_text(view, [100, 250, 0], "Hello Point World", point_size: 20)
571
+ # end
572
+ # end
573
+ #
574
+ # @example Cross Platform Font Size in SketchUp 2024.0 and older
494
575
  # class ExampleTool
495
576
  # IS_WIN = Sketchup.platform == :platform_win
496
577
  #
@@ -523,7 +604,8 @@ class Sketchup::View
523
604
  #
524
605
  # @note The font size is platform dependent. On Windows the method expects
525
606
  # points, where on Mac it's pixels. See "Cross Platform Font Size" example
526
- # for details.
607
+ # for details. As of SketchUp 2025.0 you can use the +:pixel_size+ or
608
+ # +:point_size+ options to specify the size in pixels or points respectively.
527
609
  #
528
610
  # @overload draw_text(point, text)
529
611
  #
@@ -541,7 +623,13 @@ class Sketchup::View
541
623
  # named arguments of options.
542
624
  # @option options [String] :font The name of the font to use. If it does not
543
625
  # exist on the system, a default font will be used instead.
544
- # @option options [Integer] :size The size of the font in points
626
+ # @option options [Integer] :size <b>Legacy</b>: The size of the font in
627
+ # system-dependent units. On Windows this is in points, on Mac it's in
628
+ # pixels.
629
+ # @option options [Integer] :pixel_size <b>Added SketchUp 2025.0</b>: The
630
+ # size of the font in pixels.
631
+ # @option options [Integer] :point_size <b>Added SketchUp 2025.0</b>: The
632
+ # size of the font in points.
545
633
  # @option options [Boolean] :bold Controls the Bold property of the font.
546
634
  # @option options [Boolean] :italic Controls the Italic property of the font.
547
635
  # @option options [Sketchup::Color] :color The color to draw the text with.
@@ -554,8 +642,13 @@ class Sketchup::View
554
642
  # some fonts on Mac might not align as expected due to the system
555
643
  # reporting incorrect font metrics.
556
644
  #
645
+ # @raise [ArgumentError] if combining usage of +:size+, +:pixel_size+ or
646
+ # +:point_size+ options.
647
+ #
557
648
  # @return [Sketchup::View]
558
649
  #
650
+ # @see #text_bounds
651
+ #
559
652
  # @version SketchUp 6.0
560
653
  def draw_text(*args)
561
654
  end
@@ -648,12 +741,16 @@ class Sketchup::View
648
741
  # The guess_target method is used to guess at what the user is looking at when
649
742
  # you have a perspective view.
650
743
  #
651
- # This method is useful when writing a viewing tool. See also camera.rb which
652
- # is part of the film and stage ruby scripts.
653
- #
654
744
  # @example
655
745
  # target = view.guess_target
656
746
  #
747
+ # @overload guess_target
748
+ #
749
+ #
750
+ # @overload guess_target(screen_point)
751
+ #
752
+ # @param [Geom::Point3d] screen_point
753
+ #
657
754
  # @return [Geom::Point3d] a Point3d object representing the point in the
658
755
  # model that the user is likely interested in.
659
756
  #
@@ -675,28 +772,77 @@ class Sketchup::View
675
772
  def inference_locked?
676
773
  end
677
774
 
678
- # The inputpoint method is used to retrieve an input point.
775
+ # The {#inputpoint} method is used to retrieve an {Sketchup::InputPoint}.
679
776
  #
680
777
  # This will normally be used inside one of the mouse event handling methods in
681
- # a tool. Usually, it is preferable to create the InputPoint first and then
682
- # use the pick method on it.
778
+ # a tool. Usually, it is preferable to create the {Sketchup::InputPoint} first
779
+ # and then use the pick method on it.
683
780
  #
684
781
  # @example
685
- # inputpoint = view.inputpoint x, y, inputpoint1
782
+ # class ExampleTool
783
+ # def onMouseMove(flags, x, y, view)
784
+ # inputpoint = view.inputpoint(x, y)
785
+ # instance_path = ip.instance_path
786
+ # end
787
+ # end
788
+ #
789
+ # @example Inference from another input point
790
+ # class ExampleTool
791
+ #
792
+ # def onLButtonUp(flags, x, y, view)
793
+ # @picked_input = view.inputpoint(x, y)
794
+ # end
686
795
  #
687
- # @param [Numeric] x
688
- # A x value.
796
+ # def onMouseMove(flags, x, y, view)
797
+ # # Note: It is preferrable to initialize input points using
798
+ # # Sketchup::InputPoint.new in `initialize` and reuse them doing the
799
+ # # picking using the `pick` method.
800
+ # if @inputpoint
801
+ # @inputpoint = view.inputpoint(x, y, @picked_input)
802
+ # else
803
+ # @inputpoint = view.inputpoint(x, y)
804
+ # end
805
+ # end
806
+ #
807
+ # def draw(view)
808
+ # if @inputpoint
809
+ # @inputpoint.draw(view) if @inputpoint.display?
810
+ # else
811
+ # @picked_input.draw(view) if @picked_input.display?
812
+ # end
813
+ # end
814
+ # end
689
815
  #
690
- # @param [Numeric] y
691
- # A y value.
816
+ # @overload inputpoint(x, y)
692
817
  #
693
- # @param [Sketchup::InputPoint] inputpoint1
694
- # An InputPoint object.
818
+ # @note Signature for versions prior to SketchUp 2025.0
819
+ # @version SketchUp 6.0
820
+ # @param [Integer] x Screen coordinate in physical pixels.
821
+ # @param [Integer] y Screen coordinate in physical pixels.
695
822
  #
696
- # @return [Sketchup::InputPoint]
823
+ # @overload inputpoint(x, y, inputpoint1)
697
824
  #
698
- # @version SketchUp 6.0
699
- def inputpoint(x, y, inputpoint1)
825
+ # @note Signature for versions prior to SketchUp 2025.0
826
+ # @version SketchUp 6.0
827
+ # @param [Integer] x Screen coordinate in physical pixels.
828
+ # @param [Integer] y Screen coordinate in physical pixels.
829
+ # @param [Sketchup::InputPoint] inputpoint1
830
+ #
831
+ # @overload inputpoint(x, y)
832
+ #
833
+ # @version SketchUp 2025.0
834
+ # @param [Float] x Screen coordinate in logical pixels.
835
+ # @param [Float] y Screen coordinate in logical pixels.
836
+ #
837
+ # @overload inputpoint(x, y, inputpoint1)
838
+ #
839
+ # @version SketchUp 2025.0
840
+ # @param [Float] x Screen coordinate in logical pixels.
841
+ # @param [Float] y Screen coordinate in logical pixels.
842
+ # @param [Sketchup::InputPoint] inputpoint1
843
+ #
844
+ # @return [Sketchup::InputPoint]
845
+ def inputpoint(*args)
700
846
  end
701
847
 
702
848
  # The invalidate method is used mark the view as in need of a redraw.
@@ -721,6 +867,13 @@ class Sketchup::View
721
867
  # @example
722
868
  # time = view.last_refresh_time
723
869
  #
870
+ # @overload last_refresh_time
871
+ #
872
+ #
873
+ # @overload last_refresh_time(full)
874
+ #
875
+ # @param [Boolean] full
876
+ #
724
877
  # @return [Float] time in milliseconds
725
878
  #
726
879
  # @version SketchUp 6.0
@@ -764,10 +917,14 @@ class Sketchup::View
764
917
  # @note As of SU2017 this will automatically scale the line width by the same
765
918
  # factor as {UI.scale_factor}.
766
919
  #
767
- # @param [Integer] width
920
+ # @note As of Sketchup 2026.0 positive values will be clamped to a minimum of 1.0.
921
+ #
922
+ # @param [Numeric] width
768
923
  # The width in pixels.
769
924
  #
770
- # @return [Integer]
925
+ # @raise [ArgumentError] if the width is negative.
926
+ #
927
+ # @return [Numeric]
771
928
  #
772
929
  # @version SketchUp 6.0
773
930
  def line_width=(width)
@@ -852,8 +1009,7 @@ class Sketchup::View
852
1009
  # @param [Sketchup::InputPoint] inputpoint2
853
1010
  # @example
854
1011
  # # Lock inference to X axis.
855
- # # The points can be anywhere; only the vector between them affects
856
- # # the result.
1012
+ # # The points define a line in space, and the inference is locked to this line.
857
1013
  # view.lock_inference(
858
1014
  # Sketchup::InputPoint.new(ORIGIN),
859
1015
  # Sketchup::InputPoint.new(Geom::Point3d.new(1, 0, 0))
@@ -876,10 +1032,7 @@ class Sketchup::View
876
1032
  def model
877
1033
  end
878
1034
 
879
- # The pick_helper method is used to retrieve a pick helper for the view. See
880
- # the PickHelper class for information on pick helpers.
881
- #
882
- # This call returns an initialized PickHelper.
1035
+ # The {#pick_helper} method is used to retrieve a pick helper for the view.
883
1036
  #
884
1037
  # @example
885
1038
  # model = Sketchup.active_model
@@ -888,41 +1041,75 @@ class Sketchup::View
888
1041
  #
889
1042
  # @overload pick_helper
890
1043
  #
891
- # @return [Sketchup::PickHelper] a PickHelper object
1044
+ # @return [Sketchup::PickHelper]
892
1045
  #
893
1046
  # @overload pick_helper(x, y, aperture = 0)
894
1047
  #
895
- # @param [Integer] x
896
- # @param [Integer] y
897
- # @param [Integer] aperture
898
- # @return [Sketchup::PickHelper] a PickHelper object
1048
+ # @note Signature for versions prior to SketchUp 2025.0
1049
+ # @version SketchUp 6.0
1050
+ # @param [Integer] x Screen coordinate in physical pixels.
1051
+ # @param [Integer] y Screen coordinate in physical pixels.
1052
+ # @param [Integer] aperture The size of the aperture in physical pixels.
1053
+ # @return [Sketchup::PickHelper]
1054
+ #
1055
+ # @overload pick_helper(x, y, aperture = 0.0)
1056
+ #
1057
+ # @version SketchUp 2025.0
1058
+ # @param [Float] x Screen coordinate in logical pixels.
1059
+ # @param [Float] y Screen coordinate in logical pixels.
1060
+ # @param [Float] aperture The size of the aperture in logical pixels.
1061
+ # @return [Sketchup::PickHelper]
1062
+ #
1063
+ # @see Sketchup::PickHelper
899
1064
  #
900
1065
  # @version SketchUp 6.0
901
1066
  def pick_helper(*args)
902
1067
  end
903
1068
 
904
- # The pickray method is used to retrieve a ray passing through a given screen
1069
+ # The {#pickray} method is used to retrieve a ray passing through a given screen
905
1070
  # position in the viewing direction.
906
1071
  #
907
1072
  # @example
908
- # ray = view.pickray x, y
1073
+ # ray = view.pickray(x, y)
1074
+ # result = model.raytest(ray)
909
1075
  #
910
1076
  # @overload pickray(screen_point)
911
1077
  #
1078
+ # @note Signature for versions prior to SketchUp 2025.0
1079
+ # @version SketchUp 6.0
912
1080
  # @param [Array(Integer, Integer)] screen_point
1081
+ # Screen coordinates in physical pixels.
1082
+ # @return [Array(Geom::Point3d, Geom::Vector3d)] a ray
1083
+ #
1084
+ # @overload pickray(x, y)
1085
+ #
1086
+ # @note Signature for versions prior to SketchUp 2025.0
1087
+ # @version SketchUp 6.0
1088
+ # @param [Integer] x Screen coordinate in physical pixels.
1089
+ # @param [Integer] y Screen coordinate in physical pixels.
1090
+ # @return [Array(Geom::Point3d, Geom::Vector3d)] a ray
1091
+ #
1092
+ # @overload pickray(screen_point)
1093
+ #
1094
+ # @version SketchUp 2025.0
1095
+ # @param [Array(Float, Float)] screen_point
1096
+ # Screen coordinates in logical pixels.
913
1097
  # @return [Array(Geom::Point3d, Geom::Vector3d)] a ray
914
1098
  #
915
1099
  # @overload pickray(x, y)
916
1100
  #
917
- # @param [Integer] x
918
- # @param [Integer] y
1101
+ # @version SketchUp 2025.0
1102
+ # @param [Float] x Screen coordinate in logical pixels.
1103
+ # @param [Float] y Screen coordinate in logical pixels.
919
1104
  # @return [Array(Geom::Point3d, Geom::Vector3d)] a ray
920
1105
  #
1106
+ # @see Sketchup::Model#raytest
1107
+ #
921
1108
  # @version SketchUp 6.0
922
1109
  def pickray(*args)
923
1110
  end
924
1111
 
925
- # The pixels_to_model method is used to compute a model size from a pixel size
1112
+ # The {#pixels_to_model} method is used to compute a model size from a pixel size
926
1113
  # at a given point.
927
1114
  #
928
1115
  # This method is useful for deciding how big to draw something based on a
@@ -935,10 +1122,10 @@ class Sketchup::View
935
1122
  # factor as {UI.scale_factor}.
936
1123
  #
937
1124
  # @param [Numeric] pixels
938
- # The pixel size.
1125
+ # Logical pixels since SketchUp 2017.
939
1126
  #
940
1127
  # @param [Geom::Point3d] point
941
- # A Point3d object where the size will be calculated from.
1128
+ # A model point where the size will be calculated from.
942
1129
  #
943
1130
  # @return [Float] the model size
944
1131
  #
@@ -1016,23 +1203,37 @@ class Sketchup::View
1016
1203
  def remove_observer(observer)
1017
1204
  end
1018
1205
 
1019
- # The screen_coords method is used to retrieve the screen coordinates of the
1206
+ # The {#screen_coords} method is used to retrieve the screen coordinates of the
1020
1207
  # given point on the screen.
1021
1208
  #
1022
- # The x and y values returned correspond to the x and y screen coordinates.
1023
- # Ignore the z values. If the referenced point is not in the current
1024
- # viewport, the x and/or y value may be negative.
1209
+ # The +x+ and +y+ values returned correspond to the +x+ and +y+ screen coordinates.
1210
+ # Ignore the +z+ values. If the referenced point is not in the current
1211
+ # viewport, the +x+ and/or +y+ value may be negative.
1025
1212
  #
1026
1213
  # @example
1214
+ # view = Sketchup.active_model.active_view
1027
1215
  # point = view.screen_coords(ORIGIN)
1028
1216
  #
1029
- # @param [Geom::Point3d] point3d
1030
- # A Point3d object.
1217
+ # @note Prior to SketchUp 2025.0 this method returned the points as physical
1218
+ # screen coordinates. As of SketchUp 2025.0 the points are returned in
1219
+ # logical screen coordinates.
1220
+ #
1221
+ # @overload screen_coords(model_point)
1222
+ #
1223
+ # @note Signature for versions prior to SketchUp 2025.0
1224
+ # @version SketchUp 6.0
1225
+ # @param [Geom::Point3d] model_point Model coordinate.
1226
+ #
1227
+ # @overload screen_coords(model_point)
1031
1228
  #
1032
- # @return [Geom::Point3d] A Point3d containing the screen position
1229
+ # @version SketchUp 2025.0
1230
+ # @param [Geom::Point3d] model_point Model coordinate.
1231
+ #
1232
+ # @return [Geom::Point3d] Screen coordinate in pixels (physical prior to SketchUp 2025.0, logical
1233
+ # from 2025.0).
1033
1234
  #
1034
1235
  # @version SketchUp 6.0
1035
- def screen_coords(point3d)
1236
+ def screen_coords(model_point)
1036
1237
  end
1037
1238
 
1038
1239
  # Set the drawing color for the view based on the direction of a line that you
@@ -1089,10 +1290,10 @@ class Sketchup::View
1089
1290
  # class ExampleTool
1090
1291
  # TEXT_OPTIONS = {
1091
1292
  # :font => "Arial",
1092
- # :size => 20,
1293
+ # :pixel_size => 20, # Use :size for SketchUp 2024.0 and older.
1093
1294
  # :bold => true,
1094
1295
  # :align => TextAlignRight,
1095
- # :align => TextVerticalAlignBaseline
1296
+ # :vertical_align => TextVerticalAlignBaseline
1096
1297
  # }
1097
1298
  #
1098
1299
  # # Since `draw` is called frequently it can be useful to pre-compute and
@@ -1132,7 +1333,15 @@ class Sketchup::View
1132
1333
  # @option options [String] :font The name of the font to use. If it does not
1133
1334
  # exist on the system, a default font will be used instead.
1134
1335
  #
1135
- # @option options [Integer] :size The size of the font in points
1336
+ # @option options [Integer] :size <b>Legacy</b>: The size of the font in
1337
+ # system-dependent units. On Windows this is in points, on Mac it's in
1338
+ # pixels.
1339
+ #
1340
+ # @option options [Integer] :pixel_size <b>Added SketchUp 2025.0</b>: The
1341
+ # size of the font in pixels.
1342
+ #
1343
+ # @option options [Integer] :point_size <b>Added SketchUp 2025.0</b>: The
1344
+ # size of the font in points.
1136
1345
  #
1137
1346
  # @option options [Boolean] :bold Controls the Bold property of the font.
1138
1347
  #
@@ -1157,6 +1366,9 @@ class Sketchup::View
1157
1366
  # The text can be customized by providing a hash or
1158
1367
  # named arguments of options.
1159
1368
  #
1369
+ # @raise [ArgumentError] if combining usage of +:size+, +:pixel_size+ or
1370
+ # +:point_size+ options.
1371
+ #
1160
1372
  # @return [Geom::Bounds2d]
1161
1373
  #
1162
1374
  # @see #draw_text
@@ -1180,7 +1392,7 @@ class Sketchup::View
1180
1392
  def tooltip=(string)
1181
1393
  end
1182
1394
 
1183
- # The vpheight method is used to retrieve the height of the viewport for the
1395
+ # The {#vpheight} method is used to retrieve the height of the viewport for the
1184
1396
  # view.
1185
1397
  #
1186
1398
  # @example
@@ -1188,19 +1400,46 @@ class Sketchup::View
1188
1400
  # view = model.active_view
1189
1401
  # height = view.vpheight
1190
1402
  #
1191
- # @return [Integer] the height of the viewport in physical pixels.
1403
+ # @note Prior to SketchUp 2025.0 this method returned the size as physical
1404
+ # screen coordinates. As of SketchUp 2025.0 the size are returned in
1405
+ # logical screen coordinates.
1406
+ #
1407
+ # @overload vpheight
1408
+ #
1409
+ # @note Signature for versions prior to SketchUp 2025.0
1410
+ # @version SketchUp 6.0
1411
+ # @return [Integer] the height of the viewport in physical pixels.
1412
+ #
1413
+ # @overload vpheight
1414
+ #
1415
+ # @version SketchUp 2025.0
1416
+ # @return [Float] the height of the viewport in logical pixels.
1192
1417
  #
1193
1418
  # @version SketchUp 6.0
1194
1419
  def vpheight
1195
1420
  end
1196
1421
 
1197
- # The vpwidth method is used to retrieve the width of the viewport for the
1422
+ # The {#vpwidth} method is used to retrieve the width of the viewport for the
1198
1423
  # view.
1199
1424
  #
1200
1425
  # @example
1426
+ # view = Sketchup.active_model.active_view
1201
1427
  # width = view.vpwidth
1202
1428
  #
1203
- # @return [Integer] the width of the viewport in physical pixels.
1429
+ # @note Prior to SketchUp 2025.0 this method returned the size as physical
1430
+ # screen coordinates. As of SketchUp 2025.0 the size are returned in
1431
+ # logical screen coordinates.
1432
+ #
1433
+ # @overload vpwidth
1434
+ #
1435
+ # @note Signature for versions prior to SketchUp 2025.0
1436
+ # @version SketchUp 6.0
1437
+ # @return [Integer] the width of the viewport in physical pixels.
1438
+ #
1439
+ # @overload vpwidth
1440
+ #
1441
+ # @version SketchUp 2025.0
1442
+ # @return [Float] the width of the viewport in logical pixels.
1204
1443
  #
1205
1444
  # @version SketchUp 6.0
1206
1445
  def vpwidth
@@ -1208,11 +1447,12 @@ class Sketchup::View
1208
1447
 
1209
1448
  # The {#write_image} method is used to write the current view to an image file.
1210
1449
  #
1211
- # Supported file types are `.png`, `.jpg`, `.jpeg`, `gif`, `.bmp`, `.tif`.
1212
- # For other file formats available from the GUI in File > Export > 2D
1213
- # Graphics, .e.g `.pdf`, use {Sketchup::Model#export}.
1450
+ # Supported file types are +.png+, +.jpg+, +.jpeg+, +gif+, +.bmp+, +.tif+.
1451
+ # For other file formats available from the GUI in +File > Export > 2D Graphics+,
1452
+ # .e.g +.pdf+, use {Sketchup::Model#export}.
1453
+ #
1454
+ # @overload write_image(filename, width = view.vpwidth, height = view.vpheight, antialias = false, compression = 1.0)
1214
1455
  #
1215
- # compression = 1.0)
1216
1456
  # @note Prefer the overload with option hash instead of this variant. This
1217
1457
  # overload is not updated with new options.
1218
1458
  #
@@ -1234,9 +1474,6 @@ class Sketchup::View
1234
1474
  # @param [Float] compression
1235
1475
  # Compression factor for JPEG images, between +0.0+ and +1.0+.
1236
1476
  #
1237
- # @overload write_image(filename, width = view.vpwidth, height = view.vpheight, antialias = false,
1238
- #
1239
- #
1240
1477
  # @overload write_image(options)
1241
1478
  #
1242
1479
  # @example