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,82 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# This observer interface is implemented to react to component instance
|
5
|
+
# events. To implement this observer, create a Ruby class of this type,
|
6
|
+
# override the desired methods, and add an instance of the observer to the
|
7
|
+
# objects of interests.
|
8
|
+
#
|
9
|
+
# Note that you may also attach {Sketchup::InstanceObserver}s to
|
10
|
+
# {Sketchup::Group}s.
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# # This is an example of an observer that watches a specific instance
|
14
|
+
# # for open edit actions and shows a messagebox.
|
15
|
+
# class MyInstanceObserver < Sketchup::InstanceObserver
|
16
|
+
# def onOpen(instance)
|
17
|
+
# puts "onOpen: #{instance}"
|
18
|
+
# end
|
19
|
+
#
|
20
|
+
# def onClose(instance)
|
21
|
+
# puts "onClose: #{instance}"
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
# # Attach the observer. (This example assumes that your first definition
|
26
|
+
# # in the model contains an instance to attach the observer to. This
|
27
|
+
# # example should work with a model where Sang or Bryce are present in
|
28
|
+
# # the template.)
|
29
|
+
# model = Sketchup.active_model
|
30
|
+
# model.definitions[0].instances[0].add_observer(MyInstanceObserver.new)
|
31
|
+
#
|
32
|
+
# @version SketchUp 6.0
|
33
|
+
class Sketchup::InstanceObserver < Sketchup::EntityObserver
|
34
|
+
|
35
|
+
# Instance Methods
|
36
|
+
|
37
|
+
# The {#onClose} method is called when an instance is "closed," meaning an end
|
38
|
+
# user was editing a component's geometry and then exited back into the
|
39
|
+
# parent's editing space.
|
40
|
+
#
|
41
|
+
# @example
|
42
|
+
# def onClose(instance)
|
43
|
+
# puts "onClose: #{instance}"
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
# @param [Sketchup::ComponentInstance] instance
|
47
|
+
# The instance that was just
|
48
|
+
# closed
|
49
|
+
#
|
50
|
+
# @return [nil]
|
51
|
+
#
|
52
|
+
# @version SketchUp 6.0
|
53
|
+
def onClose(instance)
|
54
|
+
end
|
55
|
+
|
56
|
+
# The {#onOpen} method is called when an instance is "opened," meaning an end
|
57
|
+
# user has double clicked on it to edit its geometry. This is particularly
|
58
|
+
# useful if your plugin is dynamically drawing geometry or performing
|
59
|
+
# transformations in global space, since when in "edit component" mode all
|
60
|
+
# transformations and positions are returned in relation to the current
|
61
|
+
# component's origin.
|
62
|
+
#
|
63
|
+
# This method will tell you when a user has entered edit mode, and you can
|
64
|
+
# then use {Sketchup::Model#active_path} and {Sketchup::Model#edit_transform}
|
65
|
+
# methods to determine any corrections you need to make to your
|
66
|
+
# transformations.
|
67
|
+
#
|
68
|
+
# @example
|
69
|
+
# def onOpen(instance)
|
70
|
+
# puts "onOpen: #{instance}"
|
71
|
+
# end
|
72
|
+
#
|
73
|
+
# @param [Sketchup::ComponentInstance] instance
|
74
|
+
# The instance that was opened
|
75
|
+
#
|
76
|
+
# @return [nil]
|
77
|
+
#
|
78
|
+
# @version SketchUp 6.0
|
79
|
+
def onOpen(instance)
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
@@ -0,0 +1,297 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The {Sketchup::InstancePath} class represent the instance path to a given
|
5
|
+
# entity within the model hierarchy.
|
6
|
+
#
|
7
|
+
# @version SketchUp 2017
|
8
|
+
class Sketchup::InstancePath
|
9
|
+
|
10
|
+
# Includes
|
11
|
+
|
12
|
+
include Enumerable
|
13
|
+
|
14
|
+
# Instance Methods
|
15
|
+
|
16
|
+
#
|
17
|
+
# @example
|
18
|
+
# model = Sketchup.active_model
|
19
|
+
# group = model.entities.add_group
|
20
|
+
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
21
|
+
# path = Sketchup::InstancePath.new(group, edge])
|
22
|
+
# if path.size > 1
|
23
|
+
# # do something
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
# @return [Boolean] `true` if the instances paths represent the same set of
|
27
|
+
# entities.
|
28
|
+
#
|
29
|
+
# @version SketchUp 2017
|
30
|
+
def ==(other)
|
31
|
+
end
|
32
|
+
|
33
|
+
# The elements of an instance path can be accessed like an array.
|
34
|
+
#
|
35
|
+
# @example
|
36
|
+
# model = Sketchup.active_model
|
37
|
+
# group = model.entities.add_group
|
38
|
+
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
39
|
+
# path = Sketchup::InstancePath.new(group, edge])
|
40
|
+
# path[0] == group # returns true
|
41
|
+
# path[1] == edge # returns true
|
42
|
+
#
|
43
|
+
# @param [Integer] index
|
44
|
+
#
|
45
|
+
# @raise [TypeError] if the instance path refer to deleted entities.
|
46
|
+
#
|
47
|
+
# @raise [TypeError] if the index is not of integer type
|
48
|
+
#
|
49
|
+
# @raise [IndexError] if the given index is out of bounds
|
50
|
+
#
|
51
|
+
# @return [Sketchup::Entity]
|
52
|
+
#
|
53
|
+
# @version SketchUp 2017
|
54
|
+
def [](index)
|
55
|
+
end
|
56
|
+
|
57
|
+
# The yielded entities will start with the root and end with the leaf.
|
58
|
+
#
|
59
|
+
# @example
|
60
|
+
# model = Sketchup.active_model
|
61
|
+
# group = model.entities.add_group
|
62
|
+
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
63
|
+
# path = Sketchup::InstancePath.new(group, edge])
|
64
|
+
# path.each { |entity|
|
65
|
+
# # do something
|
66
|
+
# }
|
67
|
+
#
|
68
|
+
# @raise [TypeError] if the instance path refer to deleted entities.
|
69
|
+
#
|
70
|
+
# @return [nil]
|
71
|
+
#
|
72
|
+
# @version SketchUp 2017
|
73
|
+
#
|
74
|
+
# @yield [Sketchup::Entity] entity
|
75
|
+
def each
|
76
|
+
end
|
77
|
+
|
78
|
+
#
|
79
|
+
# @example
|
80
|
+
# model = Sketchup.active_model
|
81
|
+
# group = model.entities.add_group
|
82
|
+
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
83
|
+
# path = Sketchup::InstancePath.new(group, edge])
|
84
|
+
# if path.empty?
|
85
|
+
# # do something...
|
86
|
+
# end
|
87
|
+
#
|
88
|
+
# @raise [TypeError] if the instance path refer to deleted entities.
|
89
|
+
#
|
90
|
+
# @return [Boolean]
|
91
|
+
#
|
92
|
+
# @version SketchUp 2017
|
93
|
+
def empty?
|
94
|
+
end
|
95
|
+
|
96
|
+
# Returns `true` if the instance path contain the given object.
|
97
|
+
#
|
98
|
+
# @example
|
99
|
+
# model = Sketchup.active_model
|
100
|
+
# group = model.entities.add_group
|
101
|
+
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
102
|
+
# path = Sketchup::InstancePath.new(group, edge])
|
103
|
+
# if path.include?(edge)
|
104
|
+
# # do something...
|
105
|
+
# end
|
106
|
+
#
|
107
|
+
# @param [Object] object
|
108
|
+
#
|
109
|
+
# @raise [TypeError] if the instance path refer to deleted entities.
|
110
|
+
#
|
111
|
+
# @return [Boolean]
|
112
|
+
#
|
113
|
+
# @version SketchUp 2017
|
114
|
+
def include?(object)
|
115
|
+
end
|
116
|
+
|
117
|
+
#
|
118
|
+
# @example
|
119
|
+
# model = Sketchup.active_model
|
120
|
+
# group = model.entities.add_group
|
121
|
+
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
122
|
+
# path = Sketchup::InstancePath.new([group, edge])
|
123
|
+
#
|
124
|
+
# @param [Array<Sketchup::Entity>] path
|
125
|
+
# The leaf can be any entity, but the
|
126
|
+
# rest must be a group or component instance.
|
127
|
+
#
|
128
|
+
# @raise [ArgumentError] if the instance path isn't composed of instances and
|
129
|
+
# an optional leaf entity.
|
130
|
+
#
|
131
|
+
# @return [Sketchup::InstancePath]
|
132
|
+
#
|
133
|
+
# @version SketchUp 2017
|
134
|
+
def initialize(path)
|
135
|
+
end
|
136
|
+
|
137
|
+
# The leaf of an instance path is the last element which can be any entity
|
138
|
+
# that can be represented in the model. This is normally a
|
139
|
+
# {Sketchup::Drawingelement}, but could be a {Sketchup::Vertex}.
|
140
|
+
#
|
141
|
+
# An instance can also be a leaf.
|
142
|
+
#
|
143
|
+
# @example
|
144
|
+
# model = Sketchup.active_model
|
145
|
+
# group = model.entities.add_group
|
146
|
+
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
147
|
+
# path = Sketchup::InstancePath.new(group, edge])
|
148
|
+
# path.leaf == edge # returns true
|
149
|
+
#
|
150
|
+
# @raise [TypeError] if the instance path refer to deleted entities.
|
151
|
+
#
|
152
|
+
# @return [Sketchup::Entity]
|
153
|
+
#
|
154
|
+
# @version SketchUp 2017
|
155
|
+
def leaf
|
156
|
+
end
|
157
|
+
|
158
|
+
# {#length} is and alias of {#size}.
|
159
|
+
#
|
160
|
+
# @example
|
161
|
+
# model = Sketchup.active_model
|
162
|
+
# group = model.entities.add_group
|
163
|
+
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
164
|
+
# path = Sketchup::InstancePath.new(group, edge])
|
165
|
+
# if path.size > 1
|
166
|
+
# # do something
|
167
|
+
# end
|
168
|
+
#
|
169
|
+
# @raise [TypeError] if the instance path refer to deleted entities.
|
170
|
+
#
|
171
|
+
# @return [Integer]
|
172
|
+
#
|
173
|
+
# @version SketchUp 2017
|
174
|
+
def length
|
175
|
+
end
|
176
|
+
|
177
|
+
# The serialized version of an instance path is the persistent ids of its
|
178
|
+
# entities concatenated with a period.
|
179
|
+
#
|
180
|
+
# @example
|
181
|
+
# model = Sketchup.active_model
|
182
|
+
# group = model.entities.add_group
|
183
|
+
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
184
|
+
# path = Sketchup::InstancePath.new(group, edge])
|
185
|
+
# pid_path = path.persistent_id_path # something like "342.345"
|
186
|
+
#
|
187
|
+
# @raise [TypeError] if the instance path refer to deleted entities.
|
188
|
+
#
|
189
|
+
# @return [String]
|
190
|
+
#
|
191
|
+
# @see Sketchup::Model#instance_path_from_pid_path
|
192
|
+
#
|
193
|
+
# @version SketchUp 2017
|
194
|
+
def persistent_id_path
|
195
|
+
end
|
196
|
+
|
197
|
+
# The root of an instance path is the element located closest to the model
|
198
|
+
# root. This will be a group or component instance. If you have a non-instance
|
199
|
+
# as a leaf with no other parent component this will return `nil`.
|
200
|
+
#
|
201
|
+
# @example
|
202
|
+
# model = Sketchup.active_model
|
203
|
+
# group = model.entities.add_group
|
204
|
+
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
205
|
+
# path = Sketchup::InstancePath.new(group, edge])
|
206
|
+
# path.root == group # returns true
|
207
|
+
#
|
208
|
+
# @raise [TypeError] if the instance path refer to deleted entities.
|
209
|
+
#
|
210
|
+
# @return [Sketchup::Group, Sketchup::ComponentInstance, nil]
|
211
|
+
#
|
212
|
+
# @version SketchUp 2017
|
213
|
+
def root
|
214
|
+
end
|
215
|
+
|
216
|
+
# {#length} is and alias of {#size}.
|
217
|
+
#
|
218
|
+
# @example
|
219
|
+
# model = Sketchup.active_model
|
220
|
+
# group = model.entities.add_group
|
221
|
+
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
222
|
+
# path = Sketchup::InstancePath.new(group, edge])
|
223
|
+
# if path.size > 1
|
224
|
+
# # do something
|
225
|
+
# end
|
226
|
+
#
|
227
|
+
# @raise [TypeError] if the instance path refer to deleted entities.
|
228
|
+
#
|
229
|
+
# @return [Integer]
|
230
|
+
#
|
231
|
+
# @version SketchUp 2017
|
232
|
+
def size
|
233
|
+
end
|
234
|
+
|
235
|
+
#
|
236
|
+
# @example
|
237
|
+
# model = Sketchup.active_model
|
238
|
+
# group = model.entities.add_group
|
239
|
+
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
240
|
+
# path = Sketchup::InstancePath.new(group, edge])
|
241
|
+
# pid_string = path.to_a.join('.')
|
242
|
+
#
|
243
|
+
# @raise [TypeError] if the instance path refer to deleted entities.
|
244
|
+
#
|
245
|
+
# @return [Array] an array representing the instance path.
|
246
|
+
#
|
247
|
+
# @version SketchUp 2017
|
248
|
+
def to_a
|
249
|
+
end
|
250
|
+
|
251
|
+
# overload transformation
|
252
|
+
# @return [Sketchup::Transformation] the combined transformation up to the
|
253
|
+
# the leaf entity.
|
254
|
+
#
|
255
|
+
# @example
|
256
|
+
# model = Sketchup.active_model
|
257
|
+
# group = model.entities.add_group
|
258
|
+
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
259
|
+
# path = Sketchup::InstancePath.new(group, edge])
|
260
|
+
# tr = path.transformation
|
261
|
+
#
|
262
|
+
# @param [Integer] index
|
263
|
+
#
|
264
|
+
# @raise [TypeError] if the index is not of integer type
|
265
|
+
#
|
266
|
+
# @raise [IndexError] if the given index is out of bounds
|
267
|
+
#
|
268
|
+
# @raise [TypeError] if the instance path refer to deleted entities.
|
269
|
+
#
|
270
|
+
# @return [Sketchup::Transformation] the combined transformation up to the
|
271
|
+
# the given index.
|
272
|
+
#
|
273
|
+
# @version SketchUp 2017
|
274
|
+
def transformation(index)
|
275
|
+
end
|
276
|
+
|
277
|
+
# An instance path is valid if it has at least one element and consist of
|
278
|
+
# groups and instances with exception of the leaf which can be any entity.
|
279
|
+
#
|
280
|
+
# This method doesn't check if the path can actually be looked up in the model.
|
281
|
+
#
|
282
|
+
# @example
|
283
|
+
# model = Sketchup.active_model
|
284
|
+
# group = model.entities.add_group
|
285
|
+
# edge = group.entities.add_line([10, 10, 10], [20, 20, 20])
|
286
|
+
# path = Sketchup::InstancePath.new(group, edge])
|
287
|
+
# if path.valid?
|
288
|
+
# # do something...
|
289
|
+
# end
|
290
|
+
#
|
291
|
+
# @return [Boolean]
|
292
|
+
#
|
293
|
+
# @version SketchUp 2017
|
294
|
+
def valid?
|
295
|
+
end
|
296
|
+
|
297
|
+
end
|
@@ -0,0 +1,240 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The Layer class contains methods modifying and extracting information for a
|
5
|
+
# layer.
|
6
|
+
#
|
7
|
+
# By default, a SketchUp model has one layer, Layer 0 (zero), which is the base
|
8
|
+
# layer. You can't delete or rename Layer 0. Unlike certain other CAD software
|
9
|
+
# packages, entities associated with different layers in SketchUp still
|
10
|
+
# intersect with each other. (If you want collections of entities to not
|
11
|
+
# intersect, place them in Groups instead.)
|
12
|
+
#
|
13
|
+
# Layers are commonly used to organize your model and control the visibility
|
14
|
+
# of related groups and components. For example, you could make all of your
|
15
|
+
# wall and roof entities different groups, associate layers with those groups,
|
16
|
+
# and then hide those layers so as to display just the floor plan in the model.
|
17
|
+
#
|
18
|
+
# You can programatically create a new layer by calling the Layers.add method.
|
19
|
+
#
|
20
|
+
# @example
|
21
|
+
# model = Sketchup.active_model
|
22
|
+
# layers = model.layers
|
23
|
+
# new_layer = layers.add "test layer"
|
24
|
+
#
|
25
|
+
# @version SketchUp 6.0
|
26
|
+
class Sketchup::Layer < Sketchup::Entity
|
27
|
+
|
28
|
+
# Includes
|
29
|
+
|
30
|
+
include Comparable
|
31
|
+
|
32
|
+
# Instance Methods
|
33
|
+
|
34
|
+
# The <=> method is used to compare two layers based on their names. You could
|
35
|
+
# use this for sorting if you're building a list of layer names.
|
36
|
+
#
|
37
|
+
# @example
|
38
|
+
# model = Sketchup.active_model
|
39
|
+
# layers = model.layers
|
40
|
+
# new_layer = layers.add "test layer"
|
41
|
+
# layer1 = layers[0]
|
42
|
+
# layer2 = layers[1]
|
43
|
+
# status = layer1 <=> layer2
|
44
|
+
#
|
45
|
+
# @param layer2
|
46
|
+
# A Layer object.
|
47
|
+
#
|
48
|
+
# @return status - -1 if layer1 is less than layer2. 1 if layer2
|
49
|
+
# is less than layer1. 0 if layer1 and layer2 are
|
50
|
+
# equal.
|
51
|
+
#
|
52
|
+
# @version SketchUp 6.0
|
53
|
+
def <=>(layer2)
|
54
|
+
end
|
55
|
+
|
56
|
+
# The == method is used to determine if two layers are the same.
|
57
|
+
#
|
58
|
+
# @example
|
59
|
+
# model = Sketchup.active_model
|
60
|
+
# layers = model.layers
|
61
|
+
# layer1 = layers.add "test layer 1"
|
62
|
+
# layer2 = layers.add "test layer 2"
|
63
|
+
# status = layer1 == layer2
|
64
|
+
#
|
65
|
+
# @param layer2
|
66
|
+
# A Layer object.
|
67
|
+
#
|
68
|
+
# @return status - true if layer1 and layer2 are equal. false if
|
69
|
+
# layer1 and layer2 are not equal.
|
70
|
+
#
|
71
|
+
# @version SketchUp 6.0
|
72
|
+
def ==(layer2)
|
73
|
+
end
|
74
|
+
|
75
|
+
# The color method is used to retrieve the color of the layer.
|
76
|
+
#
|
77
|
+
# @example
|
78
|
+
# model = Sketchup.active_model
|
79
|
+
# layers = model.layers
|
80
|
+
# new_layer = layers.add('Test layer')
|
81
|
+
# color = new_layer.color
|
82
|
+
#
|
83
|
+
# @return color - the color of the Layer object
|
84
|
+
#
|
85
|
+
# @version SketchUp 2014
|
86
|
+
def color
|
87
|
+
end
|
88
|
+
|
89
|
+
# The color= method is used to set the name of a layer.
|
90
|
+
#
|
91
|
+
# @example
|
92
|
+
# model = Sketchup.active_model
|
93
|
+
# layers = model.layers
|
94
|
+
# new_layer = layers.add('Test layer')
|
95
|
+
# new_layer.color = Sketchup::Color.new(192, 0, 0)
|
96
|
+
#
|
97
|
+
# @param color
|
98
|
+
# The new color for the Layer object.
|
99
|
+
#
|
100
|
+
# @return color
|
101
|
+
#
|
102
|
+
# @version SketchUp 2014
|
103
|
+
def color=(color)
|
104
|
+
end
|
105
|
+
|
106
|
+
# The name method is used to retrieve the name of the layer.
|
107
|
+
#
|
108
|
+
# @example
|
109
|
+
# model = Sketchup.active_model
|
110
|
+
# layers = model.layers
|
111
|
+
# new_layer = layers.add "test layer"
|
112
|
+
# name = new_layer.name
|
113
|
+
#
|
114
|
+
# @return name - the name of the Layer object
|
115
|
+
#
|
116
|
+
# @version SketchUp 6.0
|
117
|
+
def name
|
118
|
+
end
|
119
|
+
|
120
|
+
# The name= method is used to set the name of a layer.
|
121
|
+
#
|
122
|
+
# @example
|
123
|
+
# model = Sketchup.active_model
|
124
|
+
# layers = model.layers
|
125
|
+
# new_layer = layers.add "test layer"
|
126
|
+
# name = new_layer.name = "new test layer"
|
127
|
+
#
|
128
|
+
# @param name
|
129
|
+
# The new name for the Layer object.
|
130
|
+
#
|
131
|
+
# @return name - the newly set name
|
132
|
+
#
|
133
|
+
# @version SketchUp 6.0
|
134
|
+
def name=(name)
|
135
|
+
end
|
136
|
+
|
137
|
+
# The page_behavior method is used to retrieve the visibility behavior of the
|
138
|
+
# layer for new pages and existing pages. For example, you may want your layer
|
139
|
+
# to be visible or hidden by default in any new pages (aka Scenes) created by
|
140
|
+
# the user.
|
141
|
+
#
|
142
|
+
# A page keeps a list of layers that do not have their default behavior.
|
143
|
+
# If a layer is not in that list, then it is set to its default visibility
|
144
|
+
# determined by one of these values:
|
145
|
+
#
|
146
|
+
# The behaviour is composed of a combination of these flags:
|
147
|
+
# - LAYER_VISIBLE_BY_DEFAULT: 0x0000
|
148
|
+
# - LAYER_HIDDEN_BY_DEFAULT: 0x0001
|
149
|
+
# - LAYER_USES_DEFAULT_VISIBILITY_ON_NEW_PAGES: 0x0000
|
150
|
+
# - LAYER_IS_VISIBLE_ON_NEW_PAGES: 0x0010
|
151
|
+
# - LAYER_IS_HIDDEN_ON_NEW_PAGES: 0x0020
|
152
|
+
#
|
153
|
+
# The default visibility for a layer is set by either
|
154
|
+
# <code>LAYER_VISIBLE_BY_DEFAULT</code> or
|
155
|
+
# <code>LAYER_HIDDEN_BY_DEFAULT</code>. This is what will be used when a page
|
156
|
+
# does not contain the visibility state of a layer.
|
157
|
+
#
|
158
|
+
# The remaining flags control the visibility of the layer for new pages.
|
159
|
+
#
|
160
|
+
# @example
|
161
|
+
# model = Sketchup.active_model
|
162
|
+
# layers = model.layers
|
163
|
+
# layer = layers.add('Test Layer')
|
164
|
+
# hidden_by_default = (layer.page_behavior & LAYER_HIDDEN_BY_DEFAULT) ==
|
165
|
+
# LAYER_HIDDEN_BY_DEFAULT
|
166
|
+
#
|
167
|
+
# @return pagebehavior - an integer representing the current
|
168
|
+
# behavior of the layer.
|
169
|
+
#
|
170
|
+
# @version SketchUp 6.0
|
171
|
+
def page_behavior
|
172
|
+
end
|
173
|
+
|
174
|
+
# The page_behavior= method is used to control the layer's visibility behavior
|
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
|
183
|
+
#
|
184
|
+
# When you Update a page (as opposed to creating a new page) the current
|
185
|
+
# visibility of the layer is used.
|
186
|
+
#
|
187
|
+
# NOTE: Prior to SketchUp 2014 the <code>LAYER_HIDDEN_BY_DEFAULT</code> flag
|
188
|
+
# would trigger the validation check in SketchUp that would reset the
|
189
|
+
# <code>page_behavior</code> of the layer.
|
190
|
+
#
|
191
|
+
# @example
|
192
|
+
# layers = Sketchup.active_model.layers
|
193
|
+
# layer = layers.add('Test Layer')
|
194
|
+
# behavior = LAYER_HIDDEN_BY_DEFAULT | LAYER_IS_HIDDEN_ON_NEW_PAGES
|
195
|
+
# layer.page_behavior = behavior
|
196
|
+
#
|
197
|
+
# @param pagebehavior
|
198
|
+
# Pagebehavior value.
|
199
|
+
#
|
200
|
+
# @return pagebehavior - an integer representing the default
|
201
|
+
# visibility of the layer.
|
202
|
+
#
|
203
|
+
# @version SketchUp 6.0
|
204
|
+
def page_behavior=(pagebehavior)
|
205
|
+
end
|
206
|
+
|
207
|
+
# The visible= method is used to set if the layer is visible.
|
208
|
+
#
|
209
|
+
# @example
|
210
|
+
# model = Sketchup.active_model
|
211
|
+
# layers = model.layers
|
212
|
+
# new_layer = layers.add "test layer"
|
213
|
+
#
|
214
|
+
# # Hide the layer.
|
215
|
+
# new_layer.visible = false
|
216
|
+
#
|
217
|
+
# @param is_visible
|
218
|
+
# The new visibility setting.
|
219
|
+
#
|
220
|
+
# @version SketchUp 6.0
|
221
|
+
def visible=(is_visible)
|
222
|
+
end
|
223
|
+
|
224
|
+
# The visible? method is used to determine if the layer is visible.
|
225
|
+
#
|
226
|
+
# @example
|
227
|
+
# model = Sketchup.active_model
|
228
|
+
# layers = model.layers
|
229
|
+
# new_layer = layers.add "test layer"
|
230
|
+
# UI.messagebox(new_layer.visible?)
|
231
|
+
#
|
232
|
+
# @return true if the layer is visible
|
233
|
+
#
|
234
|
+
# @return [Boolean]
|
235
|
+
#
|
236
|
+
# @version SketchUp 6.0
|
237
|
+
def visible?
|
238
|
+
end
|
239
|
+
|
240
|
+
end
|