sketchup-api-stubs 0.1.2 → 0.2.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.
- checksums.yaml +4 -4
- data/SketchUp/Geom/BoundingBox.rb +17 -20
- data/SketchUp/Geom/Bounds2d.rb +172 -0
- data/SketchUp/Geom/LatLong.rb +31 -16
- data/SketchUp/Geom/OrientedBounds2d.rb +102 -0
- data/SketchUp/Geom/Point2d.rb +365 -0
- data/SketchUp/Geom/Point3d.rb +121 -110
- data/SketchUp/Geom/PolygonMesh.rb +30 -21
- data/SketchUp/Geom/Transformation.rb +8 -4
- data/SketchUp/Geom/Transformation2d.rb +125 -0
- data/SketchUp/Geom/UTM.rb +43 -37
- data/SketchUp/Geom/Vector2d.rb +497 -0
- data/SketchUp/Geom/Vector3d.rb +143 -131
- data/SketchUp/Layout.rb +25 -0
- data/SketchUp/Layout/AngularDimension.rb +569 -0
- data/SketchUp/Layout/AutoTextDefinition.rb +417 -0
- data/SketchUp/Layout/AutoTextDefinitions.rb +186 -0
- data/SketchUp/Layout/ConnectionPoint.rb +70 -0
- data/SketchUp/Layout/Document.rb +458 -0
- data/SketchUp/Layout/Ellipse.rb +29 -0
- data/SketchUp/Layout/Entities.rb +155 -0
- data/SketchUp/Layout/Entity.rb +363 -0
- data/SketchUp/Layout/FormattedText.rb +349 -0
- data/SketchUp/Layout/Grid.rb +131 -0
- data/SketchUp/Layout/Group.rb +261 -0
- data/SketchUp/Layout/Image.rb +86 -0
- data/SketchUp/Layout/Label.rb +371 -0
- data/SketchUp/Layout/Layer.rb +222 -0
- data/SketchUp/Layout/LayerInstance.rb +128 -0
- data/SketchUp/Layout/Layers.rb +232 -0
- data/SketchUp/Layout/LinearDimension.rb +563 -0
- data/SketchUp/Layout/LockedEntityError.rb +10 -0
- data/SketchUp/Layout/LockedLayerError.rb +11 -0
- data/SketchUp/Layout/Page.rb +187 -0
- data/SketchUp/Layout/PageInfo.rb +393 -0
- data/SketchUp/Layout/Pages.rb +216 -0
- data/SketchUp/Layout/Path.rb +326 -0
- data/SketchUp/Layout/Rectangle.rb +174 -0
- data/SketchUp/Layout/SketchUpModel.rb +522 -0
- data/SketchUp/Layout/Style.rb +1520 -0
- data/SketchUp/Layout/Table.rb +290 -0
- data/SketchUp/Layout/TableCell.rb +149 -0
- data/SketchUp/Layout/TableColumn.rb +139 -0
- data/SketchUp/Layout/TableRow.rb +135 -0
- data/SketchUp/Sketchup/Animation.rb +7 -4
- data/SketchUp/Sketchup/ArcCurve.rb +10 -10
- data/SketchUp/Sketchup/AttributeDictionaries.rb +13 -4
- data/SketchUp/Sketchup/AttributeDictionary.rb +12 -12
- data/SketchUp/Sketchup/Color.rb +68 -78
- data/SketchUp/Sketchup/ComponentDefinition.rb +60 -60
- data/SketchUp/Sketchup/ComponentInstance.rb +57 -55
- data/SketchUp/Sketchup/DefinitionList.rb +34 -17
- data/SketchUp/Sketchup/Drawingelement.rb +19 -21
- data/SketchUp/Sketchup/Edge.rb +22 -24
- data/SketchUp/Sketchup/Entities.rb +173 -162
- data/SketchUp/Sketchup/Entity.rb +71 -55
- data/SketchUp/Sketchup/Face.rb +45 -44
- data/SketchUp/Sketchup/Group.rb +47 -49
- data/SketchUp/Sketchup/Image.rb +16 -0
- data/SketchUp/Sketchup/ImageRep.rb +226 -0
- data/SketchUp/Sketchup/InstancePath.rb +13 -13
- data/SketchUp/Sketchup/Layer.rb +15 -17
- data/SketchUp/Sketchup/Material.rb +40 -30
- data/SketchUp/Sketchup/Materials.rb +40 -22
- data/SketchUp/Sketchup/Menu.rb +5 -5
- data/SketchUp/Sketchup/Model.rb +230 -228
- data/SketchUp/Sketchup/Page.rb +32 -0
- data/SketchUp/Sketchup/Pages.rb +3 -4
- data/SketchUp/Sketchup/RenderingOptions.rb +21 -16
- data/SketchUp/Sketchup/SectionPlane.rb +64 -0
- data/SketchUp/Sketchup/Selection.rb +20 -28
- data/SketchUp/Sketchup/ShadowInfo.rb +14 -14
- data/SketchUp/Sketchup/Text.rb +24 -26
- data/SketchUp/Sketchup/Texture.rb +28 -12
- data/SketchUp/Sketchup/Vertex.rb +14 -11
- data/SketchUp/Sketchup/View.rb +126 -116
- data/SketchUp/UI/Command.rb +17 -17
- data/SketchUp/UI/HtmlDialog.rb +8 -5
- data/SketchUp/UI/Notification.rb +1 -1
- data/SketchUp/UI/Toolbar.rb +13 -14
- data/SketchUp/UI/WebDialog.rb +55 -59
- data/SketchUp/_top_level.rb +139 -27
- data/SketchUp/{Array.rb → array.rb} +167 -30
- data/SketchUp/{Geom.rb → geom.rb} +9 -7
- data/SketchUp/{LanguageHandler.rb → languagehandler.rb} +15 -15
- data/SketchUp/{Length.rb → length.rb} +15 -15
- data/SketchUp/{Numeric.rb → numeric.rb} +19 -19
- data/SketchUp/sketchup.rb +167 -156
- data/SketchUp/{SketchupExtension.rb → sketchupextension.rb} +27 -27
- data/SketchUp/{String.rb → string.rb} +1 -1
- data/SketchUp/ui.rb +113 -87
- metadata +46 -9
@@ -18,7 +18,7 @@ class Sketchup::InstancePath
|
|
18
18
|
# model = Sketchup.active_model
|
19
19
|
# group = model.entities.add_group
|
20
20
|
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
21
|
-
# path = Sketchup::InstancePath.new(group, edge])
|
21
|
+
# path = Sketchup::InstancePath.new([group, edge])
|
22
22
|
# if path.size > 1
|
23
23
|
# # do something
|
24
24
|
# end
|
@@ -36,7 +36,7 @@ class Sketchup::InstancePath
|
|
36
36
|
# model = Sketchup.active_model
|
37
37
|
# group = model.entities.add_group
|
38
38
|
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
39
|
-
# path = Sketchup::InstancePath.new(group, edge])
|
39
|
+
# path = Sketchup::InstancePath.new([group, edge])
|
40
40
|
# path[0] == group # returns true
|
41
41
|
# path[1] == edge # returns true
|
42
42
|
#
|
@@ -60,7 +60,7 @@ class Sketchup::InstancePath
|
|
60
60
|
# model = Sketchup.active_model
|
61
61
|
# group = model.entities.add_group
|
62
62
|
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
63
|
-
# path = Sketchup::InstancePath.new(group, edge])
|
63
|
+
# path = Sketchup::InstancePath.new([group, edge])
|
64
64
|
# path.each { |entity|
|
65
65
|
# # do something
|
66
66
|
# }
|
@@ -80,7 +80,7 @@ class Sketchup::InstancePath
|
|
80
80
|
# model = Sketchup.active_model
|
81
81
|
# group = model.entities.add_group
|
82
82
|
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
83
|
-
# path = Sketchup::InstancePath.new(group, edge])
|
83
|
+
# path = Sketchup::InstancePath.new([group, edge])
|
84
84
|
# if path.empty?
|
85
85
|
# # do something...
|
86
86
|
# end
|
@@ -99,7 +99,7 @@ class Sketchup::InstancePath
|
|
99
99
|
# model = Sketchup.active_model
|
100
100
|
# group = model.entities.add_group
|
101
101
|
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
102
|
-
# path = Sketchup::InstancePath.new(group, edge])
|
102
|
+
# path = Sketchup::InstancePath.new([group, edge])
|
103
103
|
# if path.include?(edge)
|
104
104
|
# # do something...
|
105
105
|
# end
|
@@ -144,7 +144,7 @@ class Sketchup::InstancePath
|
|
144
144
|
# model = Sketchup.active_model
|
145
145
|
# group = model.entities.add_group
|
146
146
|
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
147
|
-
# path = Sketchup::InstancePath.new(group, edge])
|
147
|
+
# path = Sketchup::InstancePath.new([group, edge])
|
148
148
|
# path.leaf == edge # returns true
|
149
149
|
#
|
150
150
|
# @raise [TypeError] if the instance path refer to deleted entities.
|
@@ -161,7 +161,7 @@ class Sketchup::InstancePath
|
|
161
161
|
# model = Sketchup.active_model
|
162
162
|
# group = model.entities.add_group
|
163
163
|
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
164
|
-
# path = Sketchup::InstancePath.new(group, edge])
|
164
|
+
# path = Sketchup::InstancePath.new([group, edge])
|
165
165
|
# if path.length > 1
|
166
166
|
# # do something
|
167
167
|
# end
|
@@ -183,7 +183,7 @@ class Sketchup::InstancePath
|
|
183
183
|
# model = Sketchup.active_model
|
184
184
|
# group = model.entities.add_group
|
185
185
|
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
186
|
-
# path = Sketchup::InstancePath.new(group, edge])
|
186
|
+
# path = Sketchup::InstancePath.new([group, edge])
|
187
187
|
# pid_path = path.persistent_id_path # something like "342.345"
|
188
188
|
#
|
189
189
|
# @raise [TypeError] if the instance path refer to deleted entities.
|
@@ -204,7 +204,7 @@ class Sketchup::InstancePath
|
|
204
204
|
# model = Sketchup.active_model
|
205
205
|
# group = model.entities.add_group
|
206
206
|
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
207
|
-
# path = Sketchup::InstancePath.new(group, edge])
|
207
|
+
# path = Sketchup::InstancePath.new([group, edge])
|
208
208
|
# path.root == group # returns true
|
209
209
|
#
|
210
210
|
# @raise [TypeError] if the instance path refer to deleted entities.
|
@@ -220,7 +220,7 @@ class Sketchup::InstancePath
|
|
220
220
|
# model = Sketchup.active_model
|
221
221
|
# group = model.entities.add_group
|
222
222
|
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
223
|
-
# path = Sketchup::InstancePath.new(group, edge])
|
223
|
+
# path = Sketchup::InstancePath.new([group, edge])
|
224
224
|
# if path.size > 1
|
225
225
|
# # do something
|
226
226
|
# end
|
@@ -240,7 +240,7 @@ class Sketchup::InstancePath
|
|
240
240
|
# model = Sketchup.active_model
|
241
241
|
# group = model.entities.add_group
|
242
242
|
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
243
|
-
# path = Sketchup::InstancePath.new(group, edge])
|
243
|
+
# path = Sketchup::InstancePath.new([group, edge])
|
244
244
|
# pid_string = path.to_a.join('.')
|
245
245
|
#
|
246
246
|
# @raise [TypeError] if the instance path refer to deleted entities.
|
@@ -259,7 +259,7 @@ class Sketchup::InstancePath
|
|
259
259
|
# model = Sketchup.active_model
|
260
260
|
# group = model.entities.add_group
|
261
261
|
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
262
|
-
# path = Sketchup::InstancePath.new(group, edge])
|
262
|
+
# path = Sketchup::InstancePath.new([group, edge])
|
263
263
|
# tr = path.transformation
|
264
264
|
#
|
265
265
|
# @param [Integer] index
|
@@ -286,7 +286,7 @@ class Sketchup::InstancePath
|
|
286
286
|
# model = Sketchup.active_model
|
287
287
|
# group = model.entities.add_group
|
288
288
|
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
289
|
-
# path = Sketchup::InstancePath.new(group, edge])
|
289
|
+
# path = Sketchup::InstancePath.new([group, edge])
|
290
290
|
# if path.valid?
|
291
291
|
# # do something...
|
292
292
|
# end
|
data/SketchUp/Sketchup/Layer.rb
CHANGED
@@ -171,22 +171,18 @@ class Sketchup::Layer < Sketchup::Entity
|
|
171
171
|
def page_behavior
|
172
172
|
end
|
173
173
|
|
174
|
-
# The page_behavior= method is used to control the layer's visibility
|
175
|
-
# on existing and new pages.
|
176
|
-
#
|
177
|
-
# The behavior is composed of a combination of these flags:
|
178
|
-
# - LAYER_VISIBLE_BY_DEFAULT: 0x0000
|
179
|
-
# - LAYER_HIDDEN_BY_DEFAULT: 0x0001
|
180
|
-
# - LAYER_USES_DEFAULT_VISIBILITY_ON_NEW_PAGES: 0x0000
|
181
|
-
# - LAYER_IS_VISIBLE_ON_NEW_PAGES: 0x0010
|
182
|
-
# - LAYER_IS_HIDDEN_ON_NEW_PAGES: 0x0020
|
174
|
+
# The {#page_behavior=} method is used to control the layer's visibility
|
175
|
+
# behavior on existing and new pages.
|
183
176
|
#
|
184
177
|
# When you Update a page (as opposed to creating a new page) the current
|
185
178
|
# visibility of the layer is used.
|
186
179
|
#
|
187
|
-
#
|
188
|
-
#
|
189
|
-
#
|
180
|
+
# The behavior is composed of a combination of these flags:
|
181
|
+
# [+LAYER_VISIBLE_BY_DEFAULT: 0x0000+]
|
182
|
+
# [+LAYER_HIDDEN_BY_DEFAULT: 0x0001+]
|
183
|
+
# [+LAYER_USES_DEFAULT_VISIBILITY_ON_NEW_PAGES: 0x0000+]
|
184
|
+
# [+LAYER_IS_VISIBLE_ON_NEW_PAGES: 0x0010+]
|
185
|
+
# [+LAYER_IS_HIDDEN_ON_NEW_PAGES: 0x0020+]
|
190
186
|
#
|
191
187
|
# @example
|
192
188
|
# layers = Sketchup.active_model.layers
|
@@ -194,14 +190,16 @@ class Sketchup::Layer < Sketchup::Entity
|
|
194
190
|
# behavior = LAYER_HIDDEN_BY_DEFAULT | LAYER_IS_HIDDEN_ON_NEW_PAGES
|
195
191
|
# layer.page_behavior = behavior
|
196
192
|
#
|
197
|
-
# @
|
198
|
-
#
|
193
|
+
# @note Prior to SketchUp 2014 the +LAYER_HIDDEN_BY_DEFAULT+ flag
|
194
|
+
# would trigger the validation check in SketchUp that would reset the
|
195
|
+
# {#page_behavior} of the layer.
|
196
|
+
#
|
197
|
+
# @param [Integer] page_behavior
|
199
198
|
#
|
200
|
-
# @return
|
201
|
-
# visibility of the layer.
|
199
|
+
# @return [Integer]
|
202
200
|
#
|
203
201
|
# @version SketchUp 6.0
|
204
|
-
def page_behavior=(
|
202
|
+
def page_behavior=(page_behavior)
|
205
203
|
end
|
206
204
|
|
207
205
|
# The visible= method is used to set if the layer is visible.
|
@@ -43,10 +43,10 @@ class Sketchup::Material < Sketchup::Entity
|
|
43
43
|
# m2 = materials.add('Fred')
|
44
44
|
# p m1 <=> m2
|
45
45
|
#
|
46
|
-
# @param material2
|
46
|
+
# @param [Sketchup::Material] material2
|
47
47
|
# A Material object.
|
48
48
|
#
|
49
|
-
# @return
|
49
|
+
# @return [Integer] 0 if they are equal, positive number if
|
50
50
|
# material1 > material2, negative if material1 < material2
|
51
51
|
#
|
52
52
|
# @version SketchUp 6.0
|
@@ -66,10 +66,10 @@ class Sketchup::Material < Sketchup::Entity
|
|
66
66
|
# UI.messagebox('The Materials are not equal.')
|
67
67
|
# end
|
68
68
|
#
|
69
|
-
# @param material2
|
69
|
+
# @param [Sketchup::Material] material2
|
70
70
|
# A Material object.
|
71
71
|
#
|
72
|
-
# @return
|
72
|
+
# @return [Boolean] true if the materials are the same, false if
|
73
73
|
# they are different
|
74
74
|
#
|
75
75
|
# @version SketchUp 6.0
|
@@ -85,7 +85,7 @@ class Sketchup::Material < Sketchup::Entity
|
|
85
85
|
# @example
|
86
86
|
# alpha_value = Sketchup.active_model.materials[0].alpha
|
87
87
|
#
|
88
|
-
# @return
|
88
|
+
# @return [Float] a number between 0 and 1
|
89
89
|
#
|
90
90
|
# @version SketchUp 6.0
|
91
91
|
def alpha
|
@@ -103,10 +103,10 @@ class Sketchup::Material < Sketchup::Entity
|
|
103
103
|
# material = materials.add('Joe')
|
104
104
|
# material.alpha = 0.5
|
105
105
|
#
|
106
|
-
# @param alpha
|
106
|
+
# @param [Float] alpha
|
107
107
|
# An opacity value.
|
108
108
|
#
|
109
|
-
# @return
|
109
|
+
# @return [Float] the newly set opacity value
|
110
110
|
#
|
111
111
|
# @version SketchUp 6.0
|
112
112
|
def alpha=(alpha)
|
@@ -123,7 +123,7 @@ class Sketchup::Material < Sketchup::Entity
|
|
123
123
|
# material.color = 'red'
|
124
124
|
# color = material.color
|
125
125
|
#
|
126
|
-
# @return
|
126
|
+
# @return [Sketchup::Color] a Color object
|
127
127
|
#
|
128
128
|
# @version SketchUp 6.0
|
129
129
|
def color
|
@@ -143,10 +143,10 @@ class Sketchup::Material < Sketchup::Entity
|
|
143
143
|
# material = materials.add('Joe')
|
144
144
|
# material.color = 'red'
|
145
145
|
#
|
146
|
-
# @param color
|
146
|
+
# @param [Sketchup::Color, String, nil] color
|
147
147
|
# A Color object.
|
148
148
|
#
|
149
|
-
# @return
|
149
|
+
# @return [Sketchup::Color, String, nil] the newly set Color object
|
150
150
|
#
|
151
151
|
# @version SketchUp 6.0
|
152
152
|
def color=(color)
|
@@ -158,7 +158,7 @@ class Sketchup::Material < Sketchup::Entity
|
|
158
158
|
# material = Sketchup.active_model.materials[0]
|
159
159
|
# h, l, s = material.colorize_deltas
|
160
160
|
#
|
161
|
-
# @return Array
|
161
|
+
# @return [Array(Float, Float, Float)] An array of floats representing the HLS delta.
|
162
162
|
#
|
163
163
|
# @version SketchUp 2015
|
164
164
|
def colorize_deltas
|
@@ -176,7 +176,7 @@ class Sketchup::Material < Sketchup::Entity
|
|
176
176
|
# material = Sketchup.active_model.materials[0]
|
177
177
|
# type = material.colorize_type
|
178
178
|
#
|
179
|
-
# @return
|
179
|
+
# @return [Integer] the colorize type for the Material object.
|
180
180
|
#
|
181
181
|
# @version SketchUp 2015
|
182
182
|
def colorize_type
|
@@ -194,10 +194,10 @@ class Sketchup::Material < Sketchup::Entity
|
|
194
194
|
# material = Sketchup.active_model.materials[0]
|
195
195
|
# material.colorize_type = Sketchup::Material::COLORIZE_TINT
|
196
196
|
#
|
197
|
-
# @param type
|
198
|
-
#
|
197
|
+
# @param [Integer] type
|
198
|
+
# the new colorize type for the Material object.
|
199
199
|
#
|
200
|
-
# @return
|
200
|
+
# @return [Integer] the colorize type for the Material object.
|
201
201
|
#
|
202
202
|
# @version SketchUp 2015
|
203
203
|
def colorize_type=(type)
|
@@ -219,7 +219,7 @@ class Sketchup::Material < Sketchup::Entity
|
|
219
219
|
# # to the UI like SketchUp does.
|
220
220
|
# puts material.display_name # Outputs "Joe"
|
221
221
|
#
|
222
|
-
# @return
|
222
|
+
# @return [String] the display name for the material
|
223
223
|
#
|
224
224
|
# @version SketchUp 6.0
|
225
225
|
def display_name
|
@@ -237,7 +237,7 @@ class Sketchup::Material < Sketchup::Entity
|
|
237
237
|
# material = Sketchup.active_model.materials[0]
|
238
238
|
# type = material.materialType
|
239
239
|
#
|
240
|
-
# @return
|
240
|
+
# @return [Integer] the material type for the Material object. See
|
241
241
|
# summary for details.
|
242
242
|
#
|
243
243
|
# @version SketchUp 6.0
|
@@ -260,7 +260,7 @@ class Sketchup::Material < Sketchup::Entity
|
|
260
260
|
# # to the UI like SketchUp does.
|
261
261
|
# puts material.display_name # Outputs "Joe"
|
262
262
|
#
|
263
|
-
# @return
|
263
|
+
# @return [String] the name of the Material object
|
264
264
|
#
|
265
265
|
# @version SketchUp 6.0
|
266
266
|
def name
|
@@ -273,7 +273,13 @@ class Sketchup::Material < Sketchup::Entity
|
|
273
273
|
# material = materials.add("Joe")
|
274
274
|
# material.name = 'Jeff'
|
275
275
|
#
|
276
|
-
# @
|
276
|
+
# @param [String] str
|
277
|
+
# the new material name
|
278
|
+
#
|
279
|
+
# @raise [ArgumentError] if the name is not unique to the model.
|
280
|
+
# (Added in SU2018)
|
281
|
+
#
|
282
|
+
# @return [String] the newly set material name.
|
277
283
|
#
|
278
284
|
# @version SketchUp 8.0 M1
|
279
285
|
def name=(str)
|
@@ -309,7 +315,7 @@ class Sketchup::Material < Sketchup::Entity
|
|
309
315
|
# material.texture = "C:/Materials/Carpet.jpg"
|
310
316
|
# texture = material.texture
|
311
317
|
#
|
312
|
-
# @return
|
318
|
+
# @return [Sketchup::Texture, nil] the Texture object within the Material.
|
313
319
|
# Returns nil if the Material does not have a texture.
|
314
320
|
#
|
315
321
|
# @version SketchUp 6.0
|
@@ -328,15 +334,20 @@ class Sketchup::Material < Sketchup::Entity
|
|
328
334
|
#
|
329
335
|
# @overload texture=(filename)
|
330
336
|
#
|
331
|
-
# @param [String]
|
332
|
-
#
|
337
|
+
# @param filename [String] The file path to the texture the material should use.
|
338
|
+
# @return [String]
|
339
|
+
#
|
340
|
+
# @overload texture=(image_rep)
|
341
|
+
#
|
342
|
+
# @param [Sketchup::ImageRep] image_rep The pixel data representing the
|
343
|
+
# texture. (Added in SketchUp 2018)
|
344
|
+
# @return [Sketchup::ImageRep]
|
333
345
|
#
|
334
346
|
# @overload texture=(properties)
|
335
347
|
#
|
336
|
-
# @param [Array
|
348
|
+
# @param properties [Array(String, Integer, Integer)] An array with the
|
337
349
|
# texture filename and optionally the width and height in model units.
|
338
|
-
#
|
339
|
-
# @return [Sketchup::Texture] the newly set Texture object
|
350
|
+
# @return [Array(String, Integer, Integer)]
|
340
351
|
#
|
341
352
|
# @version SketchUp 6.0
|
342
353
|
def texture=(arg)
|
@@ -351,8 +362,7 @@ class Sketchup::Material < Sketchup::Entity
|
|
351
362
|
# material = Sketchup.active_model.materials[0]
|
352
363
|
# is_alpha = material.use_alpha?
|
353
364
|
#
|
354
|
-
# @return
|
355
|
-
# summary for details.
|
365
|
+
# @return [Boolean]
|
356
366
|
#
|
357
367
|
# @return [Boolean]
|
358
368
|
#
|
@@ -369,13 +379,13 @@ class Sketchup::Material < Sketchup::Entity
|
|
369
379
|
# material.write_thumbnail(thumbnail_file, 128)
|
370
380
|
# }
|
371
381
|
#
|
372
|
-
# @param filename
|
382
|
+
# @param [String] filename
|
373
383
|
# The file name for the thumbnail.
|
374
384
|
#
|
375
|
-
# @param resolution
|
385
|
+
# @param [Integer] resolution
|
376
386
|
# The resolution of the thumbnail.
|
377
387
|
#
|
378
|
-
# @return
|
388
|
+
# @return [Boolean] true if successful, false if unsuccessful.
|
379
389
|
#
|
380
390
|
# @version SketchUp 8.0 M1
|
381
391
|
def write_thumbnail(filename, resolution)
|
@@ -29,14 +29,14 @@ class Sketchup::Materials < Sketchup::Entity
|
|
29
29
|
#
|
30
30
|
# @overload [](index)
|
31
31
|
#
|
32
|
-
# @param index
|
32
|
+
# @param index [Integer] A number representing the material's index in an array
|
33
33
|
# of Material objects.
|
34
|
-
# @return
|
34
|
+
# @return [Sketchup::Material, nil] a Material object on success, Nil on failure
|
35
35
|
#
|
36
36
|
# @overload [](name)
|
37
37
|
#
|
38
|
-
# @param name
|
39
|
-
# @return
|
38
|
+
# @param name [String] The name of the material.
|
39
|
+
# @return [Sketchup::Material, nil] a Material object on success, Nil on failure
|
40
40
|
#
|
41
41
|
# @version SketchUp 6.0
|
42
42
|
def [](arg)
|
@@ -53,10 +53,10 @@ class Sketchup::Materials < Sketchup::Entity
|
|
53
53
|
# materials = model.materials
|
54
54
|
# material = materials.add('Joe')
|
55
55
|
#
|
56
|
-
# @param name
|
56
|
+
# @param [String] name
|
57
57
|
# The name of the new material.
|
58
58
|
#
|
59
|
-
# @return
|
59
|
+
# @return [Sketchup::Material] a Material object
|
60
60
|
#
|
61
61
|
# @version SketchUp 6.0
|
62
62
|
def add(name)
|
@@ -69,10 +69,10 @@ class Sketchup::Materials < Sketchup::Entity
|
|
69
69
|
# materials = Sketchup.active_model.materials
|
70
70
|
# status = materials.add_observer(observer)
|
71
71
|
#
|
72
|
-
# @param observer
|
72
|
+
# @param [Object] observer
|
73
73
|
# An observer.
|
74
74
|
#
|
75
|
-
# @return
|
75
|
+
# @return [Boolean] true if successful, false if unsuccessful.
|
76
76
|
#
|
77
77
|
# @version SketchUp 6.0
|
78
78
|
def add_observer(observer)
|
@@ -89,14 +89,14 @@ class Sketchup::Materials < Sketchup::Entity
|
|
89
89
|
#
|
90
90
|
# @overload [](index)
|
91
91
|
#
|
92
|
-
# @param index
|
92
|
+
# @param index [Integer] A number representing the material's index in an array
|
93
93
|
# of Material objects.
|
94
|
-
# @return
|
94
|
+
# @return [Sketchup::Material, nil] a Material object on success, Nil on failure
|
95
95
|
#
|
96
96
|
# @overload [](name)
|
97
97
|
#
|
98
|
-
# @param name
|
99
|
-
# @return
|
98
|
+
# @param name [String] The name of the material.
|
99
|
+
# @return [Sketchup::Material, nil] a Material object on success, Nil on failure
|
100
100
|
#
|
101
101
|
# @version SketchUp 6.0
|
102
102
|
def at(arg)
|
@@ -125,7 +125,7 @@ class Sketchup::Materials < Sketchup::Entity
|
|
125
125
|
# @example
|
126
126
|
# current = Sketchup.active_model.materials.current
|
127
127
|
#
|
128
|
-
# @return
|
128
|
+
# @return [Sketchup::Material] a Material object.
|
129
129
|
#
|
130
130
|
# @version SketchUp 6.0
|
131
131
|
def current
|
@@ -138,10 +138,10 @@ class Sketchup::Materials < Sketchup::Entity
|
|
138
138
|
# materials = Sketchup.active_model.materials
|
139
139
|
# materials.current = materials[0]
|
140
140
|
#
|
141
|
-
# @param material
|
141
|
+
# @param [Sketchup::Material] material
|
142
142
|
# A Material object.
|
143
143
|
#
|
144
|
-
# @return
|
144
|
+
# @return [Sketchup::Material]
|
145
145
|
#
|
146
146
|
# @version SketchUp 6.0
|
147
147
|
def current=(material)
|
@@ -155,11 +155,11 @@ class Sketchup::Materials < Sketchup::Entity
|
|
155
155
|
# puts material.display_name
|
156
156
|
# }
|
157
157
|
#
|
158
|
-
# @return
|
158
|
+
# @return [nil]
|
159
159
|
#
|
160
160
|
# @version SketchUp 6.0
|
161
161
|
#
|
162
|
-
# @yield [
|
162
|
+
# @yield [Sketchup::Material] A variable that will hold each Material object as they
|
163
163
|
# are found.
|
164
164
|
def each
|
165
165
|
end
|
@@ -206,7 +206,7 @@ class Sketchup::Materials < Sketchup::Entity
|
|
206
206
|
# materials = Sketchup.active_model.materials
|
207
207
|
# materials.purge_unused
|
208
208
|
#
|
209
|
-
# @return
|
209
|
+
# @return [Sketchup::Materials] The Materials object.
|
210
210
|
#
|
211
211
|
# @version SketchUp 6.0
|
212
212
|
def purge_unused
|
@@ -241,10 +241,10 @@ class Sketchup::Materials < Sketchup::Entity
|
|
241
241
|
# material = materials.add('Joe')
|
242
242
|
# materials.remove(material)
|
243
243
|
#
|
244
|
-
# @param material
|
244
|
+
# @param [Sketchup::Material] material
|
245
245
|
# The material to remove.
|
246
246
|
#
|
247
|
-
# @return
|
247
|
+
# @return [Boolean] true if successful, false if unsuccessful.
|
248
248
|
#
|
249
249
|
# @version SketchUp 8.0 M1
|
250
250
|
def remove(material)
|
@@ -257,10 +257,10 @@ class Sketchup::Materials < Sketchup::Entity
|
|
257
257
|
# materials = Sketchup.active_model.materials
|
258
258
|
# status = materials.remove_observer(observer)
|
259
259
|
#
|
260
|
-
# @param observer
|
260
|
+
# @param [Object] observer
|
261
261
|
# An observer.
|
262
262
|
#
|
263
|
-
# @return
|
263
|
+
# @return [Boolean] true if successful, false if unsuccessful.
|
264
264
|
#
|
265
265
|
# @version SketchUp 6.0
|
266
266
|
def remove_observer(observer)
|
@@ -282,4 +282,22 @@ class Sketchup::Materials < Sketchup::Entity
|
|
282
282
|
def size
|
283
283
|
end
|
284
284
|
|
285
|
+
# The {#unique_name} method is used to retrieve a unique name from the
|
286
|
+
# materials collection that is based on the provided one. If provided name is
|
287
|
+
# unique it will be returned, otherwise any trailing indices will be replaced
|
288
|
+
# by a new index.
|
289
|
+
#
|
290
|
+
# @example
|
291
|
+
# materials = Sketchup.active_model.materials
|
292
|
+
# unique_name = materials.unique_name("test_name")
|
293
|
+
#
|
294
|
+
# @param [String] name
|
295
|
+
# the suggested name.
|
296
|
+
#
|
297
|
+
# @return [String] a unique name.
|
298
|
+
#
|
299
|
+
# @version SketchUp 2018
|
300
|
+
def unique_name(name)
|
301
|
+
end
|
302
|
+
|
285
303
|
end
|