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
@@ -0,0 +1,135 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# A {Layout::TableColumn} is a single row from a table.
|
5
|
+
#
|
6
|
+
# @example
|
7
|
+
# bounds = Geom::Bounds2d.new(1, 1, 4, 4)
|
8
|
+
# rows = 4
|
9
|
+
# columns = 4
|
10
|
+
# table = Layout::Table.new(bounds, rows, columns)
|
11
|
+
# rows.times { |index|
|
12
|
+
# row = table.row(index)
|
13
|
+
# }
|
14
|
+
#
|
15
|
+
# @version LayOut 2018
|
16
|
+
class Layout::TableRow
|
17
|
+
|
18
|
+
# Instance Methods
|
19
|
+
|
20
|
+
# The {#bottom_edge_style} method returns the {Layout::Style} of a
|
21
|
+
# {Layout::TableRow}'s bottom edge.
|
22
|
+
#
|
23
|
+
# @example
|
24
|
+
# bounds = Geom::Bounds2d.new(1, 1, 4, 4)
|
25
|
+
# rows = 4
|
26
|
+
# columns = 4
|
27
|
+
# table = Layout::Table.new(bounds, rows, columns)
|
28
|
+
# style = table.get_row(1).bottom_edge_style
|
29
|
+
#
|
30
|
+
# @return [Layout::Style]
|
31
|
+
#
|
32
|
+
# @version LayOut 2018
|
33
|
+
def bottom_edge_style
|
34
|
+
end
|
35
|
+
|
36
|
+
# The {#bottom_edge_style=} method sets the {Layout::Style} of a
|
37
|
+
# {Layout::TableRow}'s bottom edge.
|
38
|
+
#
|
39
|
+
# @example
|
40
|
+
# bounds = Geom::Bounds2d.new(1, 1, 4, 4)
|
41
|
+
# rows = 4
|
42
|
+
# columns = 4
|
43
|
+
# table = Layout::Table.new(bounds, rows, columns)
|
44
|
+
# style = Layout::Style.new
|
45
|
+
# style.stroke_width = 2.0
|
46
|
+
# table.get_row(1).bottom_edge_style = style
|
47
|
+
#
|
48
|
+
# @param [Layout::Style] style
|
49
|
+
#
|
50
|
+
# @raise [LockedEntityError] if the {Layout::Table} is locked
|
51
|
+
#
|
52
|
+
# @raise [LockedLayerError] if the {Layout::Table} is on a locked
|
53
|
+
# {Layout::Layer}
|
54
|
+
#
|
55
|
+
# @version LayOut 2018
|
56
|
+
def bottom_edge_style=(style)
|
57
|
+
end
|
58
|
+
|
59
|
+
# The {#height} method returns the height of the {Layout::TableRow}.
|
60
|
+
#
|
61
|
+
# @example
|
62
|
+
# bounds = Geom::Bounds2d.new(1, 1, 4, 4)
|
63
|
+
# rows = 4
|
64
|
+
# columns = 4
|
65
|
+
# table = Layout::Table.new(bounds, rows, columns)
|
66
|
+
# height = table.get_row(1).height
|
67
|
+
#
|
68
|
+
# @return [Float]
|
69
|
+
#
|
70
|
+
# @version LayOut 2018
|
71
|
+
def height
|
72
|
+
end
|
73
|
+
|
74
|
+
# The {#height=} method sets the height of the {Layout::TableRow}.
|
75
|
+
#
|
76
|
+
# @example
|
77
|
+
# bounds = Geom::Bounds2d.new(1, 1, 4, 4)
|
78
|
+
# rows = 4
|
79
|
+
# columns = 4
|
80
|
+
# table = Layout::Table.new(bounds, rows, columns)
|
81
|
+
# table.get_row(1).height = 3.0
|
82
|
+
#
|
83
|
+
# @param [Float] height
|
84
|
+
#
|
85
|
+
# @raise [ArgumentError] if height is not a valid height
|
86
|
+
#
|
87
|
+
# @raise [LockedEntityError] if the {Layout::Table} is locked
|
88
|
+
#
|
89
|
+
# @raise [LockedLayerError] if the {Layout::Table} is on a locked
|
90
|
+
# {Layout::Layer}
|
91
|
+
#
|
92
|
+
# @version LayOut 2018
|
93
|
+
def height=(height)
|
94
|
+
end
|
95
|
+
|
96
|
+
# The {#top_edge_style} method returns the {Layout::Style} of a
|
97
|
+
# {Layout::TableRow}'s top edge.
|
98
|
+
#
|
99
|
+
# @example
|
100
|
+
# bounds = Geom::Bounds2d.new(1, 1, 4, 4)
|
101
|
+
# rows = 4
|
102
|
+
# columns = 4
|
103
|
+
# table = Layout::Table.new(bounds, rows, columns)
|
104
|
+
# style = table.get_row(1).top_edge_style
|
105
|
+
#
|
106
|
+
# @return [Layout::Style]
|
107
|
+
#
|
108
|
+
# @version LayOut 2018
|
109
|
+
def top_edge_style
|
110
|
+
end
|
111
|
+
|
112
|
+
# The {#top_edge_style=} method sets the {Layout::Style} of a
|
113
|
+
# {Layout::TableRow}'s top edge.
|
114
|
+
#
|
115
|
+
# @example
|
116
|
+
# bounds = Geom::Bounds2d.new(1, 1, 4, 4)
|
117
|
+
# rows = 4
|
118
|
+
# columns = 4
|
119
|
+
# table = Layout::Table.new(bounds, rows, columns)
|
120
|
+
# style = Layout::Style.new
|
121
|
+
# style.stroke_width = 2.0
|
122
|
+
# table.get_row(1).top_edge_style = style
|
123
|
+
#
|
124
|
+
# @param [Layout::Style] style
|
125
|
+
#
|
126
|
+
# @raise [LockedEntityError] if the {Layout::Table} is locked
|
127
|
+
#
|
128
|
+
# @raise [LockedLayerError] if the {Layout::Table} is on a locked
|
129
|
+
# {Layout::Layer}
|
130
|
+
#
|
131
|
+
# @version LayOut 2018
|
132
|
+
def top_edge_style=(style)
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
@@ -121,12 +121,15 @@ class Sketchup::Animation
|
|
121
121
|
# an example of this.
|
122
122
|
#
|
123
123
|
# @example
|
124
|
-
#
|
125
|
-
#
|
124
|
+
# class MyAnimation
|
125
|
+
# def stop
|
126
|
+
# # Insert your handler code for cleaning up after your animation.
|
127
|
+
# end
|
126
128
|
# end
|
127
129
|
#
|
128
|
-
# @note Do not call
|
129
|
-
# a recursive loop and crash SketchUp.
|
130
|
+
# @note Do not call {#Sketchup::View#animation=} from this method. This will
|
131
|
+
# cause a recursive loop and crash SketchUp 2017 and earlier versions.
|
132
|
+
# As of SketchUp 2018 this will raise a +RunTimeError+.
|
130
133
|
#
|
131
134
|
# @return [nil]
|
132
135
|
#
|
@@ -53,24 +53,24 @@ class Sketchup::ArcCurve < Sketchup::Curve
|
|
53
53
|
def center
|
54
54
|
end
|
55
55
|
|
56
|
-
# The end_angle method is used to retrieve the angle of the end of the arc
|
56
|
+
# The {#end_angle} method is used to retrieve the angle of the end of the arc
|
57
57
|
# measured from the X axis in radians.
|
58
58
|
#
|
59
59
|
# @example
|
60
60
|
# # Create a 1/2 circle, normal to the Z axis
|
61
|
-
# center = Geom::Point3d.new
|
62
|
-
# normal = Geom::Vector3d.new 0,0,1
|
63
|
-
# xaxis = Geom::Vector3d.new 1,0,0
|
64
61
|
# start_a = 0.0
|
65
|
-
# end_a =
|
62
|
+
# end_a = 180.degrees
|
66
63
|
# model = Sketchup.active_model
|
67
64
|
# entities = model.entities
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#
|
71
|
-
#
|
65
|
+
# edges = entities.add_arc(ORIGIN, X_AXIS, Z_AXIS, 5, start_a, end_a)
|
66
|
+
# arc_curve = edges.first.curve
|
67
|
+
# end_angle = arc_curve.end_angle
|
68
|
+
#
|
69
|
+
# @note A bug in SketchUp 2017 and older will report the end-angle for some
|
70
|
+
# circles as more than 360 degrees. In such case, subtract +2 * PI+ from
|
71
|
+
# the end angle value.
|
72
72
|
#
|
73
|
-
# @return
|
73
|
+
# @return [Float]
|
74
74
|
#
|
75
75
|
# @version SketchUp 6.0
|
76
76
|
def end_angle
|
@@ -42,10 +42,10 @@ class Sketchup::AttributeDictionaries < Sketchup::Entity
|
|
42
42
|
# UI.messagebox("No dictionary found.")
|
43
43
|
# end
|
44
44
|
#
|
45
|
-
# @param key
|
45
|
+
# @param [String] key
|
46
46
|
# The name of the attribute dictionary.
|
47
47
|
#
|
48
|
-
# @return
|
48
|
+
# @return [Sketchup::AttributeDictionary] the dictionary
|
49
49
|
#
|
50
50
|
# @version SketchUp 6.0
|
51
51
|
def [](key)
|
@@ -71,17 +71,26 @@ class Sketchup::AttributeDictionaries < Sketchup::Entity
|
|
71
71
|
# AttributeDictionary can be passed directly or identified by its
|
72
72
|
# string name.
|
73
73
|
#
|
74
|
+
# In SketchUp 2018, special attribute dictionaries have been added. The name of
|
75
|
+
# these dictionaries are "SU_InstanceSet" and "SU_DefinitionSet". The
|
76
|
+
# dictionaries cannot be deleted via ruby and an ArgumentError will be raised.
|
77
|
+
# The key/value pairs in the dictionary can be deleted safely.
|
78
|
+
#
|
79
|
+
# object
|
80
|
+
#
|
74
81
|
# @example
|
75
82
|
# model = Sketchup.active_model
|
76
83
|
# attrdicts = model.attribute_dictionaries
|
77
84
|
# # Deletes a dictionary called 'my_dictionary'
|
78
85
|
# attrdicts.delete 'my_dictionary'
|
79
86
|
#
|
80
|
-
# @param key_or_dict
|
87
|
+
# @param [String, Sketchup::AttributeDictionary] key_or_dict
|
81
88
|
# The name of the attribute dictionary to delete, or
|
82
89
|
# the dictionary object itself.
|
83
90
|
#
|
84
|
-
# @
|
91
|
+
# @raise ArgumentError if an advanced attribute dictionary is being deleted.
|
92
|
+
#
|
93
|
+
# @return [Sketchup::AttributeDictionaries] the modified AttributeDictionaries
|
85
94
|
#
|
86
95
|
# @version SketchUp 6.0
|
87
96
|
def delete(key_or_dict)
|
@@ -31,10 +31,10 @@ class Sketchup::AttributeDictionary < Sketchup::Entity
|
|
31
31
|
# # value will contain 115
|
32
32
|
# value = attrdict["test"]
|
33
33
|
#
|
34
|
-
# @param key
|
34
|
+
# @param [String] key
|
35
35
|
# The name of the attribute.
|
36
36
|
#
|
37
|
-
# @return
|
37
|
+
# @return [Object, nil] the attribute stored under your key, or
|
38
38
|
# nil if not found
|
39
39
|
#
|
40
40
|
# @version SketchUp 6.0
|
@@ -56,13 +56,13 @@ class Sketchup::AttributeDictionary < Sketchup::Entity
|
|
56
56
|
# UI.messagebox value
|
57
57
|
# end
|
58
58
|
#
|
59
|
-
# @param key
|
59
|
+
# @param [String] key
|
60
60
|
# The valid key.
|
61
61
|
#
|
62
|
-
# @param value
|
62
|
+
# @param [Boolean, Fixnum, Float, Length, nil, String, Time, Array, Geom::Point3d, Geom::Vector3d] value
|
63
63
|
# The value to be set.
|
64
64
|
#
|
65
|
-
# @return
|
65
|
+
# @return [Object, nil] the value that was set if successful, or false
|
66
66
|
# if unsuccessful.
|
67
67
|
#
|
68
68
|
# @version SketchUp 6.0
|
@@ -88,18 +88,18 @@ class Sketchup::AttributeDictionary < Sketchup::Entity
|
|
88
88
|
# @example
|
89
89
|
# create_if_nil = true
|
90
90
|
# model = Sketchup.active_model
|
91
|
-
# attrdict = model.attribute_dictionary
|
91
|
+
# attrdict = model.attribute_dictionary("test_dict", create_if_nil)
|
92
92
|
# attrdict["attr_one"] = "one"
|
93
93
|
# attrdict["attr_two"] = "two"
|
94
94
|
#
|
95
|
-
# #
|
95
|
+
# # Delete a key/value pair and get the deleted value.
|
96
96
|
# attrdict = model.attribute_dictionaries['test_dict']
|
97
97
|
# value = attrdict.delete_key("attr_one")
|
98
98
|
#
|
99
|
-
# @param key
|
99
|
+
# @param [String] key
|
100
100
|
# The key to be deleted.
|
101
101
|
#
|
102
|
-
# @return
|
102
|
+
# @return [Object, nil] the value of the key
|
103
103
|
#
|
104
104
|
# @version SketchUp 6.0
|
105
105
|
def delete_key(key)
|
@@ -198,7 +198,7 @@ class Sketchup::AttributeDictionary < Sketchup::Entity
|
|
198
198
|
# attrdict = model.attribute_dictionaries['test_dict']
|
199
199
|
# keys = attrdict.keys
|
200
200
|
#
|
201
|
-
# @return
|
201
|
+
# @return [Array<String>] an array of keys within the attribute dictionary
|
202
202
|
# if successful
|
203
203
|
#
|
204
204
|
# @version SketchUp 6.0
|
@@ -234,7 +234,7 @@ class Sketchup::AttributeDictionary < Sketchup::Entity
|
|
234
234
|
# # Show the name.
|
235
235
|
# UI.messagebox attrdict.name
|
236
236
|
#
|
237
|
-
# @return
|
237
|
+
# @return [String] the name of the attribute dictionary if
|
238
238
|
# successful
|
239
239
|
#
|
240
240
|
# @version SketchUp 6.0
|
@@ -271,7 +271,7 @@ class Sketchup::AttributeDictionary < Sketchup::Entity
|
|
271
271
|
# attrdict = model.attribute_dictionaries['test_dict']
|
272
272
|
# values = attrdict.values
|
273
273
|
#
|
274
|
-
# @return
|
274
|
+
# @return [Array<Object>] an array of values within the attribute dictionary
|
275
275
|
# if successful
|
276
276
|
#
|
277
277
|
# @version SketchUp 6.0
|
data/SketchUp/Sketchup/Color.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
4
|
# The Color class is used to create and manipulate colors within SketchUp
|
5
|
-
#
|
5
|
+
# Models. The class can also be used the same way with LayOut documents.
|
6
6
|
#
|
7
7
|
# For methods that accept a Color object, such as the
|
8
8
|
# face.material method, you can pass in an actual Color object, or an object
|
@@ -10,7 +10,6 @@
|
|
10
10
|
#
|
11
11
|
# SketchUp ships with several built in colors in the Materials Browser.
|
12
12
|
# These colors are listed in the following table.
|
13
|
-
#
|
14
13
|
# {include:file:assets/colors.html}
|
15
14
|
#
|
16
15
|
# @example
|
@@ -27,8 +26,8 @@ class Sketchup::Color
|
|
27
26
|
|
28
27
|
# Class Methods
|
29
28
|
|
30
|
-
# The names method is used to retrieve an array of all color names
|
31
|
-
# by SketchUp.
|
29
|
+
# The {#names} method is used to retrieve an array of all color names
|
30
|
+
# recognized by SketchUp.
|
32
31
|
#
|
33
32
|
# In general, whenever a method wants a color, you can pass in a String with
|
34
33
|
# one of these names.
|
@@ -36,8 +35,7 @@ class Sketchup::Color
|
|
36
35
|
# @example
|
37
36
|
# array = Sketchup::Color.names
|
38
37
|
#
|
39
|
-
# @return
|
40
|
-
# successful
|
38
|
+
# @return [Array]
|
41
39
|
#
|
42
40
|
# @version SketchUp 6.0
|
43
41
|
def self.names
|
@@ -45,36 +43,51 @@ class Sketchup::Color
|
|
45
43
|
|
46
44
|
# Instance Methods
|
47
45
|
|
48
|
-
# The
|
49
|
-
#
|
46
|
+
# The {#==} method checks to see if the two {Sketchup::Color}s are equal. This
|
47
|
+
# checks whether the RGBA values are the same. In versions prior to SketchUp
|
48
|
+
# 2018 two color objects with the same values would be considered different.
|
49
|
+
#
|
50
|
+
# @example
|
51
|
+
# SketchUp::Color.new(255, 255, 255) == Sketchup::Color.new(1.0, 1.0, 1.0)
|
52
|
+
#
|
53
|
+
# @param [Object] other
|
54
|
+
#
|
55
|
+
# @return [Boolean]
|
56
|
+
#
|
57
|
+
# @version SketchUp 2018
|
58
|
+
def ==(other)
|
59
|
+
end
|
60
|
+
|
61
|
+
# The {#alpha} method is used to retrieve the opacity of the color. A value of
|
62
|
+
# 0 is transparent, 255 is opaque.
|
50
63
|
#
|
51
64
|
# @example
|
52
65
|
# color = Sketchup::Color.new "OldLace"
|
53
66
|
# alpha = color.alpha
|
54
67
|
#
|
55
|
-
# @return
|
68
|
+
# @return [Integer]
|
56
69
|
#
|
57
70
|
# @version SketchUp 6.0
|
58
71
|
def alpha
|
59
72
|
end
|
60
73
|
|
61
|
-
# The alpha= method is used to set the opacity of the color. A value of 0 is
|
74
|
+
# The {#alpha=} method is used to set the opacity of the color. A value of 0 is
|
62
75
|
# transparent, 255 is opaque.
|
63
76
|
#
|
64
77
|
# @example
|
65
78
|
# color = Sketchup::Color.new "AliceBlue"
|
66
79
|
# alpha = color.alpha = 255
|
67
80
|
#
|
68
|
-
# @param alpha
|
81
|
+
# @param [Integer] alpha
|
69
82
|
# The new opacity value.
|
70
83
|
#
|
71
|
-
# @return
|
84
|
+
# @return [Integer]
|
72
85
|
#
|
73
86
|
# @version SketchUp 8.0 M1
|
74
87
|
def alpha=(alpha)
|
75
88
|
end
|
76
89
|
|
77
|
-
# The blend method is used to blend two colors.
|
90
|
+
# The {#blend} method is used to blend two colors.
|
78
91
|
#
|
79
92
|
# The blended color will be the result of taking (1 - weight) * color1 +
|
80
93
|
# weight * color2. If weight = 0, you will get color2. If weight = 1 you will
|
@@ -85,93 +98,76 @@ class Sketchup::Color
|
|
85
98
|
# color2 = Sketchup::Color.new "AliceBlue"
|
86
99
|
# color3 = color1.blend color2, 0.5
|
87
100
|
#
|
88
|
-
# @param color2
|
89
|
-
# The second color to be blended
|
101
|
+
# @param [Sketchup::Color] color2
|
102
|
+
# The second color to be blended
|
103
|
+
# (with this color).
|
90
104
|
#
|
91
|
-
# @param weight
|
105
|
+
# @param [Float] weight
|
92
106
|
# A Float between 0.0 and 1.0
|
93
107
|
#
|
94
|
-
# @return
|
108
|
+
# @return [Sketchup::Color]
|
95
109
|
#
|
96
110
|
# @version SketchUp 6.0
|
97
111
|
def blend(color2, weight)
|
98
112
|
end
|
99
113
|
|
100
|
-
# The blue method is used to retrieve the blue value of a color.
|
101
|
-
# comprised of red, green, and blue values.
|
114
|
+
# The {#blue} method is used to retrieve the blue value of a color.
|
102
115
|
#
|
103
116
|
# Value range is 0 to 255.
|
104
117
|
#
|
105
118
|
# @example
|
106
119
|
# color = Sketchup::Color.new "AliceBlue"
|
107
|
-
#
|
120
|
+
# blue = color.blue
|
108
121
|
#
|
109
|
-
# @return
|
122
|
+
# @return [Integer]
|
110
123
|
#
|
111
124
|
# @version SketchUp 6.0
|
112
125
|
def blue
|
113
126
|
end
|
114
127
|
|
115
|
-
# The blue= method is used to set the blue value of a color.
|
116
|
-
# comprised of red, green, and blue values.
|
128
|
+
# The {#blue=} method is used to set the blue value of a color.
|
117
129
|
#
|
118
130
|
# Value range is 0 to 255.
|
119
131
|
#
|
120
132
|
# @example
|
121
133
|
# color = Sketchup::Color.new "AliceBlue"
|
122
|
-
#
|
123
|
-
#
|
124
|
-
#
|
125
|
-
# else
|
126
|
-
# UI.messagebox "Failure"
|
127
|
-
# end
|
128
|
-
#
|
129
|
-
# @param blue
|
134
|
+
# blue = color.blue = 200
|
135
|
+
#
|
136
|
+
# @param [Integer] blue
|
130
137
|
# The blue value for the color.
|
131
138
|
#
|
132
|
-
# @return
|
139
|
+
# @return [Integer]
|
133
140
|
#
|
134
141
|
# @version SketchUp 6.0
|
135
142
|
def blue=(blue)
|
136
143
|
end
|
137
144
|
|
138
|
-
# The green method is used to retrieve the green value of a color.
|
139
|
-
# comprised of red, green, and blue values.
|
145
|
+
# The {#green} method is used to retrieve the green value of a color.
|
140
146
|
#
|
141
147
|
# Value range is 0 to 255.
|
142
148
|
#
|
143
149
|
# @example
|
144
150
|
# color = Sketchup::Color.new "AliceBlue"
|
145
|
-
#
|
146
|
-
# if (setting)
|
147
|
-
# UI.messagebox setting
|
148
|
-
# else
|
149
|
-
# UI.messagebox "Failure"
|
150
|
-
# end
|
151
|
+
# green = color.green
|
151
152
|
#
|
152
|
-
# @return
|
153
|
+
# @return [Integer]
|
153
154
|
#
|
154
155
|
# @version SketchUp 6.0
|
155
156
|
def green
|
156
157
|
end
|
157
158
|
|
158
|
-
# The green= method is used to set the green component of a RGB Color.
|
159
|
+
# The {#green=} method is used to set the green component of a RGB Color.
|
159
160
|
#
|
160
161
|
# Value range is 0 to 255.
|
161
162
|
#
|
162
163
|
# @example
|
163
164
|
# color = Sketchup::Color.new "AliceBlue"
|
164
|
-
#
|
165
|
-
#
|
166
|
-
#
|
167
|
-
# else
|
168
|
-
# UI.messagebox "Failure"
|
169
|
-
# end
|
170
|
-
#
|
171
|
-
# @param green
|
165
|
+
# green = color.green = 200
|
166
|
+
#
|
167
|
+
# @param [Integer] green
|
172
168
|
# The green value for the color.
|
173
169
|
#
|
174
|
-
# @return
|
170
|
+
# @return [Integer]
|
175
171
|
#
|
176
172
|
# @version SketchUp 6.0
|
177
173
|
def green=(green)
|
@@ -183,6 +179,7 @@ class Sketchup::Color
|
|
183
179
|
# color_from_name = Sketchup::Color.new "OldLace"
|
184
180
|
# color_from_rgb = Sketchup::Color.new(0, 128, 255)
|
185
181
|
# color_from_rgba = Sketchup::Color.new(0, 128, 255, 128)
|
182
|
+
# color_from_hex = Sketchup::Color.new(0xFF0000)
|
186
183
|
#
|
187
184
|
# # You can then assign colors to the material of DrawingElements.
|
188
185
|
# # Note that this creates a new Material object, and the alpha value
|
@@ -191,11 +188,14 @@ class Sketchup::Color
|
|
191
188
|
# face.material = color_from_rgba
|
192
189
|
# face.material.alpha = 0.5
|
193
190
|
#
|
194
|
-
# @
|
191
|
+
# @note When assigning colors via a hexadecimal, R and B will be flipped.
|
192
|
+
#
|
193
|
+
# @overload initialize(red, green, blue, alpha = 255)
|
195
194
|
#
|
196
195
|
# @param [Integer] red A red value between 0 and 255.
|
197
196
|
# @param [Integer] green A green value between 0 and 255.
|
198
197
|
# @param [Integer] blue A blue value between 0 and 255.
|
198
|
+
# @param [Integer] alpha A alpha value between 0 and 255.
|
199
199
|
# @return [Sketchup::Color]
|
200
200
|
#
|
201
201
|
# @overload initialize(name)
|
@@ -209,80 +209,70 @@ class Sketchup::Color
|
|
209
209
|
def initialize(*args)
|
210
210
|
end
|
211
211
|
|
212
|
-
# The red method is used to retrieve the red component of a RGB Color.
|
212
|
+
# The {#red} method is used to retrieve the red component of a RGB Color.
|
213
213
|
#
|
214
214
|
# Value range is 0 to 255.
|
215
215
|
#
|
216
216
|
# @example
|
217
217
|
# color = Sketchup::Color.new "AliceBlue"
|
218
|
-
#
|
219
|
-
# if (setting)
|
220
|
-
# UI.messagebox setting
|
221
|
-
# else
|
222
|
-
# UI.messagebox "Failure"
|
223
|
-
# end
|
218
|
+
# red = color.red
|
224
219
|
#
|
225
|
-
# @return
|
220
|
+
# @return [Integer]
|
226
221
|
#
|
227
222
|
# @version SketchUp 6.0
|
228
223
|
def red
|
229
224
|
end
|
230
225
|
|
231
|
-
# The red= method is used to set the red component of a RGB Color.
|
226
|
+
# The {#red=} method is used to set the red component of a RGB Color.
|
232
227
|
#
|
233
228
|
# Value range is 0 to 255.
|
234
229
|
#
|
235
230
|
# @example
|
236
231
|
# color = Sketchup::Color.new "AliceBlue"
|
237
|
-
#
|
232
|
+
# red = color.red=200
|
238
233
|
#
|
239
|
-
# @param red
|
234
|
+
# @param [Integer] red
|
240
235
|
# The red value for the color.
|
241
236
|
#
|
242
|
-
# @return
|
237
|
+
# @return [Integer]
|
243
238
|
#
|
244
239
|
# @version SketchUp 6.0
|
245
240
|
def red=(red)
|
246
241
|
end
|
247
242
|
|
248
|
-
# The to_a method is used to convert a Color object to an Array object. The
|
243
|
+
# The {#to_a} method is used to convert a Color object to an Array object. The
|
249
244
|
# returned array will contain 4 integer values (RGBA) between 0 and 255.
|
250
245
|
#
|
251
246
|
# @example
|
252
247
|
# color = Sketchup::Color.new "AliceBlue"
|
253
248
|
# color_array = color.to_a
|
254
|
-
# if (color_array)
|
255
|
-
# UI.messagebox color_array.to_s
|
256
|
-
# else
|
257
|
-
# UI.messagebox "Failure"
|
258
|
-
# end
|
259
249
|
#
|
260
|
-
# @return
|
250
|
+
# @return [Array]
|
261
251
|
#
|
262
252
|
# @version SketchUp 6.0
|
263
253
|
def to_a
|
264
254
|
end
|
265
255
|
|
266
|
-
# The to_i method is used to convert a Color object to an 32 bit integer.
|
256
|
+
# The {#to_i} method is used to convert a Color object to an 32 bit integer.
|
267
257
|
#
|
268
258
|
# @example
|
269
259
|
# color = Sketchup::Color.new "AliceBlue"
|
270
260
|
# integer = color.to_i
|
271
261
|
#
|
272
|
-
# @return
|
262
|
+
# @return [Integer]
|
273
263
|
#
|
274
264
|
# @version SketchUp 6.0
|
275
265
|
def to_i
|
276
266
|
end
|
277
267
|
|
278
|
-
#
|
279
|
-
# of "Color(255, 255, 255, 255)".
|
268
|
+
# The {#to_s} method returns a string representation of the {Sketchup::Color}
|
269
|
+
# object, in the form of "Color(255, 255, 255, 255)".
|
280
270
|
#
|
281
271
|
# @example
|
282
|
-
# color = Sketchup::Color.new
|
283
|
-
# color.to_s
|
272
|
+
# color = Sketchup::Color.new(255, 255, 255, 255)
|
273
|
+
# color_str = color.to_s
|
284
274
|
#
|
285
|
-
# @return
|
275
|
+
# @return [String]
|
286
276
|
#
|
287
277
|
# @version SketchUp 6.0
|
288
278
|
def to_s
|