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.
- checksums.yaml +4 -4
- data/lib/sketchup-api-stubs/sketchup.rb +6 -0
- data/lib/sketchup-api-stubs/stubs/Array.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +25 -15
- data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +17 -32
- data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +62 -39
- data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +136 -104
- data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +56 -30
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +76 -52
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +35 -31
- data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +8 -16
- data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +135 -110
- data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +207 -222
- data/lib/sketchup-api-stubs/stubs/Geom.rb +6 -6
- data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +11 -7
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Dictionary.rb +234 -0
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +124 -10
- data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +112 -4
- data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +4 -4
- data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +56 -9
- data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +100 -1
- data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +13 -14
- data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +5 -3
- data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/ReferenceEntity.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +47 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Length.rb +9 -1
- data/lib/sketchup-api-stubs/stubs/Numeric.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +65 -13
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +2 -7
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +16 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +13 -13
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +8 -14
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +10 -15
- data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +28 -14
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +15 -8
- data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +7 -12
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +4 -10
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +17 -15
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +17 -17
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +3 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +11 -14
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +10 -10
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +59 -19
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +3 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Environment.rb +406 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Environments.rb +185 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/EnvironmentsObserver.rb +113 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +3 -6
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +94 -25
- data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +16 -26
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +24 -17
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +11 -9
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +4 -67
- data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +34 -8
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +4 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +14 -8
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +3 -45
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +1 -19
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +1 -9
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +10 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/LoadHandler.rb +70 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +831 -130
- data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +35 -22
- data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +146 -88
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +20 -5
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +14 -11
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +17 -44
- data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +1 -13
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +158 -16
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +48 -21
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +61 -40
- data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +13 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +84 -91
- data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +1 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +9 -5
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Snap.rb +125 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +20 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +59 -13
- data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +29 -8
- data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +13 -31
- data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +9 -9
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +229 -139
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +23 -22
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +336 -99
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +34 -8
- data/lib/sketchup-api-stubs/stubs/Sketchup.rb +71 -36
- data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +11 -11
- data/lib/sketchup-api-stubs/stubs/String.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +21 -9
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +80 -5
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +14 -3
- data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +20 -3
- data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +9 -6
- data/lib/sketchup-api-stubs/stubs/UI.rb +77 -14
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +7 -7
- metadata +10 -24
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright:: Copyright
|
|
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.
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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(
|
|
189
|
+
# @overload initialize(number_points)
|
|
192
190
|
#
|
|
193
|
-
# @param [Integer]
|
|
191
|
+
# @param [Integer] number_points How many points will be in the mesh.
|
|
194
192
|
# @return [Geom::PolygonMesh]
|
|
195
193
|
#
|
|
196
|
-
# @overload initialize(
|
|
194
|
+
# @overload initialize(number_points, number_polygons)
|
|
197
195
|
#
|
|
198
|
-
# @param [Integer]
|
|
199
|
-
# @param [Integer]
|
|
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<
|
|
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
|
-
#
|
|
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
|
-
#
|
|
404
|
-
#
|
|
405
|
-
#
|
|
406
|
-
#
|
|
407
|
-
#
|
|
408
|
-
#
|
|
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,
|
|
414
|
-
# mesh.set_uv(index2,
|
|
415
|
-
# mesh.set_uv(index3,
|
|
416
|
-
# mesh.set_uv(index4,
|
|
417
|
-
#
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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
|
|
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
|
|
@@ -24,7 +24,7 @@ class Geom::Transformation
|
|
|
24
24
|
# # Creates a transformation that "flips" the axes from XYZ to XZY. Something
|
|
25
25
|
# # one often need for importers/exporters when dealing with applications
|
|
26
26
|
# # that threat Y as "up".
|
|
27
|
-
#
|
|
27
|
+
# transformation = Geom::Transformation.axes(ORIGIN, X_AXIS, Z_AXIS, Y_AXIS.reverse)
|
|
28
28
|
#
|
|
29
29
|
# @overload axes(origin, xaxis, yaxis, zaxis)
|
|
30
30
|
#
|
|
@@ -52,31 +52,31 @@ class Geom::Transformation
|
|
|
52
52
|
# The {.interpolate} method is used to create a new transformation that is the
|
|
53
53
|
# result of interpolating between two other transformations.
|
|
54
54
|
#
|
|
55
|
-
# Parameter is a
|
|
56
|
-
# `transformation1`
|
|
55
|
+
# Parameter weight is a value (between 0.0 and 1.0) that represents the percentage given to
|
|
56
|
+
# `transformation1` and `transformation2`.
|
|
57
57
|
#
|
|
58
58
|
# @example
|
|
59
59
|
# origin = Geom::Point3d.new(0, 0, 0)
|
|
60
|
-
#
|
|
61
|
-
#
|
|
62
|
-
#
|
|
60
|
+
# xaxis = Geom::Vector3d.new(0, 1, 0)
|
|
61
|
+
# yaxis = Geom::Vector3d.new(1, 0, 0)
|
|
62
|
+
# zaxis = Geom::Vector3d.new(0, 0, 1)
|
|
63
63
|
# point = Geom::Point3d.new(10, 20, 30)
|
|
64
|
-
#
|
|
65
|
-
#
|
|
66
|
-
# # This produce a transformation that is a mix of 75%
|
|
67
|
-
#
|
|
64
|
+
# transformation1 = Geom::Transformation.new(point)
|
|
65
|
+
# transformation2 = Geom::Transformation.axes(origin, xaxis, yaxis, zaxis)
|
|
66
|
+
# # This produce a transformation that is a mix of 75% transformation1 and 25% transformation2.
|
|
67
|
+
# new_transformation = Geom::Transformation.interpolate(transformation1, transformation2, 0.25)
|
|
68
68
|
#
|
|
69
|
-
# @param [Geom::Transformation]
|
|
69
|
+
# @param [Geom::Transformation] transformation1
|
|
70
70
|
#
|
|
71
|
-
# @param [Geom::Transformation]
|
|
71
|
+
# @param [Geom::Transformation] transformation2
|
|
72
72
|
#
|
|
73
73
|
# @param [Float] weight
|
|
74
|
-
# A value between 0.0 and 1.0
|
|
74
|
+
# A value between 0.0 and 1.0.
|
|
75
75
|
#
|
|
76
76
|
# @return [Geom::Transformation]
|
|
77
77
|
#
|
|
78
78
|
# @version SketchUp 6.0
|
|
79
|
-
def self.interpolate(
|
|
79
|
+
def self.interpolate(transformation1, transformation2, weight)
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
# The {.rotation} method is used to create a transformation that does rotation
|
|
@@ -108,7 +108,7 @@ class Geom::Transformation
|
|
|
108
108
|
# @example
|
|
109
109
|
# point = Geom::Point3d.new(20, 30, 0)
|
|
110
110
|
# scale = 10
|
|
111
|
-
#
|
|
111
|
+
# transformation = Geom::Transformation.scaling(point, scale)
|
|
112
112
|
#
|
|
113
113
|
# @overload scaling(scale)
|
|
114
114
|
#
|
|
@@ -154,7 +154,7 @@ class Geom::Transformation
|
|
|
154
154
|
#
|
|
155
155
|
# @example
|
|
156
156
|
# vector = Geom::Vector3d.new(0, 1, 0)
|
|
157
|
-
#
|
|
157
|
+
# transformation = Geom::Transformation.translation(vector)
|
|
158
158
|
#
|
|
159
159
|
# @overload translation(vector)
|
|
160
160
|
#
|
|
@@ -177,9 +177,9 @@ class Geom::Transformation
|
|
|
177
177
|
# @example
|
|
178
178
|
# point1 = Geom::Point3d.new(10, 20, 30)
|
|
179
179
|
# point2 = Geom::Point3d.new(2, 2, 2)
|
|
180
|
-
#
|
|
181
|
-
# #
|
|
182
|
-
#
|
|
180
|
+
# transformation = Geom::Transformation.new(point1)
|
|
181
|
+
# # The result is a Point3d(12, 22, 32)
|
|
182
|
+
# new_point = transformation * point2
|
|
183
183
|
#
|
|
184
184
|
# @overload *(point)
|
|
185
185
|
#
|
|
@@ -219,8 +219,8 @@ class Geom::Transformation
|
|
|
219
219
|
#
|
|
220
220
|
# @example
|
|
221
221
|
# point = Geom::Point3d.new(10, 20, 30)
|
|
222
|
-
#
|
|
223
|
-
#
|
|
222
|
+
# transformation = Geom::Transformation.new(point)
|
|
223
|
+
# new_transformation = transformation.clone
|
|
224
224
|
#
|
|
225
225
|
# @return [Geom::Transformation]
|
|
226
226
|
#
|
|
@@ -233,22 +233,22 @@ class Geom::Transformation
|
|
|
233
233
|
#
|
|
234
234
|
# @example
|
|
235
235
|
# point = Geom::Point3d.new(10, 20, 30)
|
|
236
|
-
#
|
|
237
|
-
# # Returns false
|
|
238
|
-
# status =
|
|
236
|
+
# transformation = Geom::Transformation.new(point)
|
|
237
|
+
# # Returns false
|
|
238
|
+
# status = transformation.identity?
|
|
239
239
|
#
|
|
240
240
|
# @example
|
|
241
|
-
#
|
|
242
|
-
# # Returns
|
|
243
|
-
# status =
|
|
241
|
+
# transformation = Geom::Transformation.new(ORIGIN)
|
|
242
|
+
# # Returns true
|
|
243
|
+
# status = transformation.identity?
|
|
244
244
|
#
|
|
245
245
|
# @example
|
|
246
|
-
#
|
|
247
|
-
# # Returns true
|
|
248
|
-
# status =
|
|
246
|
+
# transformation = Geom::Transformation.new
|
|
247
|
+
# # Returns true
|
|
248
|
+
# status = transformation.identity?
|
|
249
249
|
#
|
|
250
250
|
# @example
|
|
251
|
-
# # Returns true
|
|
251
|
+
# # Returns true
|
|
252
252
|
# status = IDENTITY.identity?
|
|
253
253
|
#
|
|
254
254
|
# @note As of SketchUp 2018, this now looks at the data to determine if the
|
|
@@ -267,7 +267,18 @@ class Geom::Transformation
|
|
|
267
267
|
#
|
|
268
268
|
# @example
|
|
269
269
|
# point = Geom::Point3d.new(10, 20, 30)
|
|
270
|
-
#
|
|
270
|
+
# transformation = Geom::Transformation.new(point)
|
|
271
|
+
#
|
|
272
|
+
# @example
|
|
273
|
+
# origin = Geom::Point3d.new(10, 10, 10)
|
|
274
|
+
# zaxis = Geom::Vector3d.new(1, 2, 3)
|
|
275
|
+
# transformation = Geom::Transformation.new(origin, zaxis)
|
|
276
|
+
#
|
|
277
|
+
# @example
|
|
278
|
+
# origin = Geom::Point3d.new(1, 1, 1)
|
|
279
|
+
# axis = Geom::Vector3d.new(1, 0, 0)
|
|
280
|
+
# angle = 45.degrees # Return 45 degrees in radians.
|
|
281
|
+
# transformation = Geom::Transformation.new(origin, axis, angle)
|
|
271
282
|
#
|
|
272
283
|
# @overload initialize
|
|
273
284
|
#
|
|
@@ -306,8 +317,8 @@ class Geom::Transformation
|
|
|
306
317
|
#
|
|
307
318
|
# @overload initialize(origin, zaxis)
|
|
308
319
|
#
|
|
309
|
-
# Creates a Transformation where origin is the new origin, and
|
|
310
|
-
# z axis. The x and y axes are determined using an arbitrary axis rule.
|
|
320
|
+
# Creates a Transformation where origin is the new origin, and z axis is the
|
|
321
|
+
# new z axis. The x and y axes are determined using an arbitrary axis rule.
|
|
311
322
|
# @param [Geom::Point3d] origin
|
|
312
323
|
# @param [Geom::Vector3d] zaxis
|
|
313
324
|
# @return [Geom::Transformation]
|
|
@@ -345,8 +356,14 @@ class Geom::Transformation
|
|
|
345
356
|
#
|
|
346
357
|
# @example
|
|
347
358
|
# point = Geom::Point3d.new(10, 20, 30)
|
|
348
|
-
#
|
|
349
|
-
#
|
|
359
|
+
# transformation = Geom::Transformation.new(point)
|
|
360
|
+
# new_transformation = transformation.inverse
|
|
361
|
+
#
|
|
362
|
+
# @note As of SketchUp 2026, this will raise an error if the
|
|
363
|
+
# {Geom::Transformation} is not invertible. Prior to 2026 this would silently attempt
|
|
364
|
+
# to invert the transformation possibly returning in an invalid transformation.
|
|
365
|
+
#
|
|
366
|
+
# @raise ArgumentError if the {Geom::Transformation} is not invertible (as of Sketchup 2026)
|
|
350
367
|
#
|
|
351
368
|
# @return [Geom::Transformation]
|
|
352
369
|
#
|
|
@@ -358,8 +375,14 @@ class Geom::Transformation
|
|
|
358
375
|
#
|
|
359
376
|
# @example
|
|
360
377
|
# point = Geom::Point3d.new(10, 20, 30)
|
|
361
|
-
#
|
|
362
|
-
#
|
|
378
|
+
# transformation = Geom::Transformation.new(point)
|
|
379
|
+
# new_transformation = transformation.invert!
|
|
380
|
+
#
|
|
381
|
+
# @note As of SketchUp 2026, this will raise an error if the
|
|
382
|
+
# {Geom::Transformation} is not invertible. Prior to 2026 this would silently attempt
|
|
383
|
+
# to invert the transformation possibly creating in an invalid transformation.
|
|
384
|
+
#
|
|
385
|
+
# @raise ArgumentError if the {Geom::Transformation} is not invertible (as of Sketchup 2026)
|
|
363
386
|
#
|
|
364
387
|
# @return [Geom::Transformation]
|
|
365
388
|
#
|
|
@@ -370,9 +393,9 @@ class Geom::Transformation
|
|
|
370
393
|
# The {#origin} method retrieves the origin of a rigid transformation.
|
|
371
394
|
#
|
|
372
395
|
# @example
|
|
373
|
-
#
|
|
374
|
-
#
|
|
375
|
-
#
|
|
396
|
+
# point = Geom::Point3d.new(10, 20, 30)
|
|
397
|
+
# transformation = Geom::Transformation.new(point)
|
|
398
|
+
# new_point = transformation.origin
|
|
376
399
|
#
|
|
377
400
|
# @return [Geom::Point3d] the origin of the transformation.
|
|
378
401
|
#
|
|
@@ -386,9 +409,9 @@ class Geom::Transformation
|
|
|
386
409
|
#
|
|
387
410
|
# @example
|
|
388
411
|
# point1 = Geom::Point3d.new(10, 20, 30)
|
|
389
|
-
#
|
|
412
|
+
# transformation = Geom::Transformation.new(point1)
|
|
390
413
|
# point2 = Geom::Point3d.new(60, 40, 70)
|
|
391
|
-
#
|
|
414
|
+
# transformation.set!(point2)
|
|
392
415
|
#
|
|
393
416
|
# @overload set!(transformation)
|
|
394
417
|
#
|
|
@@ -424,9 +447,10 @@ class Geom::Transformation
|
|
|
424
447
|
#
|
|
425
448
|
# @example
|
|
426
449
|
# point = Geom::Point3d.new(10, 20, 30)
|
|
427
|
-
#
|
|
450
|
+
# transformation = Geom::Transformation.new(point)
|
|
428
451
|
# # This splits the 16 items into a string of 4x4 elements for easier reading.
|
|
429
|
-
#
|
|
452
|
+
# matrix = transformation.to_a.each_slice(4).inject { |str, row|"#{str}\r\n#{row}"}
|
|
453
|
+
# puts matrix
|
|
430
454
|
#
|
|
431
455
|
# @return [Array<Float>]
|
|
432
456
|
#
|
|
@@ -438,8 +462,8 @@ class Geom::Transformation
|
|
|
438
462
|
#
|
|
439
463
|
# @example
|
|
440
464
|
# point = Geom::Point3d.new(10, 20, 30)
|
|
441
|
-
#
|
|
442
|
-
# x =
|
|
465
|
+
# transformation = Geom::Transformation.new(point)
|
|
466
|
+
# x = transformation.xaxis
|
|
443
467
|
#
|
|
444
468
|
# @return [Geom::Vector3d]
|
|
445
469
|
#
|
|
@@ -451,8 +475,8 @@ class Geom::Transformation
|
|
|
451
475
|
#
|
|
452
476
|
# @example
|
|
453
477
|
# point = Geom::Point3d.new(10, 20, 30)
|
|
454
|
-
#
|
|
455
|
-
#
|
|
478
|
+
# transformation = Geom::Transformation.new(point)
|
|
479
|
+
# y = transformation.yaxis
|
|
456
480
|
#
|
|
457
481
|
# @return [Geom::Vector3d]
|
|
458
482
|
#
|
|
@@ -464,8 +488,8 @@ class Geom::Transformation
|
|
|
464
488
|
#
|
|
465
489
|
# @example
|
|
466
490
|
# point = Geom::Point3d.new(10, 20, 30)
|
|
467
|
-
#
|
|
468
|
-
#
|
|
491
|
+
# transformation = Geom::Transformation.new(point)
|
|
492
|
+
# z = transformation.zaxis
|
|
469
493
|
#
|
|
470
494
|
# @return [Geom::Vector3d]
|
|
471
495
|
#
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright:: Copyright
|
|
1
|
+
# Copyright:: Copyright 2026 Trimble Inc.
|
|
2
2
|
# License:: The MIT License (MIT)
|
|
3
3
|
|
|
4
4
|
#
|
|
@@ -29,9 +29,9 @@ class Geom::Transformation2d
|
|
|
29
29
|
# The {.scaling} method is used to create a transformation that does scaling.
|
|
30
30
|
#
|
|
31
31
|
# @example
|
|
32
|
-
# point = Geom::
|
|
32
|
+
# point = Geom::Point2d.new(20, 30)
|
|
33
33
|
# scale = 10
|
|
34
|
-
#
|
|
34
|
+
# transformation = Geom::Transformation2d.scaling(point, scale)
|
|
35
35
|
#
|
|
36
36
|
# @overload scaling(scale)
|
|
37
37
|
#
|
|
@@ -70,7 +70,7 @@ class Geom::Transformation2d
|
|
|
70
70
|
#
|
|
71
71
|
# @example
|
|
72
72
|
# vector = Geom::Vector2d.new(0, 1)
|
|
73
|
-
#
|
|
73
|
+
# transformation = Geom::Transformation2d.translation(vector)
|
|
74
74
|
#
|
|
75
75
|
# @overload translation(vector)
|
|
76
76
|
#
|
|
@@ -93,9 +93,9 @@ class Geom::Transformation2d
|
|
|
93
93
|
# @example
|
|
94
94
|
# point1 = Geom::Point2d.new(5, 10)
|
|
95
95
|
# point2 = Geom::Point2d.new(2, 2)
|
|
96
|
-
#
|
|
97
|
-
# #
|
|
98
|
-
#
|
|
96
|
+
# transformation = Geom::Transformation2d.translation(point1)
|
|
97
|
+
# # The result is a Point2d(7, 12)
|
|
98
|
+
# new_point = transformation * point2
|
|
99
99
|
#
|
|
100
100
|
# @overload *(point)
|
|
101
101
|
#
|
|
@@ -114,8 +114,8 @@ class Geom::Transformation2d
|
|
|
114
114
|
#
|
|
115
115
|
# @overload *(point)
|
|
116
116
|
#
|
|
117
|
-
# @param [Array
|
|
118
|
-
# @return [Array
|
|
117
|
+
# @param [Array(Float, Float)] point
|
|
118
|
+
# @return [Array(Float, Float)]
|
|
119
119
|
#
|
|
120
120
|
# @version LayOut 2019
|
|
121
121
|
def *(arg)
|
|
@@ -125,8 +125,10 @@ class Geom::Transformation2d
|
|
|
125
125
|
# This checks whether the values of the transformations are the same.
|
|
126
126
|
#
|
|
127
127
|
# @example
|
|
128
|
-
#
|
|
129
|
-
#
|
|
128
|
+
# transformation1 = Geom::Transformation2d.new([1.0, 0.0, 0.0, 1.0, 1.0, 1.0])
|
|
129
|
+
# transformation2 = Geom::Transformation2d.translation([1, 1])
|
|
130
|
+
# # Returns true
|
|
131
|
+
# transformation1 == transformation2
|
|
130
132
|
#
|
|
131
133
|
# @param [Geom::Transformation2d] other
|
|
132
134
|
#
|
|
@@ -139,8 +141,8 @@ class Geom::Transformation2d
|
|
|
139
141
|
# The {#clone} method creates a copy of the {Geom::Transformation2d}.
|
|
140
142
|
#
|
|
141
143
|
# @example
|
|
142
|
-
#
|
|
143
|
-
#
|
|
144
|
+
# transformation = Geom::Transformation2d.new
|
|
145
|
+
# new_transformation = transformation.clone
|
|
144
146
|
#
|
|
145
147
|
# @return [Geom::Transformation2d]
|
|
146
148
|
#
|
|
@@ -152,18 +154,18 @@ class Geom::Transformation2d
|
|
|
152
154
|
# {IDENTITY_2D} transform.
|
|
153
155
|
#
|
|
154
156
|
# @example
|
|
155
|
-
# array =
|
|
156
|
-
#
|
|
157
|
-
# # Returns false
|
|
158
|
-
# status =
|
|
157
|
+
# array = [1.0, 0.0, 0.0, 1.0, 1.0, 0.0]
|
|
158
|
+
# transformation = Geom::Transformation2d.new(array)
|
|
159
|
+
# # Returns false
|
|
160
|
+
# status = transformation.identity?
|
|
159
161
|
#
|
|
160
162
|
# @example
|
|
161
|
-
#
|
|
162
|
-
# # Returns true
|
|
163
|
-
# status =
|
|
163
|
+
# transformation = Geom::Transformation2d.new
|
|
164
|
+
# # Returns true
|
|
165
|
+
# status = transformation.identity?
|
|
164
166
|
#
|
|
165
167
|
# @example
|
|
166
|
-
# # Returns true
|
|
168
|
+
# # Returns true
|
|
167
169
|
# status = IDENTITY_2D.identity?
|
|
168
170
|
#
|
|
169
171
|
# @return [Boolean] +true+ if the transform is the identity
|
|
@@ -177,7 +179,9 @@ class Geom::Transformation2d
|
|
|
177
179
|
# of {Geom::Transformation2d}.
|
|
178
180
|
#
|
|
179
181
|
# @example
|
|
180
|
-
#
|
|
182
|
+
# transformation1 = Geom::Transformation2d.new
|
|
183
|
+
#
|
|
184
|
+
# transformation2 = Geom::Transformation2d.new([1.0, 0.0, 0.0, 1.0, 1.0, 1.0])
|
|
181
185
|
#
|
|
182
186
|
# @overload initialize
|
|
183
187
|
#
|
|
@@ -203,8 +207,8 @@ class Geom::Transformation2d
|
|
|
203
207
|
#
|
|
204
208
|
# @example
|
|
205
209
|
# point = Geom::Point2d.new(5, 10)
|
|
206
|
-
#
|
|
207
|
-
#
|
|
210
|
+
# transformation = Geom::Transformation2d.translation(point)
|
|
211
|
+
# new_transformation = transformation.inverse
|
|
208
212
|
#
|
|
209
213
|
# @return [Geom::Transformation2d]
|
|
210
214
|
#
|
|
@@ -216,8 +220,8 @@ class Geom::Transformation2d
|
|
|
216
220
|
#
|
|
217
221
|
# @example
|
|
218
222
|
# point = Geom::Point2d.new(5, 10)
|
|
219
|
-
#
|
|
220
|
-
#
|
|
223
|
+
# transformation = Geom::Transformation2d.translation(point)
|
|
224
|
+
# transformation.invert!
|
|
221
225
|
#
|
|
222
226
|
# @return [Geom::Transformation2d]
|
|
223
227
|
#
|
|
@@ -229,9 +233,9 @@ class Geom::Transformation2d
|
|
|
229
233
|
# The argument is anything that can be converted into a {Geom::Transformation2d}.
|
|
230
234
|
#
|
|
231
235
|
# @example
|
|
232
|
-
#
|
|
233
|
-
#
|
|
234
|
-
#
|
|
236
|
+
# transformation = Geom::Transformation2d.new
|
|
237
|
+
# matrix = [2.0, 0.0, 0.0, 2.0, 0.0, 0.0]
|
|
238
|
+
# transformation.set!(matrix)
|
|
235
239
|
#
|
|
236
240
|
# @overload set!(transformation)
|
|
237
241
|
#
|
|
@@ -251,8 +255,8 @@ class Geom::Transformation2d
|
|
|
251
255
|
# define the Transformation2d.
|
|
252
256
|
#
|
|
253
257
|
# @example
|
|
254
|
-
#
|
|
255
|
-
#
|
|
258
|
+
# transformation = Geom::Transformation2d.new
|
|
259
|
+
# transformation.to_a.each_slice(2) {|a| p a}
|
|
256
260
|
#
|
|
257
261
|
# @return [Array<Float>] an array of 6 elements
|
|
258
262
|
#
|