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,146 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The AttributeDictionaries class is a collection of all of the
|
5
|
+
# AttributeDictionary objects that are attached to a given Entity object.
|
6
|
+
#
|
7
|
+
# The Entity class is a popular parent class in SketchUp, meaning you can
|
8
|
+
# attach AttributeDictionaries to almost anything, from geometric items
|
9
|
+
# like edges and faces and components to more conceptual things like pages
|
10
|
+
# or materials.
|
11
|
+
#
|
12
|
+
# You access this class not by performing an AttributeDictionaries.new but
|
13
|
+
# by grabbing a handle from an existing entity.
|
14
|
+
#
|
15
|
+
# @example
|
16
|
+
# # Grab the first entity from the model.
|
17
|
+
# my_layer = Sketchup.active_model.entities[0]
|
18
|
+
#
|
19
|
+
# # Grab a handle to its attribute dictionaries.
|
20
|
+
# attrdicts = my_layer.attribute_dictionaries
|
21
|
+
#
|
22
|
+
# @version SketchUp 6.0
|
23
|
+
class Sketchup::AttributeDictionaries < Sketchup::Entity
|
24
|
+
|
25
|
+
# Includes
|
26
|
+
|
27
|
+
include Enumerable
|
28
|
+
|
29
|
+
# Instance Methods
|
30
|
+
|
31
|
+
# Get an AttributeDictionary by name. Returns nil if there is none with the
|
32
|
+
# given name.
|
33
|
+
#
|
34
|
+
# @example
|
35
|
+
# model = Sketchup.active_model
|
36
|
+
# attrdicts = model.attribute_dictionaries
|
37
|
+
# # Iterates through all dictionaries and prints to screen.
|
38
|
+
# dict = attrdicts['my_dictionary']
|
39
|
+
# if dict
|
40
|
+
# UI.messagebox("Found: " + dict.to_s)
|
41
|
+
# else
|
42
|
+
# UI.messagebox("No dictionary found.")
|
43
|
+
# end
|
44
|
+
#
|
45
|
+
# @param key
|
46
|
+
# The name of the attribute dictionary.
|
47
|
+
#
|
48
|
+
# @return dictionary - the dictionary
|
49
|
+
#
|
50
|
+
# @version SketchUp 6.0
|
51
|
+
def [](key)
|
52
|
+
end
|
53
|
+
|
54
|
+
# The count method is inherited from the Enumerable mix-in module.
|
55
|
+
#
|
56
|
+
# @example
|
57
|
+
# model = Sketchup.active_model
|
58
|
+
# model.set_attribute('Example', 'Hello', 'World')
|
59
|
+
# dictionaries = model.attribute_dictionaries
|
60
|
+
# number = dictionaries.count
|
61
|
+
#
|
62
|
+
# @return [Integer] the number of attribute dictionary objects
|
63
|
+
# in the collection.
|
64
|
+
#
|
65
|
+
# @see #length
|
66
|
+
#
|
67
|
+
# @version SketchUp 2014
|
68
|
+
def count
|
69
|
+
end
|
70
|
+
|
71
|
+
# The delete method destroys a given AttributeDictionary. This
|
72
|
+
# AttributeDictionary can be passed directly or identified by its
|
73
|
+
# string name.
|
74
|
+
#
|
75
|
+
# @example
|
76
|
+
# model = Sketchup.active_model
|
77
|
+
# attrdicts = model.attribute_dictionaries
|
78
|
+
# # Deletes a dictionary called 'my_dictionary'
|
79
|
+
# attrdicts.delete 'my_dictionary'
|
80
|
+
#
|
81
|
+
# @param key_or_dict
|
82
|
+
# The name of the attribute dictionary to delete, or
|
83
|
+
# the dictionary object itself.
|
84
|
+
#
|
85
|
+
# @return dictionaries - the modified AttributeDictionaries object
|
86
|
+
#
|
87
|
+
# @version SketchUp 6.0
|
88
|
+
def delete(key_or_dict)
|
89
|
+
end
|
90
|
+
|
91
|
+
# The each method is used to iterate through all of the attributes
|
92
|
+
# dictionaries.
|
93
|
+
#
|
94
|
+
# Throws an exception if there are no keys.
|
95
|
+
#
|
96
|
+
# @example
|
97
|
+
# model = Sketchup.active_model
|
98
|
+
# attrdicts = model.attribute_dictionaries
|
99
|
+
# # Iterates through all dictionaries and prints to screen.
|
100
|
+
# attrdicts.each { | dict | UI.messagebox dict }
|
101
|
+
#
|
102
|
+
# @return nil
|
103
|
+
#
|
104
|
+
# @version SketchUp 6.0
|
105
|
+
#
|
106
|
+
# @yield [dict] Each AttributeDictionary as it is found.
|
107
|
+
def each
|
108
|
+
end
|
109
|
+
|
110
|
+
# The {#length} method returns the number of attribute dictionary objects in
|
111
|
+
# the collection.
|
112
|
+
#
|
113
|
+
# The {#size} method is an alias for {#length}.
|
114
|
+
#
|
115
|
+
# @example
|
116
|
+
# model = Sketchup.active_model
|
117
|
+
# model.set_attribute('Example', 'Hello', 'World')
|
118
|
+
# dictionaries = model.attribute_dictionaries
|
119
|
+
# number = dictionaries.length
|
120
|
+
#
|
121
|
+
# @return [Integer] the number of attribute dictionary objects in the
|
122
|
+
# collection.
|
123
|
+
#
|
124
|
+
# @version SketchUp 2014
|
125
|
+
def length
|
126
|
+
end
|
127
|
+
|
128
|
+
# The {#length} method returns the number of attribute dictionary objects in
|
129
|
+
# the collection.
|
130
|
+
#
|
131
|
+
# The {#size} method is an alias for {#length}.
|
132
|
+
#
|
133
|
+
# @example
|
134
|
+
# model = Sketchup.active_model
|
135
|
+
# model.set_attribute('Example', 'Hello', 'World')
|
136
|
+
# dictionaries = model.attribute_dictionaries
|
137
|
+
# number = dictionaries.length
|
138
|
+
#
|
139
|
+
# @return [Integer] the number of attribute dictionary objects in the
|
140
|
+
# collection.
|
141
|
+
#
|
142
|
+
# @version SketchUp 2014
|
143
|
+
def size
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
@@ -0,0 +1,280 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The AttributeDictionary class allows you to attach arbitrary collections of
|
5
|
+
# attributes to a SketchUp entity. The attributes are defined by key/value
|
6
|
+
# pairs where the keys are strings. An Entity or Model object can have any
|
7
|
+
# number of AttributeDictionary objects (see the AttributeDictionaries class).
|
8
|
+
#
|
9
|
+
# The Entity class is a popular parent class in SketchUp, meaning you can
|
10
|
+
# attach attribute dictionaries to almost anything, from geometric items
|
11
|
+
# like edges and faces and components to more conceptual things like pages
|
12
|
+
# or materials.
|
13
|
+
#
|
14
|
+
# @version SketchUp 6.0
|
15
|
+
class Sketchup::AttributeDictionary < Sketchup::Entity
|
16
|
+
|
17
|
+
# Includes
|
18
|
+
|
19
|
+
include Enumerable
|
20
|
+
|
21
|
+
# Instance Methods
|
22
|
+
|
23
|
+
# The [] method is used to retrieve the attribute with a given key.
|
24
|
+
#
|
25
|
+
# @example
|
26
|
+
# model = Sketchup.active_model
|
27
|
+
# value = model.set_attribute "testdictionary", "test", 115
|
28
|
+
# attrdicts = model.attribute_dictionaries
|
29
|
+
# attrdict = attrdicts["testdictionary"]
|
30
|
+
#
|
31
|
+
# # value will contain 115
|
32
|
+
# value = attrdict["test"]
|
33
|
+
#
|
34
|
+
# @param key
|
35
|
+
# The name of the attribute.
|
36
|
+
#
|
37
|
+
# @return attribute - the attribute stored under your key, or
|
38
|
+
# nil if not found
|
39
|
+
#
|
40
|
+
# @version SketchUp 6.0
|
41
|
+
def [](key)
|
42
|
+
end
|
43
|
+
|
44
|
+
# The set value ([]=) method is used to set the value of an attribute with a
|
45
|
+
# given key.
|
46
|
+
#
|
47
|
+
# Creates a new attribute for the given key if needed.
|
48
|
+
#
|
49
|
+
# @example
|
50
|
+
# model = Sketchup.active_model
|
51
|
+
# value = model.set_attribute "testdictionary", "test", 110
|
52
|
+
# attrdicts = model.attribute_dictionaries
|
53
|
+
# attrdict = attrdicts["testdictionary"]
|
54
|
+
# value = attrdict["test2"] = 120
|
55
|
+
# if (value)
|
56
|
+
# UI.messagebox value
|
57
|
+
# end
|
58
|
+
#
|
59
|
+
# @param key
|
60
|
+
# The valid key.
|
61
|
+
#
|
62
|
+
# @param value
|
63
|
+
# The value to be set.
|
64
|
+
#
|
65
|
+
# @return value - the value that was set if successful, or false
|
66
|
+
# if unsuccessful.
|
67
|
+
#
|
68
|
+
# @version SketchUp 6.0
|
69
|
+
def []=(key, value)
|
70
|
+
end
|
71
|
+
|
72
|
+
# The count method is inherited from the Enumerable mix-in module.
|
73
|
+
#
|
74
|
+
# @example
|
75
|
+
# model = Sketchup.active_model
|
76
|
+
# model.set_attribute('Example', 'Hello', 'World')
|
77
|
+
# dictionary = model.attribute_dictionary('Example')
|
78
|
+
# number = dictionary.count
|
79
|
+
#
|
80
|
+
# @return [Integer] the size of the attribute dictionary.
|
81
|
+
#
|
82
|
+
# @version SketchUp 2014
|
83
|
+
def count
|
84
|
+
end
|
85
|
+
|
86
|
+
# The delete_key method is used to delete an attribute with a given key.
|
87
|
+
#
|
88
|
+
# @example
|
89
|
+
# create_if_nil = true
|
90
|
+
# model = Sketchup.active_model
|
91
|
+
# attrdict = model.attribute_dictionary "test_dict", create_if_nil
|
92
|
+
# attrdict["attr_one"] = "one"
|
93
|
+
# attrdict["attr_two"] = "two"
|
94
|
+
#
|
95
|
+
# # Gets an array of values
|
96
|
+
# attrdict = model.attribute_dictionaries['test_dict']
|
97
|
+
# value = attrdict.delete_key("attr_one")
|
98
|
+
#
|
99
|
+
# @param key
|
100
|
+
# The key to be deleted.
|
101
|
+
#
|
102
|
+
# @return value - the value of the key
|
103
|
+
#
|
104
|
+
# @version SketchUp 6.0
|
105
|
+
def delete_key(key)
|
106
|
+
end
|
107
|
+
|
108
|
+
# An alias for each. See AttributeDictionary.each.
|
109
|
+
#
|
110
|
+
# Throws an exception if there are no keys.
|
111
|
+
#
|
112
|
+
# @example
|
113
|
+
# create_if_nil = true
|
114
|
+
# model = Sketchup.active_model
|
115
|
+
# attrdict = model.attribute_dictionary "test_dict", create_if_nil
|
116
|
+
# attrdict["attr_one"] = "one"
|
117
|
+
# attrdict["attr_two"] = "two"
|
118
|
+
#
|
119
|
+
# # iterates through all attributes and prints the key to the screen
|
120
|
+
# attrdict = model.attribute_dictionaries['test_dict']
|
121
|
+
# attrdict.each_pair { | key, value |
|
122
|
+
# UI.messagebox key.to_s + '=' + value.to_s
|
123
|
+
# }
|
124
|
+
#
|
125
|
+
# @return nil
|
126
|
+
#
|
127
|
+
# @version SketchUp 6.0
|
128
|
+
#
|
129
|
+
# @yield [key, value] @yieldparam key The key of each attribute as it is found.
|
130
|
+
# @yieldparam value The value of each attribute as it is found.
|
131
|
+
def each
|
132
|
+
end
|
133
|
+
|
134
|
+
# The each_key method is used to iterate through all of the attribute keys.
|
135
|
+
# This is the same method as AttributeDictionary.each.
|
136
|
+
#
|
137
|
+
# Throws an exception if there are no keys.
|
138
|
+
#
|
139
|
+
# @example
|
140
|
+
# create_if_nil = true
|
141
|
+
# model = Sketchup.active_model
|
142
|
+
# attrdict = model.attribute_dictionary "test_dict", create_if_nil
|
143
|
+
# attrdict["attr_one"] = "one"
|
144
|
+
# attrdict["attr_two"] = "two"
|
145
|
+
#
|
146
|
+
# # iterates through all attributes and prints the key to the screen
|
147
|
+
# attrdict = model.attribute_dictionaries['test_dict']
|
148
|
+
# attrdict.each_key { | key | UI.messagebox key }
|
149
|
+
#
|
150
|
+
# @return nil
|
151
|
+
#
|
152
|
+
# @version SketchUp 6.0
|
153
|
+
#
|
154
|
+
# @yield [key] A variable that will hold each key as they are found.
|
155
|
+
def each_key
|
156
|
+
end
|
157
|
+
|
158
|
+
# An alias for each. See AttributeDictionary.each.
|
159
|
+
#
|
160
|
+
# Throws an exception if there are no keys.
|
161
|
+
#
|
162
|
+
# @example
|
163
|
+
# create_if_nil = true
|
164
|
+
# model = Sketchup.active_model
|
165
|
+
# attrdict = model.attribute_dictionary "test_dict", create_if_nil
|
166
|
+
# attrdict["attr_one"] = "one"
|
167
|
+
# attrdict["attr_two"] = "two"
|
168
|
+
#
|
169
|
+
# # iterates through all attributes and prints the key to the screen
|
170
|
+
# attrdict = model.attribute_dictionaries['test_dict']
|
171
|
+
# attrdict.each_pair { | key, value |
|
172
|
+
# UI.messagebox key.to_s + '=' + value.to_s
|
173
|
+
# }
|
174
|
+
#
|
175
|
+
# @return nil
|
176
|
+
#
|
177
|
+
# @version SketchUp 6.0
|
178
|
+
#
|
179
|
+
# @yield [key, value] @yieldparam key The key of each attribute as it is found.
|
180
|
+
# @yieldparam value The value of each attribute as it is found.
|
181
|
+
def each_pair
|
182
|
+
end
|
183
|
+
|
184
|
+
# The keys method is used to retrieve an array with all of the attribute keys.
|
185
|
+
#
|
186
|
+
# @example
|
187
|
+
# create_if_nil = true
|
188
|
+
# model = Sketchup.active_model
|
189
|
+
# attrdict = model.attribute_dictionary "test_dict", create_if_nil
|
190
|
+
# attrdict["attr_one"] = "one"
|
191
|
+
# attrdict["attr_two"] = "two"
|
192
|
+
#
|
193
|
+
# # Gets an array of keys
|
194
|
+
# attrdict = model.attribute_dictionaries['test_dict']
|
195
|
+
# keys = attrdict.keys
|
196
|
+
#
|
197
|
+
# @return keys - an array of keys within the attribute dictionary
|
198
|
+
# if successful
|
199
|
+
#
|
200
|
+
# @version SketchUp 6.0
|
201
|
+
def keys
|
202
|
+
end
|
203
|
+
|
204
|
+
# The {#length} method is used to retrieve the size (number of elements) of an
|
205
|
+
# attribute dictionary.
|
206
|
+
#
|
207
|
+
# The {#size} method is an alias for {#length}.
|
208
|
+
#
|
209
|
+
# @example
|
210
|
+
# model = Sketchup.active_model
|
211
|
+
# model.set_attribute('Example', 'Hello', 'World')
|
212
|
+
# dictionary = model.attribute_dictionary('Example')
|
213
|
+
# number = dictionary.length
|
214
|
+
#
|
215
|
+
# @return [Integer] the size of the attribute dictionary if
|
216
|
+
# successful
|
217
|
+
#
|
218
|
+
# @version SketchUp 6.0
|
219
|
+
def length
|
220
|
+
end
|
221
|
+
|
222
|
+
# The name method is used to retrieve the name of an attribute dictionary.
|
223
|
+
#
|
224
|
+
# @example
|
225
|
+
# create_if_nil = true
|
226
|
+
# model = Sketchup.active_model
|
227
|
+
# attrdict = model.attribute_dictionary "test_dict", create_if_nil
|
228
|
+
# attrdict["attr_one"] = "one"
|
229
|
+
# attrdict["attr_two"] = "two"
|
230
|
+
#
|
231
|
+
# # Show the name.
|
232
|
+
# UI.messagebox attrdict.name
|
233
|
+
#
|
234
|
+
# @return name - the name of the attribute dictionary if
|
235
|
+
# successful
|
236
|
+
#
|
237
|
+
# @version SketchUp 6.0
|
238
|
+
def name
|
239
|
+
end
|
240
|
+
|
241
|
+
# The {#length} method is used to retrieve the size (number of elements) of an
|
242
|
+
# attribute dictionary.
|
243
|
+
#
|
244
|
+
# The {#size} method is an alias for {#length}.
|
245
|
+
#
|
246
|
+
# @example
|
247
|
+
# model = Sketchup.active_model
|
248
|
+
# model.set_attribute('Example', 'Hello', 'World')
|
249
|
+
# dictionary = model.attribute_dictionary('Example')
|
250
|
+
# number = dictionary.length
|
251
|
+
#
|
252
|
+
# @return [Integer] the size of the attribute dictionary if
|
253
|
+
# successful
|
254
|
+
#
|
255
|
+
# @version SketchUp 6.0
|
256
|
+
def size
|
257
|
+
end
|
258
|
+
|
259
|
+
# The values method is used to retrieve an array with all of the attribute
|
260
|
+
# values.
|
261
|
+
#
|
262
|
+
# @example
|
263
|
+
# create_if_nil = true
|
264
|
+
# model = Sketchup.active_model
|
265
|
+
# attrdict = model.attribute_dictionary "test_dict", create_if_nil
|
266
|
+
# attrdict["attr_one"] = "one"
|
267
|
+
# attrdict["attr_two"] = "two"
|
268
|
+
#
|
269
|
+
# # Gets an array of values
|
270
|
+
# attrdict = model.attribute_dictionaries['test_dict']
|
271
|
+
# values = attrdict.values
|
272
|
+
#
|
273
|
+
# @return keys - an array of keys within the attribute dictionary
|
274
|
+
# if successful
|
275
|
+
#
|
276
|
+
# @version SketchUp 6.0
|
277
|
+
def values
|
278
|
+
end
|
279
|
+
|
280
|
+
end
|
@@ -0,0 +1,149 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# SketchUp's drawing axes consist of three colored lines (red, green, blue),
|
5
|
+
# usually perpendicular to each other, displayed in the drawing area. The
|
6
|
+
# exception is when the user open an instance with a non-orthogonal
|
7
|
+
# transformation. The root model transformation is always orthogonal.
|
8
|
+
#
|
9
|
+
# The drawing axes are used by drawing tools to align the geometry it creates
|
10
|
+
# as well as affecting the inference engine.
|
11
|
+
#
|
12
|
+
# The plane where the red and green axes lines lie is called the ground plane.
|
13
|
+
# The term origin, is used to define the place where all of axes lines start or
|
14
|
+
# originate.
|
15
|
+
#
|
16
|
+
# @version SketchUp 2016
|
17
|
+
class Sketchup::Axes < Sketchup::Entity
|
18
|
+
|
19
|
+
# Instance Methods
|
20
|
+
|
21
|
+
# The axes method returns the vectors representing the directions of the axes.
|
22
|
+
#
|
23
|
+
# @example
|
24
|
+
# xaxis, yaxis, zaxis = Sketchup.active_model.axes.axes
|
25
|
+
#
|
26
|
+
# @return Array - an array of three vectors.
|
27
|
+
#
|
28
|
+
# @version SketchUp 2016
|
29
|
+
def axes
|
30
|
+
end
|
31
|
+
|
32
|
+
# The origin method returns the origin of the axes.
|
33
|
+
#
|
34
|
+
# @example
|
35
|
+
# point = Sketchup.active_model.axes.origin
|
36
|
+
#
|
37
|
+
# @return Point3d - the origin for the axes.
|
38
|
+
#
|
39
|
+
# @version SketchUp 2016
|
40
|
+
def origin
|
41
|
+
end
|
42
|
+
|
43
|
+
# The set method allows the axes to be manipulated. The axes must always be
|
44
|
+
# orthogonal, otherwise an error is thrown.
|
45
|
+
#
|
46
|
+
# @example
|
47
|
+
# xaxis = Geom::Vector3d.new(3, 5, 0)
|
48
|
+
# yaxis = xaxis * Z_AXIS
|
49
|
+
# Sketchup.active_model.axes.set([10,0,0], xaxis, yaxis, Z_AXIS)
|
50
|
+
#
|
51
|
+
# @param origin
|
52
|
+
# Point3d - The origin to set.
|
53
|
+
#
|
54
|
+
# @param xaxis
|
55
|
+
# Vector3d - The x axis to set.
|
56
|
+
#
|
57
|
+
# @param zaxis
|
58
|
+
# Vector3d - The z axis to set.
|
59
|
+
#
|
60
|
+
# @param yaxis
|
61
|
+
# Vector3d - The y axis to set.
|
62
|
+
#
|
63
|
+
# @return Axes - the axes object being set.
|
64
|
+
#
|
65
|
+
# @version SketchUp 2016
|
66
|
+
def set(origin, xaxis, yaxis, zaxis)
|
67
|
+
end
|
68
|
+
|
69
|
+
# The sketch_plane method returns a plane representing the ground plane of the
|
70
|
+
# axes.
|
71
|
+
#
|
72
|
+
# @example
|
73
|
+
# plane = Sketchup.active_model.axes.sketch_plane
|
74
|
+
#
|
75
|
+
# @return Array - of 4 numbers that give the coefficients of a
|
76
|
+
# plane equation.
|
77
|
+
#
|
78
|
+
# @version SketchUp 2016
|
79
|
+
def sketch_plane
|
80
|
+
end
|
81
|
+
|
82
|
+
# The axes method returns the origin and vectors representing the axes.
|
83
|
+
#
|
84
|
+
# @example
|
85
|
+
# point, xaxis, yaxis, zaxis = Sketchup.active_model.axes.to_a
|
86
|
+
#
|
87
|
+
# @return Array - an array of a point and three vectors.
|
88
|
+
#
|
89
|
+
# @version SketchUp 2016
|
90
|
+
def to_a
|
91
|
+
end
|
92
|
+
|
93
|
+
# The transformation method returns the transformation of the axes. This is
|
94
|
+
# useful when creating tools that respect the model's drawing axes.
|
95
|
+
#
|
96
|
+
# @example
|
97
|
+
# # Point for a rectangle.
|
98
|
+
# points = [
|
99
|
+
# Geom::Point3d.new( 0, 0, 0),
|
100
|
+
# Geom::Point3d.new(10, 0, 0),
|
101
|
+
# Geom::Point3d.new(10, 20, 0),
|
102
|
+
# Geom::Point3d.new( 0, 20, 0)
|
103
|
+
# ]
|
104
|
+
# # Transform the points so they are local to the model axes. Otherwise
|
105
|
+
# # they would be local to the model origin.
|
106
|
+
# tr = Sketchup.active_model.axes.transformation
|
107
|
+
# points.each { |point| point.transform!(tr) }
|
108
|
+
# Sketchup.active_model.active_entities.add_face(points)
|
109
|
+
#
|
110
|
+
# @return Transformation - the transformation for the axes.
|
111
|
+
#
|
112
|
+
# @version SketchUp 2016
|
113
|
+
def transformation
|
114
|
+
end
|
115
|
+
|
116
|
+
# The xaxis method returns the x axis of the axes.
|
117
|
+
#
|
118
|
+
# @example
|
119
|
+
# vector = Sketchup.active_model.axes.xaxis
|
120
|
+
#
|
121
|
+
# @return Vector3d - the x axis for the axes.
|
122
|
+
#
|
123
|
+
# @version SketchUp 2016
|
124
|
+
def xaxis
|
125
|
+
end
|
126
|
+
|
127
|
+
# The yaxis method returns the y axis of the axes.
|
128
|
+
#
|
129
|
+
# @example
|
130
|
+
# vector = Sketchup.active_model.axes.yaxis
|
131
|
+
#
|
132
|
+
# @return Vector3d - the y axis for the axes.
|
133
|
+
#
|
134
|
+
# @version SketchUp 2016
|
135
|
+
def yaxis
|
136
|
+
end
|
137
|
+
|
138
|
+
# The zaxis method returns the z axis of the axes.
|
139
|
+
#
|
140
|
+
# @example
|
141
|
+
# vector = Sketchup.active_model.axes.zaxis
|
142
|
+
#
|
143
|
+
# @return Vector3d - the z axis for the axes.
|
144
|
+
#
|
145
|
+
# @version SketchUp 2016
|
146
|
+
def zaxis
|
147
|
+
end
|
148
|
+
|
149
|
+
end
|