sketchup-api-stubs 0.7.10 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sketchup-api-stubs/sketchup.rb +12 -0
  3. data/lib/sketchup-api-stubs/stubs/Array.rb +5 -1
  4. data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +37 -13
  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 +63 -40
  9. data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +145 -109
  10. data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +56 -30
  11. data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +81 -52
  12. data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +45 -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 +212 -224
  16. data/lib/sketchup-api-stubs/stubs/Geom.rb +8 -6
  17. data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +5 -5
  18. data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +54 -52
  19. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +13 -8
  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 +125 -11
  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 +7 -9
  28. data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +1 -1
  29. data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +54 -4
  30. data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +9 -11
  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 +6 -4
  42. data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +1 -1
  43. data/lib/sketchup-api-stubs/stubs/Layout/ReferenceEntity.rb +9 -11
  44. data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +7 -10
  45. data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +48 -2
  46. data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +18 -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 +110 -22
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +18 -12
  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/CRSLocation.rb +402 -0
  61. data/lib/sketchup-api-stubs/stubs/Sketchup/CRSMapUnit.rb +83 -0
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +10 -15
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +1 -1
  64. data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +2 -2
  65. data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +1 -1
  66. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +247 -21
  67. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +100 -24
  68. data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +1 -1
  69. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +7 -12
  70. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +1 -1
  71. data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +12 -10
  72. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +9 -11
  73. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +1 -1
  74. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +1 -1
  75. data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +23 -21
  76. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +36 -28
  77. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +1 -1
  78. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +11 -12
  79. data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +11 -14
  80. data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +2 -2
  81. data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +10 -10
  82. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +237 -49
  83. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +1 -1
  84. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +1 -6
  85. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +10 -3
  86. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +1 -6
  87. data/lib/sketchup-api-stubs/stubs/Sketchup/Environment.rb +406 -0
  88. data/lib/sketchup-api-stubs/stubs/Sketchup/Environments.rb +185 -0
  89. data/lib/sketchup-api-stubs/stubs/Sketchup/EnvironmentsObserver.rb +113 -0
  90. data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +3 -6
  91. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +104 -33
  92. data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +2 -2
  93. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +116 -45
  94. data/lib/sketchup-api-stubs/stubs/Sketchup/HatchPattern.rb +277 -0
  95. data/lib/sketchup-api-stubs/stubs/Sketchup/HatchPatternData.rb +245 -0
  96. data/lib/sketchup-api-stubs/stubs/Sketchup/HatchPatterns.rb +155 -0
  97. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +24 -17
  98. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +11 -9
  99. data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +1 -1
  100. data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +6 -69
  101. data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +2 -2
  102. data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +2 -2
  103. data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +34 -8
  104. data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +1 -1
  105. data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +148 -3
  106. data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +20 -8
  107. data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +15 -45
  108. data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +3 -23
  109. data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +1 -9
  110. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +1 -1
  111. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +10 -3
  112. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +1 -1
  113. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +1 -1
  114. data/lib/sketchup-api-stubs/stubs/Sketchup/LoadHandler.rb +70 -0
  115. data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +1 -1
  116. data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +894 -130
  117. data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +39 -26
  118. data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +1 -1
  119. data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +1 -1
  120. data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +253 -108
  121. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +150 -9
  122. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +14 -11
  123. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +1 -1
  124. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +1 -2
  125. data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +17 -44
  126. data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +1 -13
  127. data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +247 -93
  128. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +58 -31
  129. data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +1 -1
  130. data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +61 -40
  131. data/lib/sketchup-api-stubs/stubs/Sketchup/Procedure.rb +452 -0
  132. data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +1 -1
  133. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +40 -2
  134. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +1 -1
  135. data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +31 -1
  136. data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +84 -91
  137. data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +1 -1
  138. data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +1 -2
  139. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +22 -16
  140. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +1 -1
  141. data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +1 -1
  142. data/lib/sketchup-api-stubs/stubs/Sketchup/Snap.rb +125 -0
  143. data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +36 -1
  144. data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +59 -13
  145. data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +103 -8
  146. data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +13 -31
  147. data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +9 -9
  148. data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +276 -145
  149. data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +1 -1
  150. data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +26 -13
  151. data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +1 -1
  152. data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +23 -22
  153. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +411 -118
  154. data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +34 -8
  155. data/lib/sketchup-api-stubs/stubs/Sketchup.rb +126 -40
  156. data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +83 -69
  157. data/lib/sketchup-api-stubs/stubs/String.rb +1 -1
  158. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +120 -153
  159. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +130 -14
  160. data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +14 -3
  161. data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +20 -3
  162. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +13 -7
  163. data/lib/sketchup-api-stubs/stubs/UI.rb +92 -22
  164. data/lib/sketchup-api-stubs/stubs/_top_level.rb +15 -7
  165. metadata +16 -28
@@ -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 {#Geom::PolygonMesh} class contains methods to create polygon mesh
@@ -15,7 +15,7 @@
15
15
  #
16
16
  # @example
17
17
  # entities = Sketchup.active_model.active_entities
18
- # face = entities.grep(Sketchup::Face).first
18
+ # face = entities.add_face([1, 1, 1], [1, 2, 1], [2, 2, 1])
19
19
  #
20
20
  # mesh = face.mesh
21
21
  #
@@ -80,7 +80,6 @@ class Geom::PolygonMesh
80
80
  # Adds a polygon from a list of the mesh's vertex indices.
81
81
  # @example
82
82
  # mesh = Geom::PolygonMesh.new
83
- # # add points to mesh...
84
83
  # mesh.add_point(Geom::Point3d.new(0, 0, 0))
85
84
  # mesh.add_point(Geom::Point3d.new(1, 0, 0))
86
85
  # mesh.add_point(Geom::Point3d.new(1, 1, 0))
@@ -95,7 +94,6 @@ class Geom::PolygonMesh
95
94
  # Adds a polygon from an Array of the mesh's vertex indices.
96
95
  # @example
97
96
  # mesh = Geom::PolygonMesh.new
98
- # # add points to mesh...
99
97
  # mesh.add_point(Geom::Point3d.new(0, 0, 0))
100
98
  # mesh.add_point(Geom::Point3d.new(1, 0, 0))
101
99
  # mesh.add_point(Geom::Point3d.new(1, 1, 0))
@@ -143,7 +141,7 @@ class Geom::PolygonMesh
143
141
  # mesh = Geom::PolygonMesh.new
144
142
  # point = Geom::Point3d.new(0, 1, 2)
145
143
  # mesh.add_point(point)
146
- # num = mesh.count_points
144
+ # number_points = mesh.count_points
147
145
  #
148
146
  # @return [Integer] the number of points in a mesh
149
147
  #
@@ -159,7 +157,7 @@ class Geom::PolygonMesh
159
157
  # point2 = Geom::Point3d.new(1, 0, 2)
160
158
  # point3 = Geom::Point3d.new(2, 0, 1)
161
159
  # mesh.add_polygon(point1, point2, point3)
162
- # nump = mesh.count_polygons
160
+ # number_polygons = mesh.count_polygons
163
161
  #
164
162
  # @return [Integer] the number of polygons in the mesh
165
163
  #
@@ -188,15 +186,15 @@ class Geom::PolygonMesh
188
186
  #
189
187
  # @return [Geom::PolygonMesh]
190
188
  #
191
- # @overload initialize(numpts)
189
+ # @overload initialize(number_points)
192
190
  #
193
- # @param [Integer] numpts How many points will be in the mesh.
191
+ # @param [Integer] number_points How many points will be in the mesh.
194
192
  # @return [Geom::PolygonMesh]
195
193
  #
196
- # @overload initialize(numpts, numpolys)
194
+ # @overload initialize(number_points, number_polygons)
197
195
  #
198
- # @param [Integer] numpts How many points will be in the mesh.
199
- # @param [Integer] numpolys How many polygons will be in the mesh.
196
+ # @param [Integer] number_points How many points will be in the mesh.
197
+ # @param [Integer] number_polygons How many polygons will be in the mesh.
200
198
  # @return [Geom::PolygonMesh]
201
199
  #
202
200
  # @raise [RangeError] If number of points or polygons are negative numbers.
@@ -210,8 +208,13 @@ class Geom::PolygonMesh
210
208
  # {Sketchup::Face#mesh} with the +PolygonMeshNormals+ flag.
211
209
  #
212
210
  # @example
211
+ # model = Sketchup.active_model
212
+ # entity = model.active_entities
213
+ # face = entity.add_face([1, 1, 1], [2, 2, 1], [2, 1, 1])
214
+ #
213
215
  # flags = 4 # PolygonMeshNormals
214
216
  # mesh = face.mesh(flags)
217
+ # # The result is a Vector3d(0, 0, -1)
215
218
  # normal = mesh.normal_at(1)
216
219
  #
217
220
  # @note Index starts at 1.
@@ -310,7 +313,7 @@ class Geom::PolygonMesh
310
313
  # @param [Integer] index
311
314
  # The index of the desired polygon.
312
315
  #
313
- # @return [Array<Geom::Point3d>, nil]
316
+ # @return [Array<Integer>, nil]
314
317
  #
315
318
  # @version SketchUp 6.0
316
319
  def polygon_at(index)
@@ -346,7 +349,14 @@ class Geom::PolygonMesh
346
349
  # indicates that the edge from +1+ to +2+ is hidden.
347
350
  #
348
351
  # @example
349
- # polygons = polygonmesh.polygons
352
+ # mesh = Geom::PolygonMesh.new
353
+ # mesh.add_point([0, 0, 0])
354
+ # mesh.add_point([1, 0, 0])
355
+ # mesh.add_point([1, 1, 0])
356
+ #
357
+ # mesh.add_polygon(1, 2, 3)
358
+ # mesh.add_polygon(-1, 3, 2)
359
+ # polygons = mesh.polygons
350
360
  #
351
361
  # @return [Array<Array<Integer>>]
352
362
  #
@@ -395,26 +405,25 @@ class Geom::PolygonMesh
395
405
  #
396
406
  # @example
397
407
  # mesh = Geom::PolygonMesh.new(4)
398
- # # Create points for a triangle.
399
408
  # point1 = Geom::Point3d.new(0, 0, 0)
400
409
  # point2 = Geom::Point3d.new(9, 0, 0)
401
410
  # point3 = Geom::Point3d.new(9, 9, 0)
402
411
  # point4 = Geom::Point3d.new(0, 9, 0)
403
- # # Create UV mapping to tile 2x cross triangle.
404
- # uv1 = Geom::Point3d.new(0, 0, 0)
405
- # uv2 = Geom::Point3d.new(2, 0, 0)
406
- # uv3 = Geom::Point3d.new(2, 2, 0)
407
- # uv4 = Geom::Point3d.new(0, 2, 0)
408
- # # Add points and UV data to mesh.
412
+ #
413
+ # uv_point1 = Geom::Point3d.new(0, 0, 0)
414
+ # uv_point2 = Geom::Point3d.new(2, 0, 0)
415
+ # uv_point3 = Geom::Point3d.new(2, 2, 0)
416
+ # uv_point4 = Geom::Point3d.new(0, 2, 0)
417
+ #
409
418
  # index1 = mesh.add_point(point1)
410
419
  # index2 = mesh.add_point(point2)
411
420
  # index3 = mesh.add_point(point3)
412
421
  # index4 = mesh.add_point(point4)
413
- # mesh.set_uv(index1, uv1, true)
414
- # mesh.set_uv(index2, uv2, true)
415
- # mesh.set_uv(index3, uv3, true)
416
- # mesh.set_uv(index4, uv4, true)
417
- # # Add polygons.
422
+ # mesh.set_uv(index1, uv_point1, true)
423
+ # mesh.set_uv(index2, uv_point2, true)
424
+ # mesh.set_uv(index3, uv_point3, true)
425
+ # mesh.set_uv(index4, uv_point4, true)
426
+ #
418
427
  # mesh.add_polygon(index1, index2, index3)
419
428
  # mesh.add_polygon(index1, index3, index4)
420
429
  #
@@ -442,11 +451,12 @@ class Geom::PolygonMesh
442
451
  #
443
452
  # @example
444
453
  # point1 = Geom::Point3d.new(100, 200, 300)
445
- # tr = Geom::Transformation.new(point1)
454
+ # transformation = Geom::Transformation.new(point1)
446
455
  # mesh = Geom::PolygonMesh.new
447
456
  # point2 = Geom::Point3d.new(0, 1, 2)
448
457
  # mesh.add_point(point2)
449
- # mesh.transform!(tr)
458
+ # # The PolygonMesh contains a Point3d(100, 201, 302)
459
+ # mesh.transform!(transformation)
450
460
  #
451
461
  # @param [Geom::Transformation] transformation
452
462
  #
@@ -471,7 +481,12 @@ class Geom::PolygonMesh
471
481
  # referred to as UV mapping.
472
482
  #
473
483
  # @example
474
- # point = mesh.uv_at(1, true)
484
+ # mesh = Geom::PolygonMesh.new
485
+ # index = mesh.add_point([2, 2, 2])
486
+ # uv_point = Geom::Point3d.new(1, 1, 0)
487
+ #
488
+ # mesh.set_uv(index, uv_point, true)
489
+ # point = mesh.uv_at(index, true)
475
490
  #
476
491
  # @note Index starts at 1.
477
492
  #
@@ -494,9 +509,20 @@ class Geom::PolygonMesh
494
509
  # mesh.
495
510
  #
496
511
  # @example
497
- # # Get a mesh with front and back UVs.
512
+ # model = Sketchup.active_model
513
+ # entity = model.active_entities
514
+ #
515
+ # face = entity.add_face([1, 1, 1], [1, 3, 1], [3, 3, 1])
498
516
  # mesh = face.mesh(1 | 2)
499
- # uvs = mesh.uvs(true)
517
+ #
518
+ # uv_point1 = Geom::Point3d.new(0, 0, 0)
519
+ # uv_point2 = Geom::Point3d.new(1, 0, 0)
520
+ # uv_point3 = Geom::Point3d.new(1, 1, 0)
521
+ # mesh.set_uv(1, uv_point1, true)
522
+ # mesh.set_uv(2, uv_point2, true)
523
+ # mesh.set_uv(3, uv_point3, true)
524
+ #
525
+ # uv_points = mesh.uvs(true)
500
526
  #
501
527
  # @param [Boolean] front
502
528
  #
@@ -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
  # Transformations are a standard construct in the 3D world for representing
@@ -11,6 +11,11 @@
11
11
  # transformations in 3 dimensions which is covered extensively on
12
12
  # the internet.
13
13
  #
14
+ # @note Translation convenience: In contexts expecting a pure translation,
15
+ # you can pass a {Geom::Point3d}, {Geom::Vector3d}, or a 3-element
16
+ # Array [dx, dy, dz] and it will be converted to a translation
17
+ # {Geom::Transformation}. For full matrices, pass a 16-element Array.
18
+ #
14
19
  # @version SketchUp 6.0
15
20
  class Geom::Transformation
16
21
 
@@ -24,7 +29,7 @@ class Geom::Transformation
24
29
  # # Creates a transformation that "flips" the axes from XYZ to XZY. Something
25
30
  # # one often need for importers/exporters when dealing with applications
26
31
  # # that threat Y as "up".
27
- # tr = Geom::Transformation.axes(ORIGIN, X_AXIS, Z_AXIS, Y_AXIS.reverse)
32
+ # transformation = Geom::Transformation.axes(ORIGIN, X_AXIS, Z_AXIS, Y_AXIS.reverse)
28
33
  #
29
34
  # @overload axes(origin, xaxis, yaxis, zaxis)
30
35
  #
@@ -52,31 +57,31 @@ class Geom::Transformation
52
57
  # The {.interpolate} method is used to create a new transformation that is the
53
58
  # result of interpolating between two other transformations.
54
59
  #
55
- # Parameter is a weight (between `0.0` and `1.0`) that identifies whether to favor
56
- # `transformation1` or `transformation2`.
60
+ # Parameter weight is a value (between 0.0 and 1.0) that represents the percentage given to
61
+ # `transformation1` and `transformation2`.
57
62
  #
58
63
  # @example
59
64
  # origin = Geom::Point3d.new(0, 0, 0)
60
- # x = Geom::Vector3d.new(0, 1, 0)
61
- # y = Geom::Vector3d.new(1, 0, 0)
62
- # z = Geom::Vector3d.new(0, 0, 1)
65
+ # xaxis = Geom::Vector3d.new(0, 1, 0)
66
+ # yaxis = Geom::Vector3d.new(1, 0, 0)
67
+ # zaxis = Geom::Vector3d.new(0, 0, 1)
63
68
  # point = Geom::Point3d.new(10, 20, 30)
64
- # t1 = Geom::Transformation.new(point)
65
- # t2 = Geom::Transformation.axes(origin, x, y, z)
66
- # # This produce a transformation that is a mix of 75% t1 and 25% t2.
67
- # t3 = Geom::Transformation.interpolate(t1, t2, 0.25)
69
+ # transformation1 = Geom::Transformation.new(point)
70
+ # transformation2 = Geom::Transformation.axes(origin, xaxis, yaxis, zaxis)
71
+ # # This produce a transformation that is a mix of 75% transformation1 and 25% transformation2.
72
+ # new_transformation = Geom::Transformation.interpolate(transformation1, transformation2, 0.25)
68
73
  #
69
- # @param [Geom::Transformation] transform1
74
+ # @param [Geom::Transformation] transformation1
70
75
  #
71
- # @param [Geom::Transformation] transform2
76
+ # @param [Geom::Transformation] transformation2
72
77
  #
73
78
  # @param [Float] weight
74
- # A value between 0.0 and 1.0 (see comments).
79
+ # A value between 0.0 and 1.0.
75
80
  #
76
81
  # @return [Geom::Transformation]
77
82
  #
78
83
  # @version SketchUp 6.0
79
- def self.interpolate(transform1, transform2, weight)
84
+ def self.interpolate(transformation1, transformation2, weight)
80
85
  end
81
86
 
82
87
  # The {.rotation} method is used to create a transformation that does rotation
@@ -108,7 +113,7 @@ class Geom::Transformation
108
113
  # @example
109
114
  # point = Geom::Point3d.new(20, 30, 0)
110
115
  # scale = 10
111
- # tr = Geom::Transformation.scaling(point, scale)
116
+ # transformation = Geom::Transformation.scaling(point, scale)
112
117
  #
113
118
  # @overload scaling(scale)
114
119
  #
@@ -154,7 +159,7 @@ class Geom::Transformation
154
159
  #
155
160
  # @example
156
161
  # vector = Geom::Vector3d.new(0, 1, 0)
157
- # tr = Geom::Transformation.translation(vector)
162
+ # transformation = Geom::Transformation.translation(vector)
158
163
  #
159
164
  # @overload translation(vector)
160
165
  #
@@ -177,9 +182,9 @@ class Geom::Transformation
177
182
  # @example
178
183
  # point1 = Geom::Point3d.new(10, 20, 30)
179
184
  # point2 = Geom::Point3d.new(2, 2, 2)
180
- # tr = Geom::Transformation.new(point1)
181
- # # Returns Point3d(12, 22, 32)
182
- # point3 = tr * point2
185
+ # transformation = Geom::Transformation.new(point1)
186
+ # # The result is a Point3d(12, 22, 32)
187
+ # new_point = transformation * point2
183
188
  #
184
189
  # @overload *(point)
185
190
  #
@@ -219,8 +224,8 @@ class Geom::Transformation
219
224
  #
220
225
  # @example
221
226
  # point = Geom::Point3d.new(10, 20, 30)
222
- # tr1 = Geom::Transformation.new(point)
223
- # tr2 = tr1.clone
227
+ # transformation = Geom::Transformation.new(point)
228
+ # new_transformation = transformation.clone
224
229
  #
225
230
  # @return [Geom::Transformation]
226
231
  #
@@ -233,22 +238,22 @@ class Geom::Transformation
233
238
  #
234
239
  # @example
235
240
  # point = Geom::Point3d.new(10, 20, 30)
236
- # tr = Geom::Transformation.new(point)
237
- # # Returns false.
238
- # status = tr.identity?
241
+ # transformation = Geom::Transformation.new(point)
242
+ # # Returns false
243
+ # status = transformation.identity?
239
244
  #
240
245
  # @example
241
- # tr = Geom::Transformation.new(ORIGIN)
242
- # # Returns false.
243
- # status = tr.identity?
246
+ # transformation = Geom::Transformation.new(ORIGIN)
247
+ # # Returns true
248
+ # status = transformation.identity?
244
249
  #
245
250
  # @example
246
- # tr = Geom::Transformation.new
247
- # # Returns true.
248
- # status = tr.identity?
251
+ # transformation = Geom::Transformation.new
252
+ # # Returns true
253
+ # status = transformation.identity?
249
254
  #
250
255
  # @example
251
- # # Returns true.
256
+ # # Returns true
252
257
  # status = IDENTITY.identity?
253
258
  #
254
259
  # @note As of SketchUp 2018, this now looks at the data to determine if the
@@ -267,7 +272,18 @@ class Geom::Transformation
267
272
  #
268
273
  # @example
269
274
  # point = Geom::Point3d.new(10, 20, 30)
270
- # tr = Geom::Transformation.new(point)
275
+ # transformation = Geom::Transformation.new(point)
276
+ #
277
+ # @example
278
+ # origin = Geom::Point3d.new(10, 10, 10)
279
+ # zaxis = Geom::Vector3d.new(1, 2, 3)
280
+ # transformation = Geom::Transformation.new(origin, zaxis)
281
+ #
282
+ # @example
283
+ # origin = Geom::Point3d.new(1, 1, 1)
284
+ # axis = Geom::Vector3d.new(1, 0, 0)
285
+ # angle = 45.degrees # Return 45 degrees in radians.
286
+ # transformation = Geom::Transformation.new(origin, axis, angle)
271
287
  #
272
288
  # @overload initialize
273
289
  #
@@ -306,8 +322,8 @@ class Geom::Transformation
306
322
  #
307
323
  # @overload initialize(origin, zaxis)
308
324
  #
309
- # Creates a Transformation where origin is the new origin, and zaxis is the
310
- # z axis. The x and y axes are determined using an arbitrary axis rule.
325
+ # Creates a Transformation where origin is the new origin, and z axis is the
326
+ # new z axis. The x and y axes are determined using an arbitrary axis rule.
311
327
  # @param [Geom::Point3d] origin
312
328
  # @param [Geom::Vector3d] zaxis
313
329
  # @return [Geom::Transformation]
@@ -345,8 +361,14 @@ class Geom::Transformation
345
361
  #
346
362
  # @example
347
363
  # point = Geom::Point3d.new(10, 20, 30)
348
- # tr1 = Geom::Transformation.new(point)
349
- # tr2 = tr1.inverse
364
+ # transformation = Geom::Transformation.new(point)
365
+ # new_transformation = transformation.inverse
366
+ #
367
+ # @note As of SketchUp 2026, this will raise an error if the
368
+ # {Geom::Transformation} is not invertible. Prior to 2026 this would silently attempt
369
+ # to invert the transformation possibly returning in an invalid transformation.
370
+ #
371
+ # @raise ArgumentError if the {Geom::Transformation} is not invertible (as of Sketchup 2026)
350
372
  #
351
373
  # @return [Geom::Transformation]
352
374
  #
@@ -358,8 +380,14 @@ class Geom::Transformation
358
380
  #
359
381
  # @example
360
382
  # point = Geom::Point3d.new(10, 20, 30)
361
- # tr = Geom::Transformation.new(point)
362
- # tr.invert!
383
+ # transformation = Geom::Transformation.new(point)
384
+ # new_transformation = transformation.invert!
385
+ #
386
+ # @note As of SketchUp 2026, this will raise an error if the
387
+ # {Geom::Transformation} is not invertible. Prior to 2026 this would silently attempt
388
+ # to invert the transformation possibly creating in an invalid transformation.
389
+ #
390
+ # @raise ArgumentError if the {Geom::Transformation} is not invertible (as of Sketchup 2026)
363
391
  #
364
392
  # @return [Geom::Transformation]
365
393
  #
@@ -370,9 +398,9 @@ class Geom::Transformation
370
398
  # The {#origin} method retrieves the origin of a rigid transformation.
371
399
  #
372
400
  # @example
373
- # point1 = Geom::Point3d.new(10, 20, 30)
374
- # tr = Geom::Transformation.new(point1)
375
- # point2 = tr.origin
401
+ # point = Geom::Point3d.new(10, 20, 30)
402
+ # transformation = Geom::Transformation.new(point)
403
+ # new_point = transformation.origin
376
404
  #
377
405
  # @return [Geom::Point3d] the origin of the transformation.
378
406
  #
@@ -386,9 +414,9 @@ class Geom::Transformation
386
414
  #
387
415
  # @example
388
416
  # point1 = Geom::Point3d.new(10, 20, 30)
389
- # tr1 = Geom::Transformation.new(point)
417
+ # transformation = Geom::Transformation.new(point1)
390
418
  # point2 = Geom::Point3d.new(60, 40, 70)
391
- # tr1.set!(point2)
419
+ # transformation.set!(point2)
392
420
  #
393
421
  # @overload set!(transformation)
394
422
  #
@@ -424,9 +452,10 @@ class Geom::Transformation
424
452
  #
425
453
  # @example
426
454
  # point = Geom::Point3d.new(10, 20, 30)
427
- # tr = Geom::Transformation.new(point)
455
+ # transformation = Geom::Transformation.new(point)
428
456
  # # This splits the 16 items into a string of 4x4 elements for easier reading.
429
- # str4x4 = tr.to_a.each_slice(4).inject { |str, row| "#{str}\r\n#{row}" }
457
+ # matrix = transformation.to_a.each_slice(4).inject { |str, row|"#{str}\r\n#{row}"}
458
+ # puts matrix
430
459
  #
431
460
  # @return [Array<Float>]
432
461
  #
@@ -438,8 +467,8 @@ class Geom::Transformation
438
467
  #
439
468
  # @example
440
469
  # point = Geom::Point3d.new(10, 20, 30)
441
- # tr = Geom::Transformation.new(point)
442
- # x = tr.xaxis
470
+ # transformation = Geom::Transformation.new(point)
471
+ # x = transformation.xaxis
443
472
  #
444
473
  # @return [Geom::Vector3d]
445
474
  #
@@ -451,8 +480,8 @@ class Geom::Transformation
451
480
  #
452
481
  # @example
453
482
  # point = Geom::Point3d.new(10, 20, 30)
454
- # tr = Geom::Transformation.new(point)
455
- # x = tr.yaxis
483
+ # transformation = Geom::Transformation.new(point)
484
+ # y = transformation.yaxis
456
485
  #
457
486
  # @return [Geom::Vector3d]
458
487
  #
@@ -464,8 +493,8 @@ class Geom::Transformation
464
493
  #
465
494
  # @example
466
495
  # point = Geom::Point3d.new(10, 20, 30)
467
- # tr = Geom::Transformation.new(point)
468
- # x = tr.zaxis
496
+ # transformation = Geom::Transformation.new(point)
497
+ # z = transformation.zaxis
469
498
  #
470
499
  # @return [Geom::Vector3d]
471
500
  #
@@ -1,6 +1,16 @@
1
- # Copyright:: Copyright 2024 Trimble Inc.
1
+ # Copyright:: Copyright 2026 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
+ # {Geom::Transformation2d} represents 2D affine transforms used by LayOut.
5
+ # The internal representation is a 2x3 matrix +[m11, m12, m21, m22, tx, ty]+.
6
+ # Use {.translation}, {.rotation}, and {.scaling} to construct common transforms,
7
+ # or pass a 6-element Array to {.new} or {#set!} for a custom matrix.
8
+ #
9
+ # @see Geom::Point2d
10
+ #
11
+ # @see Geom::Vector2d
12
+ #
13
+ # @see IDENTITY_2D
4
14
  #
5
15
  # @version LayOut 2018
6
16
  class Geom::Transformation2d
@@ -29,9 +39,9 @@ class Geom::Transformation2d
29
39
  # The {.scaling} method is used to create a transformation that does scaling.
30
40
  #
31
41
  # @example
32
- # point = Geom::Point3d.new(20, 30, 0)
42
+ # point = Geom::Point2d.new(20, 30)
33
43
  # scale = 10
34
- # tr = Geom::Transformation2d.scaling(point, scale)
44
+ # transformation = Geom::Transformation2d.scaling(point, scale)
35
45
  #
36
46
  # @overload scaling(scale)
37
47
  #
@@ -70,7 +80,7 @@ class Geom::Transformation2d
70
80
  #
71
81
  # @example
72
82
  # vector = Geom::Vector2d.new(0, 1)
73
- # tr = Geom::Transformation2d.translation(vector)
83
+ # transformation = Geom::Transformation2d.translation(vector)
74
84
  #
75
85
  # @overload translation(vector)
76
86
  #
@@ -93,9 +103,9 @@ class Geom::Transformation2d
93
103
  # @example
94
104
  # point1 = Geom::Point2d.new(5, 10)
95
105
  # point2 = Geom::Point2d.new(2, 2)
96
- # tr = Geom::Transformation2d.new(point1)
97
- # # Returns Point2d(7, 12)
98
- # point3 = tr * point2
106
+ # transformation = Geom::Transformation2d.translation(point1)
107
+ # # The result is a Point2d(7, 12)
108
+ # new_point = transformation * point2
99
109
  #
100
110
  # @overload *(point)
101
111
  #
@@ -114,8 +124,8 @@ class Geom::Transformation2d
114
124
  #
115
125
  # @overload *(point)
116
126
  #
117
- # @param [Array<Float, Float>] point
118
- # @return [Array<Float, Float>]
127
+ # @param [Array(Float, Float)] point
128
+ # @return [Array(Float, Float)]
119
129
  #
120
130
  # @version LayOut 2019
121
131
  def *(arg)
@@ -125,8 +135,10 @@ class Geom::Transformation2d
125
135
  # This checks whether the values of the transformations are the same.
126
136
  #
127
137
  # @example
128
- # tr = Geom::Transformation2d.new({1.0, 0.0, 0.0, 1.0, 1.0, 1.0})
129
- # tr == tr.clone
138
+ # transformation1 = Geom::Transformation2d.new([1.0, 0.0, 0.0, 1.0, 1.0, 1.0])
139
+ # transformation2 = Geom::Transformation2d.translation([1, 1])
140
+ # # Returns true
141
+ # transformation1 == transformation2
130
142
  #
131
143
  # @param [Geom::Transformation2d] other
132
144
  #
@@ -139,8 +151,8 @@ class Geom::Transformation2d
139
151
  # The {#clone} method creates a copy of the {Geom::Transformation2d}.
140
152
  #
141
153
  # @example
142
- # tr1 = Geom::Transformation2d.new
143
- # tr2 = tr1.clone
154
+ # transformation = Geom::Transformation2d.new
155
+ # new_transformation = transformation.clone
144
156
  #
145
157
  # @return [Geom::Transformation2d]
146
158
  #
@@ -152,18 +164,18 @@ class Geom::Transformation2d
152
164
  # {IDENTITY_2D} transform.
153
165
  #
154
166
  # @example
155
- # array = {1.0, 0.0, 0.0, 1.0, 1.0, 0.0}
156
- # tr = Geom::Transformation2d.new(array)
157
- # # Returns false.
158
- # status = tr.identity?
167
+ # array = [1.0, 0.0, 0.0, 1.0, 1.0, 0.0]
168
+ # transformation = Geom::Transformation2d.new(array)
169
+ # # Returns false
170
+ # status = transformation.identity?
159
171
  #
160
172
  # @example
161
- # tr = Geom::Transformation2d.new
162
- # # Returns true.
163
- # status = tr.identity?
173
+ # transformation = Geom::Transformation2d.new
174
+ # # Returns true
175
+ # status = transformation.identity?
164
176
  #
165
177
  # @example
166
- # # Returns true.
178
+ # # Returns true
167
179
  # status = IDENTITY_2D.identity?
168
180
  #
169
181
  # @return [Boolean] +true+ if the transform is the identity
@@ -177,7 +189,9 @@ class Geom::Transformation2d
177
189
  # of {Geom::Transformation2d}.
178
190
  #
179
191
  # @example
180
- # tr = Geom::Transformation2d.new({1.0, 0.0, 0.0, 1.0, 1.0, 1.0})
192
+ # transformation1 = Geom::Transformation2d.new
193
+ #
194
+ # transformation2 = Geom::Transformation2d.new([1.0, 0.0, 0.0, 1.0, 1.0, 1.0])
181
195
  #
182
196
  # @overload initialize
183
197
  #
@@ -203,8 +217,8 @@ class Geom::Transformation2d
203
217
  #
204
218
  # @example
205
219
  # point = Geom::Point2d.new(5, 10)
206
- # tr1 = Geom::Transformation2d.new(point)
207
- # tr2 = tr1.inverse
220
+ # transformation = Geom::Transformation2d.translation(point)
221
+ # new_transformation = transformation.inverse
208
222
  #
209
223
  # @return [Geom::Transformation2d]
210
224
  #
@@ -216,8 +230,8 @@ class Geom::Transformation2d
216
230
  #
217
231
  # @example
218
232
  # point = Geom::Point2d.new(5, 10)
219
- # tr = Geom::Transformation2d.new(point)
220
- # tr.invert!
233
+ # transformation = Geom::Transformation2d.translation(point)
234
+ # transformation.invert!
221
235
  #
222
236
  # @return [Geom::Transformation2d]
223
237
  #
@@ -229,9 +243,9 @@ class Geom::Transformation2d
229
243
  # The argument is anything that can be converted into a {Geom::Transformation2d}.
230
244
  #
231
245
  # @example
232
- # tr1 = Geom::Transformation2d.new
233
- # array = {2.0, 0.0, 0.0, 2.0, 0.0, 0.0}
234
- # tr1.set!(array)
246
+ # transformation = Geom::Transformation2d.new
247
+ # matrix = [2.0, 0.0, 0.0, 2.0, 0.0, 0.0]
248
+ # transformation.set!(matrix)
235
249
  #
236
250
  # @overload set!(transformation)
237
251
  #
@@ -251,8 +265,8 @@ class Geom::Transformation2d
251
265
  # define the Transformation2d.
252
266
  #
253
267
  # @example
254
- # tr = Geom::Transformation2d.new
255
- # tr.to_a.each_slice(2) {|a| p a}
268
+ # transformation = Geom::Transformation2d.new
269
+ # transformation.to_a.each_slice(2) {|a| p a}
256
270
  #
257
271
  # @return [Array<Float>] an array of 6 elements
258
272
  #