sketchup-api-stubs 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/SketchUp/Geom/BoundingBox.rb +335 -0
- data/SketchUp/Geom/LatLong.rb +123 -0
- data/SketchUp/Geom/Point3d.rb +643 -0
- data/SketchUp/Geom/PolygonMesh.rb +478 -0
- data/SketchUp/Geom/Transformation.rb +476 -0
- data/SketchUp/Geom/UTM.rb +135 -0
- data/SketchUp/Geom/Vector3d.rb +684 -0
- data/SketchUp/Sketchup/Animation.rb +137 -0
- data/SketchUp/Sketchup/AppObserver.rb +157 -0
- data/SketchUp/Sketchup/ArcCurve.rb +209 -0
- data/SketchUp/Sketchup/AttributeDictionaries.rb +146 -0
- data/SketchUp/Sketchup/AttributeDictionary.rb +280 -0
- data/SketchUp/Sketchup/Axes.rb +149 -0
- data/SketchUp/Sketchup/Behavior.rb +338 -0
- data/SketchUp/Sketchup/Camera.rb +594 -0
- data/SketchUp/Sketchup/ClassificationSchema.rb +63 -0
- data/SketchUp/Sketchup/Classifications.rb +118 -0
- data/SketchUp/Sketchup/Color.rb +291 -0
- data/SketchUp/Sketchup/ComponentDefinition.rb +562 -0
- data/SketchUp/Sketchup/ComponentInstance.rb +597 -0
- data/SketchUp/Sketchup/Console.rb +78 -0
- data/SketchUp/Sketchup/ConstructionLine.rb +257 -0
- data/SketchUp/Sketchup/ConstructionPoint.rb +32 -0
- data/SketchUp/Sketchup/Curve.rb +196 -0
- data/SketchUp/Sketchup/DefinitionList.rb +312 -0
- data/SketchUp/Sketchup/DefinitionObserver.rb +73 -0
- data/SketchUp/Sketchup/DefinitionsObserver.rb +102 -0
- data/SketchUp/Sketchup/Dimension.rb +167 -0
- data/SketchUp/Sketchup/DimensionLinear.rb +232 -0
- data/SketchUp/Sketchup/DimensionObserver.rb +38 -0
- data/SketchUp/Sketchup/DimensionRadial.rb +87 -0
- data/SketchUp/Sketchup/Drawingelement.rb +400 -0
- data/SketchUp/Sketchup/Edge.rb +517 -0
- data/SketchUp/Sketchup/EdgeUse.rb +213 -0
- data/SketchUp/Sketchup/Entities.rb +1011 -0
- data/SketchUp/Sketchup/EntitiesObserver.rb +125 -0
- data/SketchUp/Sketchup/Entity.rb +522 -0
- data/SketchUp/Sketchup/EntityObserver.rb +59 -0
- data/SketchUp/Sketchup/ExtensionsManager.rb +129 -0
- data/SketchUp/Sketchup/Face.rb +737 -0
- data/SketchUp/Sketchup/FrameChangeObserver.rb +104 -0
- data/SketchUp/Sketchup/Group.rb +705 -0
- data/SketchUp/Sketchup/Http.rb +27 -0
- data/SketchUp/Sketchup/Http/Request.rb +285 -0
- data/SketchUp/Sketchup/Http/Response.rb +62 -0
- data/SketchUp/Sketchup/Image.rb +393 -0
- data/SketchUp/Sketchup/Importer.rb +192 -0
- data/SketchUp/Sketchup/InputPoint.rb +393 -0
- data/SketchUp/Sketchup/InstanceObserver.rb +82 -0
- data/SketchUp/Sketchup/InstancePath.rb +297 -0
- data/SketchUp/Sketchup/Layer.rb +240 -0
- data/SketchUp/Sketchup/Layers.rb +235 -0
- data/SketchUp/Sketchup/LayersObserver.rb +136 -0
- data/SketchUp/Sketchup/Licensing.rb +47 -0
- data/SketchUp/Sketchup/Licensing/ExtensionLicense.rb +88 -0
- data/SketchUp/Sketchup/Loop.rb +141 -0
- data/SketchUp/Sketchup/Material.rb +384 -0
- data/SketchUp/Sketchup/Materials.rb +283 -0
- data/SketchUp/Sketchup/MaterialsObserver.rb +141 -0
- data/SketchUp/Sketchup/Menu.rb +97 -0
- data/SketchUp/Sketchup/Model.rb +1459 -0
- data/SketchUp/Sketchup/ModelObserver.rb +356 -0
- data/SketchUp/Sketchup/OptionsManager.rb +135 -0
- data/SketchUp/Sketchup/OptionsProvider.rb +277 -0
- data/SketchUp/Sketchup/OptionsProviderObserver.rb +58 -0
- data/SketchUp/Sketchup/Page.rb +636 -0
- data/SketchUp/Sketchup/Pages.rb +349 -0
- data/SketchUp/Sketchup/PagesObserver.rb +76 -0
- data/SketchUp/Sketchup/PickHelper.rb +457 -0
- data/SketchUp/Sketchup/RegionalSettings.rb +43 -0
- data/SketchUp/Sketchup/RenderingOptions.rb +337 -0
- data/SketchUp/Sketchup/RenderingOptionsObserver.rb +44 -0
- data/SketchUp/Sketchup/SectionPlane.rb +88 -0
- data/SketchUp/Sketchup/Selection.rb +470 -0
- data/SketchUp/Sketchup/SelectionObserver.rb +115 -0
- data/SketchUp/Sketchup/Set.rb +253 -0
- data/SketchUp/Sketchup/ShadowInfo.rb +257 -0
- data/SketchUp/Sketchup/ShadowInfoObserver.rb +57 -0
- data/SketchUp/Sketchup/Style.rb +77 -0
- data/SketchUp/Sketchup/Styles.rb +204 -0
- data/SketchUp/Sketchup/Text.rb +241 -0
- data/SketchUp/Sketchup/Texture.rb +211 -0
- data/SketchUp/Sketchup/TextureWriter.rb +237 -0
- data/SketchUp/Sketchup/Tool.rb +808 -0
- data/SketchUp/Sketchup/Tools.rb +120 -0
- data/SketchUp/Sketchup/ToolsObserver.rb +154 -0
- data/SketchUp/Sketchup/UVHelper.rb +61 -0
- data/SketchUp/Sketchup/Vertex.rb +143 -0
- data/SketchUp/Sketchup/View.rb +965 -0
- data/SketchUp/Sketchup/ViewObserver.rb +40 -0
- data/SketchUp/UI/Command.rb +307 -0
- data/SketchUp/UI/HtmlDialog.rb +346 -0
- data/SketchUp/UI/Notification.rb +229 -0
- data/SketchUp/UI/Toolbar.rb +243 -0
- data/SketchUp/UI/WebDialog.rb +623 -0
- data/SketchUp/_top_level.rb +193 -0
- data/SketchUp/array.rb +593 -0
- data/SketchUp/geom.rb +231 -0
- data/SketchUp/languagehandler.rb +92 -0
- data/SketchUp/length.rb +210 -0
- data/SketchUp/numeric.rb +249 -0
- data/SketchUp/sketchup.rb +1290 -0
- data/SketchUp/sketchupextension.rb +355 -0
- data/SketchUp/string.rb +24 -0
- data/SketchUp/ui.rb +637 -0
- metadata +176 -0
@@ -0,0 +1,141 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# Loop is a low level topology class that will not need to be used often. A
|
5
|
+
# Loop is a chain of Edges that bound a Face.
|
6
|
+
#
|
7
|
+
# @version SketchUp 6.0
|
8
|
+
class Sketchup::Loop < Sketchup::Entity
|
9
|
+
|
10
|
+
# Instance Methods
|
11
|
+
|
12
|
+
# Determine if the loop is convex.
|
13
|
+
#
|
14
|
+
# @example
|
15
|
+
# entities = Sketchup.active_model.active_entities
|
16
|
+
# points = []
|
17
|
+
# points << Geom::Point3d.new(0, 0, 0)
|
18
|
+
# points << Geom::Point3d.new(100, 0, 0)
|
19
|
+
# points << Geom::Point3d.new(100, 200, 0)
|
20
|
+
# points << Geom::Point3d.new(0, 200, 0)
|
21
|
+
# face = entities.add_face(points)
|
22
|
+
# loop = face.outer_loop
|
23
|
+
# if loop.convex?
|
24
|
+
# puts "Loop is convex."
|
25
|
+
# else
|
26
|
+
# puts "Loop is not convex."
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
# @return status - true if convex, false if not convex.
|
30
|
+
#
|
31
|
+
# @return [Boolean]
|
32
|
+
#
|
33
|
+
# @version SketchUp 6.0
|
34
|
+
def convex?
|
35
|
+
end
|
36
|
+
|
37
|
+
# Get an array of the edges that define the loop in an ordered sequence.
|
38
|
+
#
|
39
|
+
# @example
|
40
|
+
# entities = Sketchup.active_model.active_entities
|
41
|
+
# points = []
|
42
|
+
# points << Geom::Point3d.new(0, 0, 0)
|
43
|
+
# points << Geom::Point3d.new(100, 0, 0)
|
44
|
+
# points << Geom::Point3d.new(100, 200, 0)
|
45
|
+
# points << Geom::Point3d.new(0, 200, 0)
|
46
|
+
# face = entities.add_face(points)
|
47
|
+
# loop = face.outer_loop
|
48
|
+
# edges = loop.edges
|
49
|
+
#
|
50
|
+
# @return edges - an array of Edge objects if successful.
|
51
|
+
#
|
52
|
+
# @version SketchUp 6.0
|
53
|
+
def edges
|
54
|
+
end
|
55
|
+
|
56
|
+
# Get an array of the EdgeUse objects that define this loop in an ordered
|
57
|
+
# sequence.
|
58
|
+
#
|
59
|
+
# @example
|
60
|
+
# entities = Sketchup.active_model.active_entities
|
61
|
+
# points = []
|
62
|
+
# points << Geom::Point3d.new(0, 0, 0)
|
63
|
+
# points << Geom::Point3d.new(100, 0, 0)
|
64
|
+
# points << Geom::Point3d.new(100, 200, 0)
|
65
|
+
# points << Geom::Point3d.new(0, 200, 0)
|
66
|
+
# face = entities.add_face(points)
|
67
|
+
# loop = face.outer_loop
|
68
|
+
# edgeuses = loop.edgeuses
|
69
|
+
#
|
70
|
+
# @return edgeuses - an array of EdgeUse objects if successful.
|
71
|
+
#
|
72
|
+
# @version SketchUp 6.0
|
73
|
+
def edgeuses
|
74
|
+
end
|
75
|
+
|
76
|
+
# Get the Face object that is bounded by this loop.
|
77
|
+
#
|
78
|
+
# @example
|
79
|
+
# entities = Sketchup.active_model.active_entities
|
80
|
+
# points = []
|
81
|
+
# points << Geom::Point3d.new(0, 0, 0)
|
82
|
+
# points << Geom::Point3d.new(100, 0, 0)
|
83
|
+
# points << Geom::Point3d.new(100, 200, 0)
|
84
|
+
# points << Geom::Point3d.new(0, 200, 0)
|
85
|
+
# face = entities.add_face(points)
|
86
|
+
# loop = face.outer_loop
|
87
|
+
# loop_face = loop.face
|
88
|
+
#
|
89
|
+
# @return face - a Face object if successful
|
90
|
+
#
|
91
|
+
# @version SketchUp 6.0
|
92
|
+
def face
|
93
|
+
end
|
94
|
+
|
95
|
+
# Determine if this is an outer loop. Each face has one outer loop, and will
|
96
|
+
# have one loop for each hole.
|
97
|
+
#
|
98
|
+
# @example
|
99
|
+
# entities = Sketchup.active_model.active_entities
|
100
|
+
# points = []
|
101
|
+
# points << Geom::Point3d.new(0, 0, 0)
|
102
|
+
# points << Geom::Point3d.new(100, 0, 0)
|
103
|
+
# points << Geom::Point3d.new(100, 200, 0)
|
104
|
+
# points << Geom::Point3d.new(0, 200, 0)
|
105
|
+
# face = entities.add_face(points)
|
106
|
+
# loop = face.outer_loop
|
107
|
+
# if loop.outer?
|
108
|
+
# puts "Loop is an outer loop."
|
109
|
+
# else
|
110
|
+
# puts "Loop is not an outer loop."
|
111
|
+
# end
|
112
|
+
#
|
113
|
+
# @return status - true if the loop is an outer loop, false if it
|
114
|
+
# is not an outer loop.
|
115
|
+
#
|
116
|
+
# @return [Boolean]
|
117
|
+
#
|
118
|
+
# @version SketchUp 6.0
|
119
|
+
def outer?
|
120
|
+
end
|
121
|
+
|
122
|
+
# Get an array of the vertices that define the loop in an ordered sequence.
|
123
|
+
#
|
124
|
+
# @example
|
125
|
+
# entities = Sketchup.active_model.active_entities
|
126
|
+
# points = []
|
127
|
+
# points << Geom::Point3d.new(0, 0, 0)
|
128
|
+
# points << Geom::Point3d.new(100, 0, 0)
|
129
|
+
# points << Geom::Point3d.new(100, 200, 0)
|
130
|
+
# points << Geom::Point3d.new(0, 200, 0)
|
131
|
+
# face = entities.add_face(points)
|
132
|
+
# loop = face.outer_loop
|
133
|
+
# vertices = loop.vertices
|
134
|
+
#
|
135
|
+
# @return vertices - an array of Vertex objects if successful.
|
136
|
+
#
|
137
|
+
# @version SketchUp 6.0
|
138
|
+
def vertices
|
139
|
+
end
|
140
|
+
|
141
|
+
end
|
@@ -0,0 +1,384 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The Material class represents a texture or color that can be applied to
|
5
|
+
# Drawingelements. It is most often applied to Faces.
|
6
|
+
#
|
7
|
+
# You can pass any object that can be used as a material to a method that
|
8
|
+
# requires a material. Objects include actual materials, color, and classes
|
9
|
+
# that can be converted to a color.
|
10
|
+
#
|
11
|
+
# The following are valid (assuming the existence of a Material mat1.)
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# face.material = mat1
|
15
|
+
# face.material = "red"
|
16
|
+
# face.material = 0xff0000
|
17
|
+
#
|
18
|
+
# @version SketchUp 6.0
|
19
|
+
class Sketchup::Material < Sketchup::Entity
|
20
|
+
|
21
|
+
# Includes
|
22
|
+
|
23
|
+
include Comparable
|
24
|
+
|
25
|
+
# Constants
|
26
|
+
|
27
|
+
COLORIZE_SHIFT = nil # Stub value.
|
28
|
+
COLORIZE_TINT = nil # Stub value.
|
29
|
+
|
30
|
+
MATERIAL_COLORIZED_TEXTURED = nil # Stub value.
|
31
|
+
MATERIAL_SOLID = nil # Stub value.
|
32
|
+
MATERIAL_TEXTURED = nil # Stub value.
|
33
|
+
|
34
|
+
# Instance Methods
|
35
|
+
|
36
|
+
# The <=> method is used to compare two materials based on name. The number
|
37
|
+
# returned relates to the "string distance" between the names.
|
38
|
+
#
|
39
|
+
# @example
|
40
|
+
# model = Sketchup.active_model
|
41
|
+
# materials = model.materials
|
42
|
+
# m1 = materials.add('Joe')
|
43
|
+
# m2 = materials.add('Fred')
|
44
|
+
# p m1 <=> m2
|
45
|
+
#
|
46
|
+
# @param material2
|
47
|
+
# A Material object.
|
48
|
+
#
|
49
|
+
# @return status - 0 if they are equal, positive number if
|
50
|
+
# material1 > material2, negative if material1 < material2
|
51
|
+
#
|
52
|
+
# @version SketchUp 6.0
|
53
|
+
def <=>(material2)
|
54
|
+
end
|
55
|
+
|
56
|
+
# The == method is used to test if two materials are the same.
|
57
|
+
#
|
58
|
+
# @example
|
59
|
+
# model = Sketchup.active_model
|
60
|
+
# materials = model.materials
|
61
|
+
# m1 = materials.add('Joe')
|
62
|
+
# m2 = materials.add('Fred')
|
63
|
+
# if (m1 == m2)
|
64
|
+
# UI.messagebox('The Materials are equal.')
|
65
|
+
# else
|
66
|
+
# UI.messagebox('The Materials are not equal.')
|
67
|
+
# end
|
68
|
+
#
|
69
|
+
# @param material2
|
70
|
+
# A Material object.
|
71
|
+
#
|
72
|
+
# @return status - true if the materials are the same, false if
|
73
|
+
# they are different
|
74
|
+
#
|
75
|
+
# @version SketchUp 6.0
|
76
|
+
def ==(material2)
|
77
|
+
end
|
78
|
+
|
79
|
+
# The alpha method is used to get the opacity of the material.
|
80
|
+
#
|
81
|
+
# The value will be between 0.0 and 1.0. A value of 0.0 means that the material is
|
82
|
+
# completely transparent. A value of 1.0 means that the Material is completely
|
83
|
+
# opaque.
|
84
|
+
#
|
85
|
+
# @example
|
86
|
+
# alpha_value = Sketchup.active_model.materials[0].alpha
|
87
|
+
#
|
88
|
+
# @return alpha - a number between 0 and 1
|
89
|
+
#
|
90
|
+
# @version SketchUp 6.0
|
91
|
+
def alpha
|
92
|
+
end
|
93
|
+
|
94
|
+
# The alpha= method is used to set the opacity of the material.
|
95
|
+
#
|
96
|
+
# The value must be between 0.0 and 1.0. A value of 0.0 means that the material is
|
97
|
+
# completely transparent. A value of 1.0 means that the Material is completely
|
98
|
+
# opaque.
|
99
|
+
#
|
100
|
+
# @example
|
101
|
+
# model = Sketchup.active_model
|
102
|
+
# materials = model.materials
|
103
|
+
# material = materials.add('Joe')
|
104
|
+
# material.alpha = 0.5
|
105
|
+
#
|
106
|
+
# @param alpha
|
107
|
+
# An opacity value.
|
108
|
+
#
|
109
|
+
# @return status - the newly set opacity value
|
110
|
+
#
|
111
|
+
# @version SketchUp 6.0
|
112
|
+
def alpha=(alpha)
|
113
|
+
end
|
114
|
+
|
115
|
+
# The color method is used to retrieve the color of the material.
|
116
|
+
#
|
117
|
+
# If it uses a Texture, this will return the average color.
|
118
|
+
#
|
119
|
+
# @example
|
120
|
+
# model = Sketchup.active_model
|
121
|
+
# materials = model.materials
|
122
|
+
# material = materials.add('Joe')
|
123
|
+
# material.color = 'red'
|
124
|
+
# color = material.color
|
125
|
+
#
|
126
|
+
# @return color - a Color object
|
127
|
+
#
|
128
|
+
# @version SketchUp 6.0
|
129
|
+
def color
|
130
|
+
end
|
131
|
+
|
132
|
+
# The color= method is used to set the color of the material.
|
133
|
+
#
|
134
|
+
# If the Material has a texture, then this turns it into a colorized
|
135
|
+
# texture.
|
136
|
+
#
|
137
|
+
# To reset the color of a Material with a texture, set the color
|
138
|
+
# to nil.
|
139
|
+
#
|
140
|
+
# @example
|
141
|
+
# model = Sketchup.active_model
|
142
|
+
# materials = model.materials
|
143
|
+
# material = materials.add('Joe')
|
144
|
+
# material.color = 'red'
|
145
|
+
#
|
146
|
+
# @param color
|
147
|
+
# A Color object.
|
148
|
+
#
|
149
|
+
# @return color - the newly set Color object's name
|
150
|
+
#
|
151
|
+
# @version SketchUp 6.0
|
152
|
+
def color=(color)
|
153
|
+
end
|
154
|
+
|
155
|
+
# The colorize_deltas method retrieves the HLS delta for colorized materials.
|
156
|
+
#
|
157
|
+
# @example
|
158
|
+
# material = Sketchup.active_model.materials[0]
|
159
|
+
# h, l, s = material.colorize_deltas
|
160
|
+
#
|
161
|
+
# @return Array - An array of floats representing the HLS delta.
|
162
|
+
#
|
163
|
+
# @version SketchUp 2015
|
164
|
+
def colorize_deltas
|
165
|
+
end
|
166
|
+
|
167
|
+
# The colorize_type method retrieves the type of colorization of the material.
|
168
|
+
# This value is only relevant when the materialType is set to 2
|
169
|
+
# (colorized textured).
|
170
|
+
# Types include:
|
171
|
+
#
|
172
|
+
# - 0 = shift (Sketchup::Material::COLORIZE_SHIFT),
|
173
|
+
# - 1 = tint (Sketchup::Material::COLORIZE_TINT),
|
174
|
+
#
|
175
|
+
# @example
|
176
|
+
# material = Sketchup.active_model.materials[0]
|
177
|
+
# type = material.colorize_type
|
178
|
+
#
|
179
|
+
# @return type - the colorize type for the Material object.
|
180
|
+
#
|
181
|
+
# @version SketchUp 2015
|
182
|
+
def colorize_type
|
183
|
+
end
|
184
|
+
|
185
|
+
# The colorize_type method set the type of colorization of the material.
|
186
|
+
# This value is only relevant when the materialType is set to 2
|
187
|
+
# (colorized textured).
|
188
|
+
# Types include:
|
189
|
+
#
|
190
|
+
# - 0 = shift (Sketchup::Material::COLORIZE_SHIFT),
|
191
|
+
# - 1 = tint (Sketchup::Material::COLORIZE_TINT),
|
192
|
+
#
|
193
|
+
# @example
|
194
|
+
# material = Sketchup.active_model.materials[0]
|
195
|
+
# material.colorize_type = Sketchup::Material::COLORIZE_TINT
|
196
|
+
#
|
197
|
+
# @param type
|
198
|
+
# - the new colorize type for the Material object.
|
199
|
+
#
|
200
|
+
# @return type - the colorize type for the Material object.
|
201
|
+
#
|
202
|
+
# @version SketchUp 2015
|
203
|
+
def colorize_type=(type)
|
204
|
+
end
|
205
|
+
|
206
|
+
# The display_name method retrieves the name that is displayed within SketchUp
|
207
|
+
# for the material.
|
208
|
+
#
|
209
|
+
# This should be used when presenting the name in the UI, but the returned name
|
210
|
+
# cannot be used as a key in model.materials.
|
211
|
+
#
|
212
|
+
# @example
|
213
|
+
# model = Sketchup.active_model
|
214
|
+
# materials = model.materials
|
215
|
+
# material = materials.add('[Joe]')
|
216
|
+
# # Use .name for the internal name of a material
|
217
|
+
# puts material.name # Outputs "[Joe]"
|
218
|
+
# # Use .display_name for presenting the material name
|
219
|
+
# # to the UI like SketchUp does.
|
220
|
+
# puts material.display_name # Outputs "Joe"
|
221
|
+
#
|
222
|
+
# @return name - the display name for the material
|
223
|
+
#
|
224
|
+
# @version SketchUp 6.0
|
225
|
+
def display_name
|
226
|
+
end
|
227
|
+
|
228
|
+
# The materialType method retrieves the type of the material. Types include:
|
229
|
+
#
|
230
|
+
# - 0 = solid (Sketchup::Material::MATERIAL_SOLID),
|
231
|
+
# - 1 = textured (Sketchup::Material::MATERIAL_TEXTURED),
|
232
|
+
# - 2 = colorized textured (Sketchup::Material::MATERIAL_COLORIZED_TEXTURED).
|
233
|
+
#
|
234
|
+
# The constants where added in SketchUp 2015.
|
235
|
+
#
|
236
|
+
# @example
|
237
|
+
# material = Sketchup.active_model.materials[0]
|
238
|
+
# type = material.materialType
|
239
|
+
#
|
240
|
+
# @return type - the material type for the Material object. See
|
241
|
+
# summary for details.
|
242
|
+
#
|
243
|
+
# @version SketchUp 6.0
|
244
|
+
def materialType
|
245
|
+
end
|
246
|
+
|
247
|
+
# The name method retrieves the name of the material. This is the
|
248
|
+
# internal name of the object which should be used for retrieving
|
249
|
+
# the material from the model's material list.
|
250
|
+
#
|
251
|
+
# Use .display_name to display the name in the UI.
|
252
|
+
#
|
253
|
+
# @example
|
254
|
+
# model = Sketchup.active_model
|
255
|
+
# materials = model.materials
|
256
|
+
# material = materials.add('[Joe]')
|
257
|
+
# # Use .name for the internal name of a material
|
258
|
+
# puts material.name # Outputs "[Joe]"
|
259
|
+
# # Use .display_name for presenting the material name
|
260
|
+
# # to the UI like SketchUp does.
|
261
|
+
# puts material.display_name # Outputs "Joe"
|
262
|
+
#
|
263
|
+
# @return name - the name of the Material object
|
264
|
+
#
|
265
|
+
# @version SketchUp 6.0
|
266
|
+
def name
|
267
|
+
end
|
268
|
+
|
269
|
+
# Sets the name of the material.
|
270
|
+
#
|
271
|
+
# @example
|
272
|
+
# materials = Sketchup.active_model.materials
|
273
|
+
# material = materials.add("Joe")
|
274
|
+
# material.name = 'Jeff'
|
275
|
+
#
|
276
|
+
# @return name - the newly set material name.
|
277
|
+
#
|
278
|
+
# @version SketchUp 8.0 M1
|
279
|
+
def name=(str)
|
280
|
+
end
|
281
|
+
|
282
|
+
# The {#save_as} method is used to write a material to a SKM file.
|
283
|
+
#
|
284
|
+
# You must remember to append ".skm" to the filename as this will not be done
|
285
|
+
# automatically.
|
286
|
+
#
|
287
|
+
# @example
|
288
|
+
# filename = File.join(ENV['HOME'], 'Desktop', 'su_test.skm')
|
289
|
+
# materials = Sketchup.active_model.materials
|
290
|
+
# material = materials.add("Hello World")
|
291
|
+
# material.color = 'red'
|
292
|
+
# material.save_as(filename)
|
293
|
+
#
|
294
|
+
# @param [String] filename
|
295
|
+
# the path to the SKM file to load.
|
296
|
+
#
|
297
|
+
# @return [Boolean] `true` if successful
|
298
|
+
#
|
299
|
+
# @version SketchUp 2017
|
300
|
+
def save_as(filename)
|
301
|
+
end
|
302
|
+
|
303
|
+
# The texture method retrieves the texture of the material.
|
304
|
+
#
|
305
|
+
# @example
|
306
|
+
# model = Sketchup.active_model
|
307
|
+
# materials = model.materials
|
308
|
+
# material = materials.add('Joe')
|
309
|
+
# material.texture = "C:/Materials/Carpet.jpg"
|
310
|
+
# texture = material.texture
|
311
|
+
#
|
312
|
+
# @return texture - the Texture object within the Material.
|
313
|
+
# Returns nil if the Material does not have a texture.
|
314
|
+
#
|
315
|
+
# @version SketchUp 6.0
|
316
|
+
def texture
|
317
|
+
end
|
318
|
+
|
319
|
+
# The texture= method sets the texture for the material.
|
320
|
+
#
|
321
|
+
# Setting the texture to +nil+ will turn it into a solid color
|
322
|
+
#
|
323
|
+
# @example
|
324
|
+
# model = Sketchup.active_model
|
325
|
+
# materials = model.materials
|
326
|
+
# material = materials.add('Joe')
|
327
|
+
# material.texture = "C:/Materials/Carpet.jpg"
|
328
|
+
#
|
329
|
+
# @overload texture=(filename)
|
330
|
+
#
|
331
|
+
# @param [String] filename The file path to the texture the material should
|
332
|
+
# use.
|
333
|
+
#
|
334
|
+
# @overload texture=(properties)
|
335
|
+
#
|
336
|
+
# @param [Array<String, Integer, Integer>] properties An array with the
|
337
|
+
# texture filename and optionally the width and height in model units.
|
338
|
+
#
|
339
|
+
# @return [Sketchup::Texture] the newly set Texture object
|
340
|
+
#
|
341
|
+
# @version SketchUp 6.0
|
342
|
+
def texture=(arg)
|
343
|
+
end
|
344
|
+
|
345
|
+
# The use_alpha? method tells if the material uses transparency.
|
346
|
+
#
|
347
|
+
# Note that this is not affected by the alpha value of the color object. Only
|
348
|
+
# the .alpha value and transparent texture will make this method return true.
|
349
|
+
#
|
350
|
+
# @example
|
351
|
+
# material = Sketchup.active_model.materials[0]
|
352
|
+
# is_alpha = material.use_alpha?
|
353
|
+
#
|
354
|
+
# @return type - the material type for the Material object. See
|
355
|
+
# summary for details.
|
356
|
+
#
|
357
|
+
# @return [Boolean]
|
358
|
+
#
|
359
|
+
# @version SketchUp 6.0
|
360
|
+
def use_alpha?
|
361
|
+
end
|
362
|
+
|
363
|
+
# The write_thumbnail method writes a bitmap thumbnail to the given file name.
|
364
|
+
#
|
365
|
+
# @example
|
366
|
+
# model = Sketchup.active_model
|
367
|
+
# model.materials.each { |material|
|
368
|
+
# thumbnail_file = "C:/tmp/materials/#{material.display_name}.png"
|
369
|
+
# material.write_thumbnail(thumbnail_file, 128)
|
370
|
+
# }
|
371
|
+
#
|
372
|
+
# @param filename
|
373
|
+
# The file name for the thumbnail.
|
374
|
+
#
|
375
|
+
# @param resolution
|
376
|
+
# The resolution of the thumbnail.
|
377
|
+
#
|
378
|
+
# @return status - true if successful, false if unsuccessful.
|
379
|
+
#
|
380
|
+
# @version SketchUp 8.0 M1
|
381
|
+
def write_thumbnail(filename, resolution)
|
382
|
+
end
|
383
|
+
|
384
|
+
end
|