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 {Sketchup::ShadowInfo} class contains method to extract the shadow
|
|
@@ -93,13 +93,13 @@ class Sketchup::ShadowInfo < Sketchup::Entity
|
|
|
93
93
|
# The set value []= method is used to set the value in the array of shadow
|
|
94
94
|
# info options.
|
|
95
95
|
#
|
|
96
|
+
# For numeric properties like "Dark", "Light", "Latitude", and "Longitude",
|
|
97
|
+
# this method is flexible and accepts any +Numeric+ value (+Integer+ or +Float+).
|
|
98
|
+
#
|
|
96
99
|
# @example
|
|
97
100
|
# model = Sketchup.active_model
|
|
98
101
|
# shadowinfo = model.shadow_info
|
|
99
|
-
#
|
|
100
|
-
# UI.messagebox value
|
|
101
|
-
# value = shadowinfo["City"]="Denver, CO"
|
|
102
|
-
# UI.messagebox value
|
|
102
|
+
# shadowinfo["City"]="Denver, CO"
|
|
103
103
|
#
|
|
104
104
|
# @param [String] key
|
|
105
105
|
# The key of the shadowinfo value to set.
|
|
@@ -107,6 +107,10 @@ class Sketchup::ShadowInfo < Sketchup::Entity
|
|
|
107
107
|
# @param [Object] value
|
|
108
108
|
# The value to be set.
|
|
109
109
|
#
|
|
110
|
+
# @raise A KeyError is raised if the key is invalid or read-only.
|
|
111
|
+
#
|
|
112
|
+
# @raise [TypeError] if the value is not the correct type for the key.
|
|
113
|
+
#
|
|
110
114
|
# @return [Object] the value that was set if successful, or false
|
|
111
115
|
# if unsuccessful.
|
|
112
116
|
#
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Copyright:: Copyright 2026 Trimble Inc.
|
|
2
|
+
# License:: The MIT License (MIT)
|
|
3
|
+
|
|
4
|
+
# A Snap is a custom grip used by SketchUp's Move tool.
|
|
5
|
+
# Snaps can be added at strategic places such as connectors to help
|
|
6
|
+
# assembling objects.
|
|
7
|
+
#
|
|
8
|
+
# rdoc-image:../images/snaps.png
|
|
9
|
+
#
|
|
10
|
+
# {#direction} is the direction a snap is "pointing". This can be thought of as
|
|
11
|
+
# the normal direction of the snap. It can also be thought of as the direction
|
|
12
|
+
# you move an object when plugging it into another object, e.g. inserting a
|
|
13
|
+
# power coord.
|
|
14
|
+
#
|
|
15
|
+
# {#up} controls the rotation around the Snap's axis.
|
|
16
|
+
#
|
|
17
|
+
# When two objects are snapped together, the Snaps have opposite
|
|
18
|
+
# {#direction} vectors but matching {#up} vectors.
|
|
19
|
+
#
|
|
20
|
+
# @example
|
|
21
|
+
# # Copy all snaps from source group/component to the corresponding
|
|
22
|
+
# # location in a target group/component, as if the objects have
|
|
23
|
+
# # have been snapped together.
|
|
24
|
+
# #
|
|
25
|
+
# # @param [Sketchup::Group, Sketchup::ComponentInstance] source
|
|
26
|
+
# # @param [Sketchup::Group, Sketchup::ComponentInstance] target
|
|
27
|
+
# def copy_snap(source, target)
|
|
28
|
+
# # Transformation for going from the coordinate system of the source to
|
|
29
|
+
# # that of the target.
|
|
30
|
+
# transformation =
|
|
31
|
+
# target.transformation.inverse * source.transformation
|
|
32
|
+
#
|
|
33
|
+
# source.definition.entities.grep(Sketchup::Snap) do |source_snap|
|
|
34
|
+
# # Transform position and orientation between local coordinate systems.
|
|
35
|
+
# position = source_snap.position.transform(transformation)
|
|
36
|
+
# # Direction vector is reversed between two connected snaps;
|
|
37
|
+
# # the snaps point "into" each other.
|
|
38
|
+
# direction = source_snap.direction.transform(transformation).reverse
|
|
39
|
+
# # Up vector is aligned between two connected snaps.
|
|
40
|
+
# up = source_snap.up.transform(transformation)
|
|
41
|
+
#
|
|
42
|
+
# target.entities.add_snap(position, direction, up)
|
|
43
|
+
# end
|
|
44
|
+
# end
|
|
45
|
+
#
|
|
46
|
+
# @version SketchUp 2025.0
|
|
47
|
+
class Sketchup::Snap < Sketchup::Drawingelement
|
|
48
|
+
|
|
49
|
+
# Instance Methods
|
|
50
|
+
|
|
51
|
+
# The {#direction} method is used to get the direction this Snap is "pointing".
|
|
52
|
+
#
|
|
53
|
+
# When two Snaps are snapped into each other, they have the opposite {#direction}.
|
|
54
|
+
#
|
|
55
|
+
# @example
|
|
56
|
+
# snap = Sketchup.active_model.entities.add_snap(ORIGIN)
|
|
57
|
+
# direction = snap.direction
|
|
58
|
+
#
|
|
59
|
+
# @return [Geom::Vector3d]
|
|
60
|
+
#
|
|
61
|
+
# @version SketchUp 2025.0
|
|
62
|
+
def direction
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# The {#position} method is used to get the position of this Snap.
|
|
66
|
+
#
|
|
67
|
+
# @example
|
|
68
|
+
# snap = Sketchup.active_model.entities.add_snap(ORIGIN)
|
|
69
|
+
# position = snap.position
|
|
70
|
+
#
|
|
71
|
+
# @return [Geom::Point3d]
|
|
72
|
+
#
|
|
73
|
+
# @version SketchUp 2025.0
|
|
74
|
+
def position
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# The {#set} method is used to move and/or reorient a Snap.
|
|
78
|
+
#
|
|
79
|
+
# @example
|
|
80
|
+
# snap = Sketchup.active_model.entities.add_snap(ORIGIN)
|
|
81
|
+
# snap.set(Geom::Point3d.new(1.m, 0, 0))
|
|
82
|
+
#
|
|
83
|
+
# @overload set(position)
|
|
84
|
+
#
|
|
85
|
+
# With only a position provided, the Snap keeps its current orientation.
|
|
86
|
+
# @param [Geom::Point3d] position
|
|
87
|
+
#
|
|
88
|
+
# @overload set(position, direction)
|
|
89
|
+
#
|
|
90
|
+
# With a position and a direction vector provided, but no up vector, SketchUp
|
|
91
|
+
# tries to keep the Snap upright.
|
|
92
|
+
# @param [Geom::Point3d] position
|
|
93
|
+
# @param [Geom::Vector3d] direction
|
|
94
|
+
#
|
|
95
|
+
# @overload set(position, direction, up)
|
|
96
|
+
#
|
|
97
|
+
# @param [Geom::Point3d] position
|
|
98
|
+
# @param [Geom::Vector3d] direction
|
|
99
|
+
# @param [Geom::Vector3d] up
|
|
100
|
+
#
|
|
101
|
+
# @raise ArgumentError if +direction+ and +up+ are parallel.
|
|
102
|
+
#
|
|
103
|
+
# @return [Sketchup::Snap] self
|
|
104
|
+
#
|
|
105
|
+
# @version SketchUp 2025.0
|
|
106
|
+
def set(*args)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# The {#up} method is used to get a vector representing the rotation of this
|
|
110
|
+
# Snap along its axis.
|
|
111
|
+
#
|
|
112
|
+
# When two Snaps are snapped into each other, they have the same aligned {#up}
|
|
113
|
+
# direction.
|
|
114
|
+
#
|
|
115
|
+
# @example
|
|
116
|
+
# snap = Sketchup.active_model.entities.add_snap(ORIGIN)
|
|
117
|
+
# up = snap.up
|
|
118
|
+
#
|
|
119
|
+
# @return [Geom::Vector3d]
|
|
120
|
+
#
|
|
121
|
+
# @version SketchUp 2025.0
|
|
122
|
+
def up
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
end
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
# Copyright:: Copyright
|
|
1
|
+
# Copyright:: Copyright 2026 Trimble Inc.
|
|
2
2
|
# License:: The MIT License (MIT)
|
|
3
3
|
|
|
4
4
|
# The Style class contains methods for modifying information about a specific
|
|
5
5
|
# style. Styles are a collection of display settings that tell SketchUp how to
|
|
6
6
|
# draw the model.
|
|
7
7
|
#
|
|
8
|
+
# In SketchUp, there are two important style objects in a model:
|
|
9
|
+
# The {Sketchup::Styles#selected_style} is the style currently selected in the Styles Browser.
|
|
10
|
+
# The {Sketchup::Styles#active_style} is a temporary copy of the selected style that allows
|
|
11
|
+
# editing without committing changes. Changes to the active style are not saved unless you call
|
|
12
|
+
# {Sketchup::Styles#update_selected_style}.
|
|
13
|
+
#
|
|
8
14
|
# @example
|
|
9
15
|
# styles = Sketchup.active_model.styles
|
|
10
16
|
# puts "Your first style is named #{styles.first.name}"
|
|
@@ -66,4 +72,17 @@ class Sketchup::Style < Sketchup::Entity
|
|
|
66
72
|
def name=(name)
|
|
67
73
|
end
|
|
68
74
|
|
|
75
|
+
# The {#path} method gets the file path the {Sketchup::Style} was loaded from.
|
|
76
|
+
#
|
|
77
|
+
# @example
|
|
78
|
+
# styles = Sketchup.active_model.styles
|
|
79
|
+
# style = styles.first
|
|
80
|
+
# name = style.path
|
|
81
|
+
#
|
|
82
|
+
# @return [String] path The file path the style was loaded from.
|
|
83
|
+
#
|
|
84
|
+
# @version SketchUp 2025.0
|
|
85
|
+
def path
|
|
86
|
+
end
|
|
87
|
+
|
|
69
88
|
end
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
# Copyright:: Copyright
|
|
1
|
+
# Copyright:: Copyright 2026 Trimble Inc.
|
|
2
2
|
# License:: The MIT License (MIT)
|
|
3
3
|
|
|
4
4
|
# The Styles class contains methods for manipulating a collection of styles in
|
|
5
5
|
# a model. Typically, you will access this via the active_model:
|
|
6
6
|
#
|
|
7
|
+
# There are two objects of this class that play important roles: the {#selected_style} and the
|
|
8
|
+
# {#active_style}.
|
|
9
|
+
#
|
|
10
|
+
# The latter is a temporary copy made from the {#selected_style} that allows the user to edit
|
|
11
|
+
# the style without committing to save anything. To save the changes, one should use
|
|
12
|
+
# {#update_selected_style}.
|
|
13
|
+
#
|
|
7
14
|
# @example
|
|
8
15
|
# styles = Sketchup.active_model.styles
|
|
9
16
|
# puts "There are #{styles.size} styles in your model."
|
|
@@ -71,21 +78,33 @@ class Sketchup::Styles < Sketchup::Entity
|
|
|
71
78
|
# The {#add_style} method is used to create and load a style from the given
|
|
72
79
|
# file.
|
|
73
80
|
#
|
|
74
|
-
# @example
|
|
81
|
+
# @example For SketchUp 2025.0 and older
|
|
75
82
|
# filename = File.expand_path('./MyStyle.style')
|
|
76
83
|
# styles = Sketchup.active_model.styles
|
|
77
84
|
# status = styles.add_style(filename, true)
|
|
78
85
|
#
|
|
79
|
-
# @
|
|
86
|
+
# @example For SketchUp 2026.0 and newer
|
|
87
|
+
# filename = File.expand_path('./MyStyle.style')
|
|
88
|
+
# styles = Sketchup.active_model.styles
|
|
89
|
+
# style = styles.add_style(filename, true)
|
|
90
|
+
#
|
|
91
|
+
# @overload add_style(filename, select)
|
|
80
92
|
#
|
|
81
|
-
#
|
|
82
|
-
#
|
|
83
|
-
#
|
|
93
|
+
# @note Signature for versions prior to SketchUp 2026.0.
|
|
94
|
+
# @version SketchUp 6.0
|
|
95
|
+
# @param [String] filename The file path to the style file.
|
|
96
|
+
# @param [Boolean] select +true+ if you want to set the style to be the active style.
|
|
97
|
+
# @return [Boolean]
|
|
84
98
|
#
|
|
85
|
-
# @
|
|
99
|
+
# @overload add_style(filename, select = false)
|
|
86
100
|
#
|
|
87
|
-
#
|
|
88
|
-
|
|
101
|
+
# @version SketchUp 2026.0
|
|
102
|
+
# @param [String] filename The file path to the style file.
|
|
103
|
+
# @param [Boolean] select +true+ if you want to set the style to be the active style.
|
|
104
|
+
#
|
|
105
|
+
# @return [Sketchup::Style, nil] The newly created style or +nil+ if the the style could not be
|
|
106
|
+
# added.
|
|
107
|
+
def add_style(*args)
|
|
89
108
|
end
|
|
90
109
|
|
|
91
110
|
#
|
|
@@ -151,12 +170,32 @@ class Sketchup::Styles < Sketchup::Entity
|
|
|
151
170
|
# styles = Sketchup.active_model.styles
|
|
152
171
|
# styles.purge_unused
|
|
153
172
|
#
|
|
154
|
-
# @return [
|
|
173
|
+
# @return [nil]
|
|
155
174
|
#
|
|
156
175
|
# @version SketchUp 6.0
|
|
157
176
|
def purge_unused
|
|
158
177
|
end
|
|
159
178
|
|
|
179
|
+
# The {#remove_style} method is used to remove a {Sketchup::Style} from the {Sketchup::Styles}.
|
|
180
|
+
#
|
|
181
|
+
# @example
|
|
182
|
+
# filename = File.expand_path('./MyStyle.style')
|
|
183
|
+
# styles = Sketchup.active_model.styles
|
|
184
|
+
# status = styles.add_style(filename, true)
|
|
185
|
+
# styles.remove(styles.first)
|
|
186
|
+
#
|
|
187
|
+
# @param [Sketchup::Style] style
|
|
188
|
+
#
|
|
189
|
+
# @raise [ArgumentError] If the style is not found in the Styles collection.
|
|
190
|
+
#
|
|
191
|
+
# @raise [ArgumentError] If the styles contains only one style.
|
|
192
|
+
#
|
|
193
|
+
# @return [nil]
|
|
194
|
+
#
|
|
195
|
+
# @version SketchUp 2026.0
|
|
196
|
+
def remove_style(style)
|
|
197
|
+
end
|
|
198
|
+
|
|
160
199
|
# The {#selected_style} method is used to retrieve the style currently
|
|
161
200
|
# selected in the Styles Browser.
|
|
162
201
|
#
|
|
@@ -172,13 +211,20 @@ class Sketchup::Styles < Sketchup::Entity
|
|
|
172
211
|
|
|
173
212
|
# The {#selected_style=} method is used to set the currently selected style.
|
|
174
213
|
#
|
|
214
|
+
# @bug Prior to SketchUp 2025.0 setting the {#selected_style=} to the {#active_style} would chrash
|
|
215
|
+
# SketchUp.
|
|
216
|
+
#
|
|
175
217
|
# @example
|
|
176
218
|
# styles = Sketchup.active_model.styles
|
|
177
|
-
#
|
|
219
|
+
# filename = File.expand_path('./MyStyle.style')
|
|
220
|
+
# styles.add_style(filename, true)
|
|
221
|
+
# styles.selected_style = styles['[MyStyle]']
|
|
178
222
|
#
|
|
179
223
|
# @param [Sketchup::Style] style
|
|
180
224
|
#
|
|
181
|
-
# @
|
|
225
|
+
# @raise [ArgumentError] If \p style is the {#active_style}.
|
|
226
|
+
#
|
|
227
|
+
# @return [nil]
|
|
182
228
|
#
|
|
183
229
|
# @version SketchUp 6.0
|
|
184
230
|
def selected_style=(style)
|
|
@@ -206,7 +252,7 @@ class Sketchup::Styles < Sketchup::Entity
|
|
|
206
252
|
# styles = Sketchup.active_model.styles
|
|
207
253
|
# styles.update_selected_style
|
|
208
254
|
#
|
|
209
|
-
# @return [
|
|
255
|
+
# @return [nil]
|
|
210
256
|
#
|
|
211
257
|
# @see #selected_style
|
|
212
258
|
#
|
|
@@ -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 Text class contains method to manipulate a Text entity object.
|
|
@@ -11,8 +11,12 @@ class Sketchup::Text < Sketchup::Drawingelement
|
|
|
11
11
|
# The arrow_type method retrieves the current arrow type used for the leader
|
|
12
12
|
# text.
|
|
13
13
|
#
|
|
14
|
-
# Valid arrow types are
|
|
15
|
-
#
|
|
14
|
+
# Valid arrow types are:
|
|
15
|
+
# - {Sketchup::Dimension::ARROW_NONE} (Deprecated: {DimensionArrowNone})
|
|
16
|
+
# - {Sketchup::Dimension::ARROW_SLASH} (Deprecated: {DimensionArrowSlash})
|
|
17
|
+
# - {Sketchup::Dimension::ARROW_DOT} (Deprecated: {DimensionArrowDot})
|
|
18
|
+
# - {Sketchup::Dimension::ARROW_CLOSED} (Deprecated: {DimensionArrowClosed})
|
|
19
|
+
# - {Sketchup::Dimension::ARROW_OPEN} (Deprecated: {DimensionArrowOpen})
|
|
16
20
|
#
|
|
17
21
|
# @example
|
|
18
22
|
# type = text.arrow_type=0
|
|
@@ -26,8 +30,12 @@ class Sketchup::Text < Sketchup::Drawingelement
|
|
|
26
30
|
|
|
27
31
|
# The arrow_type= method sets the arrow type used for leader text.
|
|
28
32
|
#
|
|
29
|
-
# Valid arrow types are
|
|
30
|
-
#
|
|
33
|
+
# Valid arrow types are:
|
|
34
|
+
# - {Sketchup::Dimension::ARROW_NONE} (Deprecated: {DimensionArrowNone})
|
|
35
|
+
# - {Sketchup::Dimension::ARROW_SLASH} (Deprecated: {DimensionArrowSlash})
|
|
36
|
+
# - {Sketchup::Dimension::ARROW_DOT} (Deprecated: {DimensionArrowDot})
|
|
37
|
+
# - {Sketchup::Dimension::ARROW_CLOSED} (Deprecated: {DimensionArrowClosed})
|
|
38
|
+
# - {Sketchup::Dimension::ARROW_OPEN} (Deprecated: {DimensionArrowOpen})
|
|
31
39
|
#
|
|
32
40
|
# @example
|
|
33
41
|
# arrow = text.arrow_type=type
|
|
@@ -110,7 +118,12 @@ class Sketchup::Text < Sketchup::Drawingelement
|
|
|
110
118
|
def has_leader?
|
|
111
119
|
end
|
|
112
120
|
|
|
113
|
-
# The leader_type method retrieves the currently set leader type.
|
|
121
|
+
# The {#leader_type} method retrieves the currently set leader type.
|
|
122
|
+
#
|
|
123
|
+
# Valid leaders types are:
|
|
124
|
+
# - {ALeaderNone}
|
|
125
|
+
# - {ALeaderView}
|
|
126
|
+
# - {ALeaderModel}
|
|
114
127
|
#
|
|
115
128
|
# @example
|
|
116
129
|
# leader = text.leader_type
|
|
@@ -122,17 +135,25 @@ class Sketchup::Text < Sketchup::Drawingelement
|
|
|
122
135
|
def leader_type
|
|
123
136
|
end
|
|
124
137
|
|
|
125
|
-
# The leader_type
|
|
138
|
+
# The {#leader_type=} method sets the leader type.
|
|
126
139
|
#
|
|
127
|
-
# Valid
|
|
140
|
+
# Valid leaders types are:
|
|
141
|
+
# - {ALeaderNone}
|
|
142
|
+
# - {ALeaderView}
|
|
143
|
+
# - {ALeaderModel}
|
|
128
144
|
#
|
|
129
145
|
# @example
|
|
130
146
|
# leader = text.leader_type=1
|
|
131
147
|
#
|
|
148
|
+
# @note {ALeaderNone} cannot be set. It is only used internally as a default value.
|
|
149
|
+
# Trying to set it will raise a warning.
|
|
150
|
+
#
|
|
132
151
|
# @param [Integer] type
|
|
133
152
|
# A numerical value representing the leader type to be
|
|
134
153
|
# set.
|
|
135
154
|
#
|
|
155
|
+
# @raise [RangeError] if the value is other than (ALeaderView, or ALeaderModel).
|
|
156
|
+
#
|
|
136
157
|
# @return [Integer] a numerical value representing the leader type
|
|
137
158
|
# you just set.
|
|
138
159
|
#
|
|
@@ -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 Texture class contains methods for obtaining information about textures
|
|
@@ -23,16 +23,11 @@ class Sketchup::Texture < Sketchup::Entity
|
|
|
23
23
|
# # Returns nil if not successful, path if successful
|
|
24
24
|
# m.texture = "c:\\Materials\\Carpet.jpg"
|
|
25
25
|
# rescue
|
|
26
|
-
#
|
|
26
|
+
# puts $!.message
|
|
27
27
|
# end
|
|
28
28
|
# texture = m.texture
|
|
29
29
|
# # Returns a color object
|
|
30
30
|
# color = texture.average_color
|
|
31
|
-
# if (color)
|
|
32
|
-
# UI.messagebox color
|
|
33
|
-
# else
|
|
34
|
-
# UI.messagebox "Failure: No average color"
|
|
35
|
-
# end
|
|
36
31
|
#
|
|
37
32
|
# @return [Sketchup::Color, nil] a color object (if successful), nil if
|
|
38
33
|
# unsuccessful.
|
|
@@ -41,8 +36,15 @@ class Sketchup::Texture < Sketchup::Entity
|
|
|
41
36
|
def average_color
|
|
42
37
|
end
|
|
43
38
|
|
|
44
|
-
# The {#filename} method retrieves the
|
|
45
|
-
#
|
|
39
|
+
# The {#filename} method retrieves the full path, if available, for a texture object.
|
|
40
|
+
#
|
|
41
|
+
# Textures for materials shipping with SketchUp might only have a filename,
|
|
42
|
+
# since the path would be invalid on the end user's machine. Textures
|
|
43
|
+
# dynamically created from ImageRep objects may have an empty path unless
|
|
44
|
+
# saved with {Sketchup::ImageRep#save_file} or until the texture is saved with
|
|
45
|
+
# {Sketchup::Texture#write}.
|
|
46
|
+
#
|
|
47
|
+
# If you need only the filename of the texture use +filename = File.basename(texture.filename)+.
|
|
46
48
|
#
|
|
47
49
|
# @example
|
|
48
50
|
# model = Sketchup.active_model
|
|
@@ -79,11 +81,6 @@ class Sketchup::Texture < Sketchup::Entity
|
|
|
79
81
|
#
|
|
80
82
|
# @example
|
|
81
83
|
# imageheight = texture.image_height
|
|
82
|
-
# if (imageheight)
|
|
83
|
-
# UI.messagebox imageheight
|
|
84
|
-
# else
|
|
85
|
-
# UI.messagebox "Failure"
|
|
86
|
-
# end
|
|
87
84
|
#
|
|
88
85
|
# @return [Integer] the height, in pixels, of the texture
|
|
89
86
|
# pattern
|
|
@@ -113,11 +110,6 @@ class Sketchup::Texture < Sketchup::Entity
|
|
|
113
110
|
#
|
|
114
111
|
# @example
|
|
115
112
|
# imagewidth = texture.image_width
|
|
116
|
-
# if (imagewidth)
|
|
117
|
-
# UI.messagebox imagewidth
|
|
118
|
-
# else
|
|
119
|
-
# UI.messagebox "Failure"
|
|
120
|
-
# end
|
|
121
113
|
#
|
|
122
114
|
# @return [Integer] the width, in pixels, of the texture
|
|
123
115
|
# pattern
|
|
@@ -134,18 +126,13 @@ class Sketchup::Texture < Sketchup::Entity
|
|
|
134
126
|
# imagewidth = texture.width
|
|
135
127
|
#
|
|
136
128
|
# if (imagewidth)
|
|
137
|
-
#
|
|
129
|
+
# puts imagewidth
|
|
138
130
|
# else
|
|
139
|
-
#
|
|
131
|
+
# puts "Failure"
|
|
140
132
|
# end
|
|
141
133
|
#
|
|
142
134
|
# # Using two values which will not preserve ratio
|
|
143
135
|
# width_height = texture.size = [10,100]
|
|
144
|
-
# if (width_height)
|
|
145
|
-
# UI.messagebox width_height
|
|
146
|
-
# else
|
|
147
|
-
# UI.messagebox "Failure"
|
|
148
|
-
# end
|
|
149
136
|
#
|
|
150
137
|
# @param [Integer, Array(Integer, Integer)] size
|
|
151
138
|
# The size, in inches, of the texture. This number will
|
|
@@ -168,11 +155,6 @@ class Sketchup::Texture < Sketchup::Entity
|
|
|
168
155
|
#
|
|
169
156
|
# @example
|
|
170
157
|
# status = texture.valid?
|
|
171
|
-
# if (status)
|
|
172
|
-
# UI.messagebox status
|
|
173
|
-
# else
|
|
174
|
-
# UI.messagebox status
|
|
175
|
-
# end
|
|
176
158
|
#
|
|
177
159
|
# @return [Boolean]
|
|
178
160
|
#
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# Copyright:: Copyright
|
|
1
|
+
# Copyright:: Copyright 2026 Trimble Inc.
|
|
2
2
|
# License:: The MIT License (MIT)
|
|
3
3
|
|
|
4
4
|
# The TextureWriter class is used primarily for writing the textures used in a
|
|
5
5
|
# SketchUp model out to files as part of an export for use in another
|
|
6
6
|
# application. These methods are usually invoked in this order:
|
|
7
7
|
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
8
|
+
# 1. {#load} - load one or more textures from a model into the TextureWriter.
|
|
9
|
+
# 2. {#write_all} or {#write} - write the texture(s) to file.
|
|
10
10
|
#
|
|
11
11
|
# @example
|
|
12
12
|
# # This code snippet sets up a texture writer and some variables that are
|
|
@@ -159,9 +159,9 @@ class Sketchup::TextureWriter
|
|
|
159
159
|
# This method will return one of the following status messages. (These are
|
|
160
160
|
# constants that are defined by the API.)
|
|
161
161
|
#
|
|
162
|
-
#
|
|
163
|
-
#
|
|
164
|
-
#
|
|
162
|
+
# - 0 = {FILE_WRITE_OK}
|
|
163
|
+
# - 1 = {FILE_WRITE_FAILED_INVALID_TYPE}
|
|
164
|
+
# - 2 = {FILE_WRITE_FAILED_UNKNOWN}
|
|
165
165
|
#
|
|
166
166
|
# @example
|
|
167
167
|
# tw.load(texturable_entities[0])
|
|
@@ -211,9 +211,9 @@ class Sketchup::TextureWriter
|
|
|
211
211
|
# The write_all method is used to write all of the textures within the texture
|
|
212
212
|
# writer to files. It will return one of three status numbers:
|
|
213
213
|
#
|
|
214
|
-
#
|
|
215
|
-
#
|
|
216
|
-
#
|
|
214
|
+
# - 0 = {FILE_WRITE_OK}
|
|
215
|
+
# - 1 = {FILE_WRITE_FAILED_INVALID_TYPE}
|
|
216
|
+
# - 2 = {FILE_WRITE_FAILED_UNKNOWN}
|
|
217
217
|
#
|
|
218
218
|
# @example
|
|
219
219
|
# tw.load(texturable_entities[0]
|