sketchup-api-stubs 0.1.0 → 0.1.1
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/{array.rb → Array.rb} +0 -0
- data/SketchUp/{geom.rb → Geom.rb} +0 -0
- data/SketchUp/Geom/LatLong.rb +8 -20
- data/SketchUp/Geom/Point3d.rb +2 -2
- data/SketchUp/Geom/Vector3d.rb +31 -26
- data/SketchUp/{languagehandler.rb → LanguageHandler.rb} +0 -0
- data/SketchUp/{length.rb → Length.rb} +0 -0
- data/SketchUp/{numeric.rb → Numeric.rb} +0 -0
- data/SketchUp/Sketchup/AttributeDictionaries.rb +8 -11
- data/SketchUp/Sketchup/AttributeDictionary.rb +39 -38
- data/SketchUp/Sketchup/Classifications.rb +9 -5
- data/SketchUp/Sketchup/DefinitionList.rb +9 -12
- data/SketchUp/Sketchup/Entities.rb +16 -36
- data/SketchUp/Sketchup/ExtensionsManager.rb +10 -14
- data/SketchUp/Sketchup/InstancePath.rb +6 -3
- data/SketchUp/Sketchup/Layers.rb +20 -24
- data/SketchUp/Sketchup/Licensing.rb +14 -13
- data/SketchUp/Sketchup/Materials.rb +10 -8
- data/SketchUp/Sketchup/Menu.rb +13 -15
- data/SketchUp/Sketchup/OptionsManager.rb +11 -14
- data/SketchUp/Sketchup/OptionsProvider.rb +55 -54
- data/SketchUp/Sketchup/Pages.rb +9 -9
- data/SketchUp/Sketchup/RenderingOptions.rb +27 -15
- data/SketchUp/Sketchup/Selection.rb +57 -89
- data/SketchUp/Sketchup/Set.rb +69 -104
- data/SketchUp/Sketchup/ShadowInfo.rb +26 -26
- data/SketchUp/Sketchup/Styles.rb +8 -9
- data/SketchUp/{sketchupextension.rb → SketchupExtension.rb} +0 -0
- data/SketchUp/{string.rb → String.rb} +0 -0
- data/SketchUp/UI/Toolbar.rb +8 -8
- data/SketchUp/_top_level.rb +11 -11
- data/SketchUp/ui.rb +4 -5
- metadata +10 -10
@@ -18,16 +18,9 @@ class Sketchup::Entities
|
|
18
18
|
# general, it is preferable to use the {#each} method to iterate though all
|
19
19
|
# of the entities in the collection as it will be much more efficient.
|
20
20
|
#
|
21
|
-
# The {#at} method is an alias of {#[]}
|
22
|
-
#
|
23
21
|
# @example
|
24
22
|
# entities = Sketchup.active_model.entities
|
25
|
-
#
|
26
|
-
# if (entity0)
|
27
|
-
# UI.messagebox entity0
|
28
|
-
# else
|
29
|
-
# UI.messagebox "Failure"
|
30
|
-
# end
|
23
|
+
# entity = entities[0]
|
31
24
|
#
|
32
25
|
# @param [Integer] entity_index
|
33
26
|
# The index for a specific entity.
|
@@ -35,6 +28,8 @@ class Sketchup::Entities
|
|
35
28
|
# @return [Sketchup::Entity, nil] an {Sketchup::Entity} object if successful,
|
36
29
|
# +nil+ if not found
|
37
30
|
#
|
31
|
+
# @see #at
|
32
|
+
#
|
38
33
|
# @version SketchUp 6.0
|
39
34
|
def [](entity_index)
|
40
35
|
end
|
@@ -658,27 +653,15 @@ class Sketchup::Entities
|
|
658
653
|
def add_text(text, point, vector)
|
659
654
|
end
|
660
655
|
|
661
|
-
# The {#
|
662
|
-
# entities. The index is a number between +0+ and entities.length - 1. In
|
663
|
-
# general, it is preferable to use the {#each} method to iterate though all
|
664
|
-
# of the entities in the collection as it will be much more efficient.
|
665
|
-
#
|
666
|
-
# The {#at} method is an alias of {#[]}
|
656
|
+
# The {#at} method is an alias for {#[]}.
|
667
657
|
#
|
668
658
|
# @example
|
669
659
|
# entities = Sketchup.active_model.entities
|
670
|
-
#
|
671
|
-
# if (entity0)
|
672
|
-
# UI.messagebox entity0
|
673
|
-
# else
|
674
|
-
# UI.messagebox "Failure"
|
675
|
-
# end
|
660
|
+
# entity = entities.at(0)
|
676
661
|
#
|
677
|
-
# @
|
678
|
-
# The index for a specific entity.
|
662
|
+
# @return [Sketchup::Entity, nil]
|
679
663
|
#
|
680
|
-
# @
|
681
|
-
# +nil+ if not found
|
664
|
+
# @see #[]
|
682
665
|
#
|
683
666
|
# @version SketchUp 6.0
|
684
667
|
def at(entity_index)
|
@@ -869,16 +852,15 @@ class Sketchup::Entities
|
|
869
852
|
# The {#length} method is used to retrieve the number of entities in the
|
870
853
|
# collection of entities.
|
871
854
|
#
|
872
|
-
# The {#size} method is an alias for {#length} added in SketchUp 2014.
|
873
|
-
#
|
874
855
|
# @example
|
875
856
|
# model = Sketchup.active_model
|
876
857
|
# entities = model.entities
|
877
858
|
# entities.add_cpoint([10, 10, 10])
|
878
859
|
# number = entities.length
|
879
860
|
#
|
880
|
-
# @return [Integer]
|
881
|
-
#
|
861
|
+
# @return [Integer]
|
862
|
+
#
|
863
|
+
# @see #size
|
882
864
|
#
|
883
865
|
# @version SketchUp 6.0
|
884
866
|
def length
|
@@ -937,21 +919,19 @@ class Sketchup::Entities
|
|
937
919
|
def remove_observer(observer)
|
938
920
|
end
|
939
921
|
|
940
|
-
# The {#
|
941
|
-
# collection of entities.
|
942
|
-
#
|
943
|
-
# The {#size} method is an alias for {#length} added in SketchUp 2014.
|
922
|
+
# The {#size} method is an alias for the {#length} method.
|
944
923
|
#
|
945
924
|
# @example
|
946
925
|
# model = Sketchup.active_model
|
947
926
|
# entities = model.entities
|
948
927
|
# entities.add_cpoint([10, 10, 10])
|
949
|
-
# number = entities.
|
928
|
+
# number = entities.size
|
950
929
|
#
|
951
|
-
# @return [Integer]
|
952
|
-
# entities if successful
|
930
|
+
# @return [Integer]
|
953
931
|
#
|
954
|
-
# @
|
932
|
+
# @see #length
|
933
|
+
#
|
934
|
+
# @version SketchUp 2014
|
955
935
|
def size
|
956
936
|
end
|
957
937
|
|
@@ -53,8 +53,7 @@ class Sketchup::ExtensionsManager
|
|
53
53
|
# +Enumable+ mix-in module. Prior to that the {#count} method is an alias
|
54
54
|
# for {#length}.
|
55
55
|
#
|
56
|
-
# @return
|
57
|
-
# successful
|
56
|
+
# @return [Integer]
|
58
57
|
#
|
59
58
|
# @see #length
|
60
59
|
#
|
@@ -94,33 +93,30 @@ class Sketchup::ExtensionsManager
|
|
94
93
|
def keys
|
95
94
|
end
|
96
95
|
|
97
|
-
# The length method returns the number of SketchupExtension objects inside
|
96
|
+
# The {#length} method returns the number of {SketchupExtension} objects inside
|
98
97
|
# this ExtensionsManager.
|
99
98
|
#
|
100
|
-
# The {#size} method is an alias for {#length}.
|
101
|
-
#
|
102
99
|
# @example
|
103
100
|
# manager = Sketchup.extensions
|
104
101
|
# number = manager.length
|
105
102
|
#
|
106
|
-
# @return
|
107
|
-
#
|
103
|
+
# @return [Integer]
|
104
|
+
#
|
105
|
+
# @see #size
|
108
106
|
#
|
109
107
|
# @version SketchUp 8.0 M2
|
110
108
|
def length
|
111
109
|
end
|
112
110
|
|
113
|
-
# The
|
114
|
-
# this ExtensionsManager.
|
115
|
-
#
|
116
|
-
# The {#size} method is an alias for {#length}.
|
111
|
+
# The {#size} method is an alias of {#length}.
|
117
112
|
#
|
118
113
|
# @example
|
119
114
|
# manager = Sketchup.extensions
|
120
|
-
# number = manager.
|
115
|
+
# number = manager.size
|
116
|
+
#
|
117
|
+
# @return [Integer]
|
121
118
|
#
|
122
|
-
# @
|
123
|
-
# successful
|
119
|
+
# @see #length
|
124
120
|
#
|
125
121
|
# @version SketchUp 8.0 M2
|
126
122
|
def size
|
@@ -155,14 +155,14 @@ class Sketchup::InstancePath
|
|
155
155
|
def leaf
|
156
156
|
end
|
157
157
|
|
158
|
-
# {#length} is
|
158
|
+
# {#length} is an alias of {#size}.
|
159
159
|
#
|
160
160
|
# @example
|
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
164
|
# path = Sketchup::InstancePath.new(group, edge])
|
165
|
-
# if path.
|
165
|
+
# if path.length > 1
|
166
166
|
# # do something
|
167
167
|
# end
|
168
168
|
#
|
@@ -170,6 +170,8 @@ class Sketchup::InstancePath
|
|
170
170
|
#
|
171
171
|
# @return [Integer]
|
172
172
|
#
|
173
|
+
# @see #size
|
174
|
+
#
|
173
175
|
# @version SketchUp 2017
|
174
176
|
def length
|
175
177
|
end
|
@@ -213,7 +215,6 @@ class Sketchup::InstancePath
|
|
213
215
|
def root
|
214
216
|
end
|
215
217
|
|
216
|
-
# {#length} is and alias of {#size}.
|
217
218
|
#
|
218
219
|
# @example
|
219
220
|
# model = Sketchup.active_model
|
@@ -228,6 +229,8 @@ class Sketchup::InstancePath
|
|
228
229
|
#
|
229
230
|
# @return [Integer]
|
230
231
|
#
|
232
|
+
# @see #length
|
233
|
+
#
|
231
234
|
# @version SketchUp 2017
|
232
235
|
def size
|
233
236
|
end
|
data/SketchUp/Sketchup/Layers.rb
CHANGED
@@ -17,9 +17,7 @@ class Sketchup::Layers < Sketchup::Entity
|
|
17
17
|
|
18
18
|
# Instance Methods
|
19
19
|
|
20
|
-
# The [] method is used to retrieve a layer by index or name.
|
21
|
-
#
|
22
|
-
# The {#at} method is an alias for {#[]}.
|
20
|
+
# The {#[]} method is used to retrieve a layer by index or name.
|
23
21
|
#
|
24
22
|
# @example
|
25
23
|
# model = Sketchup.active_model
|
@@ -28,11 +26,13 @@ class Sketchup::Layers < Sketchup::Entity
|
|
28
26
|
# layer_by_number = layers[1]
|
29
27
|
# layer_by_name = layers["test layer"]
|
30
28
|
#
|
31
|
-
# @param index_or_name
|
32
|
-
# A number representing the layer's
|
33
|
-
# Layer objects, or the name of the layer.
|
29
|
+
# @param [Integer, String] index_or_name
|
30
|
+
# A number representing the layer's
|
31
|
+
# index in an array of Layer objects, or the name of the layer.
|
34
32
|
#
|
35
|
-
# @return
|
33
|
+
# @return [Sketchup::Layer, nil]
|
34
|
+
#
|
35
|
+
# @see #at
|
36
36
|
#
|
37
37
|
# @version SketchUp 6.0
|
38
38
|
def [](index_or_name)
|
@@ -71,22 +71,18 @@ class Sketchup::Layers < Sketchup::Entity
|
|
71
71
|
def add_observer(observer)
|
72
72
|
end
|
73
73
|
|
74
|
-
# The [] method is used to retrieve a layer by index or name.
|
75
|
-
#
|
76
74
|
# The {#at} method is an alias for {#[]}.
|
77
75
|
#
|
78
76
|
# @example
|
79
77
|
# model = Sketchup.active_model
|
80
78
|
# layers = model.layers
|
81
79
|
# new_layer = layers.add "test layer"
|
82
|
-
# layer_by_number = layers
|
83
|
-
# layer_by_name = layers
|
80
|
+
# layer_by_number = layers.at(1)
|
81
|
+
# layer_by_name = layers.at("test layer")
|
84
82
|
#
|
85
|
-
# @
|
86
|
-
# A number representing the layer's index in an array of
|
87
|
-
# Layer objects, or the name of the layer.
|
83
|
+
# @return [Sketchup::Layer, nil]
|
88
84
|
#
|
89
|
-
# @
|
85
|
+
# @see #[]
|
90
86
|
#
|
91
87
|
# @version SketchUp 6.0
|
92
88
|
def at(index_or_name)
|
@@ -125,13 +121,13 @@ class Sketchup::Layers < Sketchup::Entity
|
|
125
121
|
|
126
122
|
# The {#length} method retrieves the number of layers.
|
127
123
|
#
|
128
|
-
# The {#size} method is an alias for {#length} added in SketchUp 2014.
|
129
|
-
#
|
130
124
|
# @example
|
131
125
|
# layers = Sketchup.active_model.layers
|
132
126
|
# number = layers.length
|
133
127
|
#
|
134
|
-
# @return
|
128
|
+
# @return [Integer]
|
129
|
+
#
|
130
|
+
# @see #size
|
135
131
|
#
|
136
132
|
# @version SketchUp 6.0
|
137
133
|
def length
|
@@ -198,17 +194,17 @@ class Sketchup::Layers < Sketchup::Entity
|
|
198
194
|
def remove_observer(observer)
|
199
195
|
end
|
200
196
|
|
201
|
-
# The {#
|
202
|
-
#
|
203
|
-
# The {#size} method is an alias for {#length} added in SketchUp 2014.
|
197
|
+
# The {#size} method is an alias of {#length}.
|
204
198
|
#
|
205
199
|
# @example
|
206
200
|
# layers = Sketchup.active_model.layers
|
207
|
-
# number = layers.
|
201
|
+
# number = layers.size
|
208
202
|
#
|
209
|
-
# @return
|
203
|
+
# @return [Integer]
|
210
204
|
#
|
211
|
-
# @
|
205
|
+
# @see #length
|
206
|
+
#
|
207
|
+
# @version SketchUp 2014
|
212
208
|
def size
|
213
209
|
end
|
214
210
|
|
@@ -1,14 +1,16 @@
|
|
1
1
|
# Copyright:: Copyright 2017 Trimble Inc.
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
|
-
# The Sketchup::Licensing module contains methods for
|
5
|
-
# from Extension Warehouse to check their licensing status.
|
6
|
-
# to place these calls inside encrypted Ruby (.rbe) files. This API is also
|
7
|
-
# exposed via the SketchUp C API. Extensions that already use native code
|
8
|
-
# should prefer using the native API, which should be more secure than their
|
9
|
-
# Ruby API counterparts.
|
4
|
+
# The +Sketchup::Licensing+ module contains methods for
|
5
|
+
# extensions purchased from Extension Warehouse to check their licensing status.
|
10
6
|
#
|
11
|
-
#
|
7
|
+
# It is advised to place these calls inside encrypted Ruby (.rbe) files. This
|
8
|
+
# API is also exposed via the SketchUp C API. Extensions that already use
|
9
|
+
# native code should prefer using the native API, which should be more secure
|
10
|
+
# than their Ruby API counterparts.
|
11
|
+
#
|
12
|
+
# For more details, see:
|
13
|
+
# {Developer Center Licensing Tutorial}[https://extensions.sketchup.com/en/developer_center/tutorial_licensing]
|
12
14
|
#
|
13
15
|
# @version SketchUp 2015
|
14
16
|
module Sketchup::Licensing
|
@@ -32,13 +34,12 @@ module Sketchup::Licensing
|
|
32
34
|
# puts "Extension is licensed."
|
33
35
|
# end
|
34
36
|
#
|
35
|
-
# @param extension_id
|
36
|
-
#
|
37
|
+
# @param [String] extension_id
|
38
|
+
# The Extension Warehouse UUID for the desired extension.
|
37
39
|
#
|
38
|
-
# @return ExtensionLicense
|
39
|
-
# state for the extension. Do not store this object,
|
40
|
-
#
|
41
|
-
# have changed.
|
40
|
+
# @return [ExtensionLicense] An object representing
|
41
|
+
# licensing state for the extension. Do not store this object, retrieve
|
42
|
+
# it again when needed since licensing state may have changed.
|
42
43
|
#
|
43
44
|
# @version SketchUp 2015
|
44
45
|
def self.get_extension_license(extension_id)
|
@@ -111,7 +111,7 @@ class Sketchup::Materials < Sketchup::Entity
|
|
111
111
|
# +Enumable+ mix-in module. Prior to that the {#count} method is an alias
|
112
112
|
# for {#length}.
|
113
113
|
#
|
114
|
-
# @return
|
114
|
+
# @return [Integer]
|
115
115
|
#
|
116
116
|
# @see #length
|
117
117
|
#
|
@@ -166,13 +166,13 @@ class Sketchup::Materials < Sketchup::Entity
|
|
166
166
|
|
167
167
|
# The number of materials in the collection.
|
168
168
|
#
|
169
|
-
# The {#size} method is an alias for {#length} added in SketchUp 2014.
|
170
|
-
#
|
171
169
|
# @example
|
172
170
|
# materials = Sketchup.active_model.materials
|
173
171
|
# number = materials.length
|
174
172
|
#
|
175
|
-
# @return
|
173
|
+
# @return [Integer]
|
174
|
+
#
|
175
|
+
# @see #size
|
176
176
|
#
|
177
177
|
# @version SketchUp 6.0
|
178
178
|
def length
|
@@ -268,15 +268,17 @@ class Sketchup::Materials < Sketchup::Entity
|
|
268
268
|
|
269
269
|
# The number of materials in the collection.
|
270
270
|
#
|
271
|
-
# The {#size} method is an alias for {#length}
|
271
|
+
# The {#size} method is an alias for {#length}.
|
272
272
|
#
|
273
273
|
# @example
|
274
274
|
# materials = Sketchup.active_model.materials
|
275
|
-
# number = materials.
|
275
|
+
# number = materials.size
|
276
276
|
#
|
277
|
-
# @return
|
277
|
+
# @return [Integer]
|
278
278
|
#
|
279
|
-
# @
|
279
|
+
# @see #length
|
280
|
+
#
|
281
|
+
# @version SketchUp 2014
|
280
282
|
def size
|
281
283
|
end
|
282
284
|
|
data/SketchUp/Sketchup/Menu.rb
CHANGED
@@ -8,7 +8,7 @@ class Sketchup::Menu
|
|
8
8
|
|
9
9
|
# Instance Methods
|
10
10
|
|
11
|
-
# The add_item
|
11
|
+
# The {#add_item} method is used to add a menu item to the specified menu.
|
12
12
|
#
|
13
13
|
# This method takes a block that defines the action to perform when the menu
|
14
14
|
# item is selected.
|
@@ -17,24 +17,22 @@ class Sketchup::Menu
|
|
17
17
|
# validation procedure for the menu item.
|
18
18
|
#
|
19
19
|
# @example
|
20
|
-
#
|
21
|
-
#
|
22
|
-
# if (item)
|
23
|
-
# UI.messagebox item
|
24
|
-
# else
|
25
|
-
# UI.messagebox "Failure"
|
26
|
-
# end
|
20
|
+
# menu = UI.menu('Plugins')
|
21
|
+
# menu.add_item("Test") { puts 'Hello World' }
|
27
22
|
#
|
28
|
-
# @
|
29
|
-
# A string name of the menu to add.
|
23
|
+
# @overload add_item(menu, &block)
|
30
24
|
#
|
31
|
-
#
|
25
|
+
# @param [String] menu The name of the menu to add.
|
26
|
+
# @yield A block that will be invoked when the menu item is selected.
|
27
|
+
# @return [Integer] A unique integer id for the added menu item.
|
32
28
|
#
|
33
|
-
# @
|
29
|
+
# @overload add_item(command)
|
34
30
|
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
|
31
|
+
# @param [UI::Command] command
|
32
|
+
# @return [Integer] A unique integer id for the added menu item.
|
33
|
+
#
|
34
|
+
# @version SketchUp 6.0
|
35
|
+
def add_item(*args)
|
38
36
|
end
|
39
37
|
|
40
38
|
# The add_separator method is used to add a menu separator to a menu.
|
@@ -100,33 +100,30 @@ class Sketchup::OptionsManager
|
|
100
100
|
def keys
|
101
101
|
end
|
102
102
|
|
103
|
-
# The {#
|
104
|
-
# OptionsManager.
|
105
|
-
#
|
106
|
-
# The {#length} method is an alias for {#size} added in SketchUp 2014.
|
103
|
+
# The {#length} method is an alias of {#size}.
|
107
104
|
#
|
108
105
|
# @example
|
109
106
|
# optionsmanager = Sketchup.active_model.options
|
110
|
-
# number = manager.
|
107
|
+
# number = manager.length
|
111
108
|
#
|
112
|
-
# @return
|
113
|
-
# successful
|
109
|
+
# @return [Integer]
|
114
110
|
#
|
115
|
-
# @
|
111
|
+
# @see #size
|
112
|
+
#
|
113
|
+
# @version SketchUp 2014
|
116
114
|
def length
|
117
115
|
end
|
118
116
|
|
119
|
-
# The {#size} method returns the number of OptionsProvider objects inside
|
120
|
-
# OptionsManager.
|
121
|
-
#
|
122
|
-
# The {#length} method is an alias for {#size} added in SketchUp 2014.
|
117
|
+
# The {#size} method returns the number of {OptionsProvider} objects inside
|
118
|
+
# this {OptionsManager}.
|
123
119
|
#
|
124
120
|
# @example
|
125
121
|
# optionsmanager = Sketchup.active_model.options
|
126
122
|
# number = manager.size
|
127
123
|
#
|
128
|
-
# @return
|
129
|
-
#
|
124
|
+
# @return [Integer]
|
125
|
+
#
|
126
|
+
# @see #length
|
130
127
|
#
|
131
128
|
# @version SketchUp 6.0
|
132
129
|
def size
|