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,400 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# Drawingelement is a base class for an item in the model that can be
|
5
|
+
# displayed. These items include edges, construction points, construction
|
6
|
+
# lines, and images. Arc curves and arcs are not included because they are not
|
7
|
+
# drawing elements by themselves, but are a composition of edges.
|
8
|
+
#
|
9
|
+
# @version SketchUp 6.0
|
10
|
+
class Sketchup::Drawingelement < Sketchup::Entity
|
11
|
+
|
12
|
+
# Instance Methods
|
13
|
+
|
14
|
+
# The bounds method is used to retrieve the BoundingBox for an drawing
|
15
|
+
# element.
|
16
|
+
#
|
17
|
+
# @example
|
18
|
+
# depth = 100
|
19
|
+
# width = 100
|
20
|
+
# model = Sketchup.active_model
|
21
|
+
# entities = model.active_entities
|
22
|
+
# pts = []
|
23
|
+
# pts[0] = [0, 0, 0]
|
24
|
+
# pts[1] = [width, 0, 0]
|
25
|
+
# pts[2] = [width, depth, 0]
|
26
|
+
# pts[3] = [0, depth, 0]
|
27
|
+
# # Add the face to the entities in the model
|
28
|
+
# face = entities.add_face pts
|
29
|
+
# # Remember, anything that can be displayed, such as a face, is also
|
30
|
+
# # a Drawingelement. So I can call bounds on a face because Face
|
31
|
+
# # is a sub-class of Drawingelement.
|
32
|
+
# boundingbox = face.bounds
|
33
|
+
#
|
34
|
+
# @return boundingbox - A BoundingBox object if successful
|
35
|
+
#
|
36
|
+
# @version SketchUp 6.0
|
37
|
+
def bounds
|
38
|
+
end
|
39
|
+
|
40
|
+
# The casts_shadows= method is used to set the Drawingelement to cast shadows.
|
41
|
+
#
|
42
|
+
# @example
|
43
|
+
# depth = 100
|
44
|
+
# width = 100
|
45
|
+
# model = Sketchup.active_model
|
46
|
+
# entities = model.active_entities
|
47
|
+
# pts = []
|
48
|
+
# pts[0] = [0, 0, 100]
|
49
|
+
# pts[1] = [width, 0, 100]
|
50
|
+
# pts[2] = [width, depth, 100]
|
51
|
+
# pts[3] = [0, depth, 100]
|
52
|
+
# # Add the face to the entities in the model.
|
53
|
+
# face = entities.add_face pts
|
54
|
+
#
|
55
|
+
# # Make the face not cast shadows.
|
56
|
+
# status = face.casts_shadows = false
|
57
|
+
# UI.messagebox status.to_s
|
58
|
+
#
|
59
|
+
# @param casts
|
60
|
+
# true if you want the Drawingelement object to cast
|
61
|
+
# shadows, false if you do not want the Drawingelement
|
62
|
+
# object to cast shadows.
|
63
|
+
#
|
64
|
+
# @return status - true if successful, false if unsuccessful.
|
65
|
+
#
|
66
|
+
# @version SketchUp 6.0
|
67
|
+
def casts_shadows=(casts)
|
68
|
+
end
|
69
|
+
|
70
|
+
# The casts_shadows? method is used to determine if the Drawingelement is
|
71
|
+
# casting shadows.
|
72
|
+
#
|
73
|
+
# @example
|
74
|
+
# depth = 100
|
75
|
+
# width = 100
|
76
|
+
# model = Sketchup.active_model
|
77
|
+
# entities = model.active_entities
|
78
|
+
# pts = []
|
79
|
+
# pts[0] = [0, 0, 0]
|
80
|
+
# pts[1] = [width, 0, 0]
|
81
|
+
# pts[2] = [width, depth, 0]
|
82
|
+
# pts[3] = [0, depth, 0]
|
83
|
+
# # Add the face to the entities in the model
|
84
|
+
# face = entities.add_face pts
|
85
|
+
# status = face.casts_shadows?
|
86
|
+
# UI.messagebox status.to_s
|
87
|
+
#
|
88
|
+
# @return status - true if the Drawingelement is casting shadows,
|
89
|
+
# false if unsuccessful.
|
90
|
+
#
|
91
|
+
# @return [Boolean]
|
92
|
+
#
|
93
|
+
# @version SketchUp 6.0
|
94
|
+
def casts_shadows?
|
95
|
+
end
|
96
|
+
|
97
|
+
# The erase! method is used to erase an element from the model.
|
98
|
+
#
|
99
|
+
# Erasing an Edge also erases all of the Face objects that use the Edge.
|
100
|
+
#
|
101
|
+
# @example
|
102
|
+
# depth = 100
|
103
|
+
# width = 100
|
104
|
+
# model = Sketchup.active_model
|
105
|
+
# entities = model.active_entities
|
106
|
+
# pts = []
|
107
|
+
# pts[0] = [0, 0, 0]
|
108
|
+
# pts[1] = [width, 0, 0]
|
109
|
+
# pts[2] = [width, depth, 0]
|
110
|
+
# pts[3] = [0, depth, 0]
|
111
|
+
# # Add the face to the entities in the model
|
112
|
+
# face = entities.add_face pts
|
113
|
+
# status = face.erase!
|
114
|
+
#
|
115
|
+
# @return status - true if successful, false if unsuccessful
|
116
|
+
#
|
117
|
+
# @version SketchUp 6.0
|
118
|
+
def erase!
|
119
|
+
end
|
120
|
+
|
121
|
+
# The hidden= method is used to set the hidden status for an element.
|
122
|
+
#
|
123
|
+
# @example
|
124
|
+
# depth = 100
|
125
|
+
# width = 100
|
126
|
+
# model = Sketchup.active_model
|
127
|
+
# entities = model.active_entities
|
128
|
+
# pts = []
|
129
|
+
# pts[0] = [0, 0, 0]
|
130
|
+
# pts[1] = [width, 0, 0]
|
131
|
+
# pts[2] = [width, depth, 0]
|
132
|
+
# pts[3] = [0, depth, 0]
|
133
|
+
# # Add the face to the entities in the model
|
134
|
+
# face = entities.add_face pts
|
135
|
+
# UI.messagebox "Click OK to Hide the Box"
|
136
|
+
# status = face.hidden = true
|
137
|
+
#
|
138
|
+
# @param hidden
|
139
|
+
# true if you want to hide the element, false if you do
|
140
|
+
# not want to hide the element.
|
141
|
+
#
|
142
|
+
# @return status - true if the element has been hidden, false if
|
143
|
+
# the element has not been hidden.
|
144
|
+
#
|
145
|
+
# @version SketchUp 6.0
|
146
|
+
def hidden=(hidden)
|
147
|
+
end
|
148
|
+
|
149
|
+
# The hidden? method is used to determine if the element is hidden.
|
150
|
+
#
|
151
|
+
# Hidden elements are still in the model, but they are not displayed.
|
152
|
+
#
|
153
|
+
# @example
|
154
|
+
# depth = 100
|
155
|
+
# width = 100
|
156
|
+
# model = Sketchup.active_model
|
157
|
+
# entities = model.active_entities
|
158
|
+
# pts = []
|
159
|
+
# pts[0] = [0, 0, 0]
|
160
|
+
# pts[1] = [width, 0, 0]
|
161
|
+
# pts[2] = [width, depth, 0]
|
162
|
+
# pts[3] = [0, depth, 0]
|
163
|
+
# # Add the face to the entities in the model
|
164
|
+
# face = entities.add_face pts
|
165
|
+
# status = face.hidden?
|
166
|
+
# UI.messagebox "hidden? " + status.to_s
|
167
|
+
#
|
168
|
+
# @return status -true if hidden, false if not hidden
|
169
|
+
#
|
170
|
+
# @return [Boolean]
|
171
|
+
#
|
172
|
+
# @version SketchUp 6.0
|
173
|
+
def hidden?
|
174
|
+
end
|
175
|
+
|
176
|
+
# The layer method is used to retrieve the Layer object of the drawing
|
177
|
+
# element.
|
178
|
+
#
|
179
|
+
# @example
|
180
|
+
# depth = 100
|
181
|
+
# width = 100
|
182
|
+
# model = Sketchup.active_model
|
183
|
+
# entities = model.active_entities
|
184
|
+
# pts = []
|
185
|
+
# pts[0] = [0, 0, 0]
|
186
|
+
# pts[1] = [width, 0, 0]
|
187
|
+
# pts[2] = [width, depth, 0]
|
188
|
+
# pts[3] = [0, depth, 0]
|
189
|
+
# # Add the face to the entities in the model
|
190
|
+
# face = entities.add_face pts
|
191
|
+
# layer = face.layer
|
192
|
+
#
|
193
|
+
# @return layer - a layer object if successful
|
194
|
+
#
|
195
|
+
# @version SketchUp 6.0
|
196
|
+
def layer
|
197
|
+
end
|
198
|
+
|
199
|
+
# The layer= method is used to set the layer for the drawing element.
|
200
|
+
#
|
201
|
+
# An exception is raised if you give a string that doesn't match any layer
|
202
|
+
# name.
|
203
|
+
#
|
204
|
+
# @example
|
205
|
+
# depth = 100
|
206
|
+
# width = 100
|
207
|
+
# model = Sketchup.active_model
|
208
|
+
# entities = model.active_entities
|
209
|
+
# pts = []
|
210
|
+
# pts[0] = [0, 0, 0]
|
211
|
+
# pts[1] = [width, 0, 0]
|
212
|
+
# pts[2] = [width, depth, 0]
|
213
|
+
# pts[3] = [0, depth, 0]
|
214
|
+
# # Add the face to the entities in the model
|
215
|
+
# face = entities.add_face pts
|
216
|
+
# # Add a layer
|
217
|
+
# layer = Sketchup.active_model.layers.add "joe"
|
218
|
+
# # Put the face on the joe layer (instead of layer 0)
|
219
|
+
# newlayer = face.layer = layer
|
220
|
+
#
|
221
|
+
# @param [Sketchup::Layer, String] layer
|
222
|
+
# A layer or layer name.
|
223
|
+
#
|
224
|
+
# @return layer - the new Layer object if successful
|
225
|
+
#
|
226
|
+
# @version SketchUp 6.0
|
227
|
+
def layer=(layer)
|
228
|
+
end
|
229
|
+
|
230
|
+
# The material method is used to retrieve the material for the drawing
|
231
|
+
# element.
|
232
|
+
#
|
233
|
+
# @example
|
234
|
+
# depth = 100
|
235
|
+
# width = 100
|
236
|
+
# model = Sketchup.active_model
|
237
|
+
# entities = model.active_entities
|
238
|
+
# pts = []
|
239
|
+
# pts[0] = [0, 0, 0]
|
240
|
+
# pts[1] = [width, 0, 0]
|
241
|
+
# pts[2] = [width, depth, 0]
|
242
|
+
# pts[3] = [0, depth, 0]
|
243
|
+
# # Add the face to the entities in the model
|
244
|
+
# face = entities.add_face pts
|
245
|
+
# material = face.material
|
246
|
+
#
|
247
|
+
# @return material - the Material object if successful
|
248
|
+
#
|
249
|
+
# @version SketchUp 6.0
|
250
|
+
def material
|
251
|
+
end
|
252
|
+
|
253
|
+
# The material= method is used to set the material for the drawing
|
254
|
+
# element.
|
255
|
+
#
|
256
|
+
# @example
|
257
|
+
# depth = 100
|
258
|
+
# width = 100
|
259
|
+
# model = Sketchup.active_model
|
260
|
+
# entities = model.active_entities
|
261
|
+
# pts = []
|
262
|
+
# pts[0] = [0, 0, 0]
|
263
|
+
# pts[1] = [width, 0, 0]
|
264
|
+
# pts[2] = [width, depth, 0]
|
265
|
+
# pts[3] = [0, depth, 0]
|
266
|
+
# # Add the face to the entities in the model
|
267
|
+
# face = entities.add_face pts
|
268
|
+
# m = model.materials.add "Joe"
|
269
|
+
# begin
|
270
|
+
# # Returns nil if not successful, path if successful.
|
271
|
+
# # Should return a texture object.
|
272
|
+
# m.texture = "c:\\My Textures\\Carpet.jpg"
|
273
|
+
# rescue
|
274
|
+
# UI.messagebox $!.message
|
275
|
+
# end
|
276
|
+
# # You will see the material applied when you reverse the box's faces
|
277
|
+
# material = face.material = m
|
278
|
+
#
|
279
|
+
# @param material
|
280
|
+
# A Material, name of a material, Color, or name of a
|
281
|
+
# color.
|
282
|
+
#
|
283
|
+
# @return material - the new Material object if successful
|
284
|
+
#
|
285
|
+
# @version SketchUp 6.0
|
286
|
+
def material=(material)
|
287
|
+
end
|
288
|
+
|
289
|
+
# The receive_shadows= method is used to set the Drawingelement to receive
|
290
|
+
# shadows.
|
291
|
+
#
|
292
|
+
# @example
|
293
|
+
# depth = 100
|
294
|
+
# width = 100
|
295
|
+
# model = Sketchup.active_model
|
296
|
+
# entities = model.active_entities
|
297
|
+
# pts = []
|
298
|
+
# pts[0] = [0, 0, 100]
|
299
|
+
# pts[1] = [width, 0, 100]
|
300
|
+
# pts[2] = [width, depth, 100]
|
301
|
+
# pts[3] = [0, depth, 100]
|
302
|
+
# # Add the face to the entities in the model.
|
303
|
+
# face = entities.add_face pts
|
304
|
+
#
|
305
|
+
# # Make the face not receive shadows.
|
306
|
+
# status = face.receives_shadows = false
|
307
|
+
# UI.messagebox status.to_s
|
308
|
+
#
|
309
|
+
# @param receive
|
310
|
+
# true if you want the Drawingelement object to
|
311
|
+
# receive shadows, false if not.
|
312
|
+
#
|
313
|
+
# @return status - true if successful, false if unsuccessful.
|
314
|
+
#
|
315
|
+
# @version SketchUp 6.0
|
316
|
+
def receives_shadows=(receive)
|
317
|
+
end
|
318
|
+
|
319
|
+
# The receive_shadows? method is used to determine if the Drawingelement is
|
320
|
+
# receiving shadows.
|
321
|
+
#
|
322
|
+
# @example
|
323
|
+
# depth = 100
|
324
|
+
# width = 100
|
325
|
+
# model = Sketchup.active_model
|
326
|
+
# entities = model.active_entities
|
327
|
+
# pts = []
|
328
|
+
# pts[0] = [0, 0, 0]
|
329
|
+
# pts[1] = [width, 0, 0]
|
330
|
+
# pts[2] = [width, depth, 0]
|
331
|
+
# pts[3] = [0, depth, 0]
|
332
|
+
# # Add the face to the entities in the model
|
333
|
+
# face = entities.add_face pts
|
334
|
+
# status = face.receives_shadows?
|
335
|
+
# UI.messagebox status.to_s
|
336
|
+
#
|
337
|
+
# @return status - true if the Drawingelement is receiving
|
338
|
+
# shadows, false if unsuccessful.
|
339
|
+
#
|
340
|
+
# @return [Boolean]
|
341
|
+
#
|
342
|
+
# @version SketchUp 6.0
|
343
|
+
def receives_shadows?
|
344
|
+
end
|
345
|
+
|
346
|
+
# The visible= method is used to set the visible status for an element. This
|
347
|
+
# method performs an opposite function to the hidden= method.
|
348
|
+
#
|
349
|
+
# @example
|
350
|
+
# depth = 100
|
351
|
+
# width = 100
|
352
|
+
# model = Sketchup.active_model
|
353
|
+
# entities = model.active_entities
|
354
|
+
# pts = []
|
355
|
+
# pts[0] = [0, 0, 0]
|
356
|
+
# pts[1] = [width, 0, 0]
|
357
|
+
# pts[2] = [width, depth, 0]
|
358
|
+
# pts[3] = [0, depth, 0]
|
359
|
+
# # Add the face to the entities in the model
|
360
|
+
# face = entities.add_face pts
|
361
|
+
# UI.messagebox "Click OK to Hide the Box"
|
362
|
+
# status = face.visible = false
|
363
|
+
#
|
364
|
+
# @param visibility
|
365
|
+
# true if you want to hide the element, false if not
|
366
|
+
#
|
367
|
+
# @return status - true if the element has been hidden, false if
|
368
|
+
# the element has not been hidden.
|
369
|
+
#
|
370
|
+
# @version SketchUp 6.0
|
371
|
+
def visible=(visibility)
|
372
|
+
end
|
373
|
+
|
374
|
+
# The visible? method is used to get the visible status for an element.
|
375
|
+
#
|
376
|
+
# @example
|
377
|
+
# depth = 100
|
378
|
+
# width = 100
|
379
|
+
# model = Sketchup.active_model
|
380
|
+
# entities = model.active_entities
|
381
|
+
# pts = []
|
382
|
+
# pts[0] = [0, 0, 0]
|
383
|
+
# pts[1] = [width, 0, 0]
|
384
|
+
# pts[2] = [width, depth, 0]
|
385
|
+
# pts[3] = [0, depth, 0]
|
386
|
+
# # Add the face to the entities in the model
|
387
|
+
# face = entities.add_face pts
|
388
|
+
# UI.messagebox "Click OK to Hide the Box"
|
389
|
+
# face.visible = false
|
390
|
+
# UI.messagebox "Is the face visible? " + face.visible?.to_s
|
391
|
+
#
|
392
|
+
# @return visibility - true if visible, false if not
|
393
|
+
#
|
394
|
+
# @return [Boolean]
|
395
|
+
#
|
396
|
+
# @version SketchUp 6.0
|
397
|
+
def visible?
|
398
|
+
end
|
399
|
+
|
400
|
+
end
|
@@ -0,0 +1,517 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The Edge class contains methods modifying and extracting information for
|
5
|
+
# edges.
|
6
|
+
#
|
7
|
+
# @version SketchUp 6.0
|
8
|
+
class Sketchup::Edge < Sketchup::Drawingelement
|
9
|
+
|
10
|
+
# Instance Methods
|
11
|
+
|
12
|
+
# The all_connected method retrieves all of the entities connected to an edge,
|
13
|
+
# including the edge itself.
|
14
|
+
#
|
15
|
+
# @example
|
16
|
+
# depth = 100
|
17
|
+
# width = 100
|
18
|
+
# model = Sketchup.active_model
|
19
|
+
# entities = model.active_entities
|
20
|
+
# pts = []
|
21
|
+
# pts[0] = [0, 0, 0]
|
22
|
+
# pts[1] = [width, 0, 0]
|
23
|
+
# pts[2] = [width, depth, 0]
|
24
|
+
# pts[3] = [0, depth, 0]
|
25
|
+
# # Add the face to the entities in the model
|
26
|
+
# face = entities.add_face pts
|
27
|
+
# # I just happen to know that the second and third entities in the
|
28
|
+
# # entities objects are edges.
|
29
|
+
# entity1 = entities[1]
|
30
|
+
# entity2 = entities[2]
|
31
|
+
# edges = entity1.all_connected
|
32
|
+
# if (edges)
|
33
|
+
# UI.messagebox edges.to_s
|
34
|
+
# else
|
35
|
+
# UI.messagebox "Failure"
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# @return entities - the edge and entities connected to that edge
|
39
|
+
#
|
40
|
+
# @version SketchUp 6.0
|
41
|
+
def all_connected
|
42
|
+
end
|
43
|
+
|
44
|
+
# The common_face method is used to identify a face that is common to two
|
45
|
+
# edges.
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
# depth = 100
|
49
|
+
# width = 100
|
50
|
+
# model = Sketchup.active_model
|
51
|
+
# entities = model.active_entities
|
52
|
+
# pts = []
|
53
|
+
# pts[0] = [0,0,0]
|
54
|
+
# pts[1] = [width,0,0]
|
55
|
+
# pts[2] = [width,depth,0]
|
56
|
+
# pts[3] = [0,depth,0]
|
57
|
+
# # Add the face to the entities in the model
|
58
|
+
# face = entities.add_face pts
|
59
|
+
# # I know that the second and third entity objects are edges
|
60
|
+
# entity1 = entities[1]
|
61
|
+
# entity2 = entities[2]
|
62
|
+
# UI.messagebox entity1
|
63
|
+
# UI.messagebox entity2
|
64
|
+
# face = entity1.common_face entity2
|
65
|
+
# if (face)
|
66
|
+
# UI.messagebox face
|
67
|
+
# else
|
68
|
+
# UI.messagebox "Failure: No Common Face"
|
69
|
+
# end
|
70
|
+
#
|
71
|
+
# @param edge2
|
72
|
+
# The face whose edge you are checking for commonality.
|
73
|
+
#
|
74
|
+
# @return face - the Face object that is common to the two edges
|
75
|
+
# if successful
|
76
|
+
#
|
77
|
+
# @version SketchUp 6.0
|
78
|
+
def common_face(edge2)
|
79
|
+
end
|
80
|
+
|
81
|
+
# The curve method is used to get the Curve object that this edge belongs
|
82
|
+
# to, if any. Note that if the edge is part of an arc instead of a random
|
83
|
+
# curve, then this method will return an ArcCurve object.
|
84
|
+
#
|
85
|
+
# @example
|
86
|
+
# edge = Sketchup.active_model.entities.add_line([0,0,0],[100,100,0])
|
87
|
+
# curve = edge.curve
|
88
|
+
# if (curve)
|
89
|
+
# # If it is a curve, display a pointer to the curve
|
90
|
+
# UI.messagebox curve
|
91
|
+
# else
|
92
|
+
# UI.messagebox "Failure: Not a Curve"
|
93
|
+
# end
|
94
|
+
#
|
95
|
+
# @return curve - returns a Curve or ArcCurve object if it is a
|
96
|
+
# curve, nil if it is not a curve
|
97
|
+
#
|
98
|
+
# @version SketchUp 6.0
|
99
|
+
def curve
|
100
|
+
end
|
101
|
+
|
102
|
+
# The end method is used to retrieve the Vertex object at the end of the edge.
|
103
|
+
#
|
104
|
+
# @example
|
105
|
+
# edge = Sketchup.active_model.entities.add_line([0,0,0],[100,100,0])
|
106
|
+
# vertex = edge.end
|
107
|
+
# if (vertex)
|
108
|
+
# # display a pointer to the Vertex
|
109
|
+
# UI.messagebox vertex
|
110
|
+
# else
|
111
|
+
# UI.messagebox "Failure"
|
112
|
+
# end
|
113
|
+
# point = vertex.position
|
114
|
+
# # Let's get the Point3d of the vertex
|
115
|
+
# if (point)
|
116
|
+
# UI.messagebox point
|
117
|
+
# else
|
118
|
+
# UI.messagebox "Failure"
|
119
|
+
# end
|
120
|
+
#
|
121
|
+
# @return vertex - a Vertex object if successful
|
122
|
+
#
|
123
|
+
# @version SketchUp 6.0
|
124
|
+
def end
|
125
|
+
end
|
126
|
+
|
127
|
+
# The explode_curve method is used to explode an edge as though it were an
|
128
|
+
# ArcCurve.
|
129
|
+
#
|
130
|
+
# @example
|
131
|
+
# depth = 100
|
132
|
+
# width = 100
|
133
|
+
# model = Sketchup.active_model
|
134
|
+
# entities = model.active_entities
|
135
|
+
# pts = []
|
136
|
+
# pts[0] = [0, 0, 0]
|
137
|
+
# pts[1] = [width, 0, 0]
|
138
|
+
# pts[2] = [width, depth, 0]
|
139
|
+
# pts[3] = [0, depth, 0]
|
140
|
+
# # Add the face to the entities in the model
|
141
|
+
# face = entities.add_face pts
|
142
|
+
# # I just happen to know that the second entity in the
|
143
|
+
# # entities objects is an edge.
|
144
|
+
# entity1 = entities[1]
|
145
|
+
# curve = entity1.explode_curve
|
146
|
+
# if (curve)
|
147
|
+
# UI.messagebox curve
|
148
|
+
# else
|
149
|
+
# UI.messagebox "Failure"
|
150
|
+
# end
|
151
|
+
#
|
152
|
+
# @return edge - an exploded edge object if successful
|
153
|
+
#
|
154
|
+
# @version SketchUp 6.0
|
155
|
+
def explode_curve
|
156
|
+
end
|
157
|
+
|
158
|
+
# The faces method is used to retrieve all of the faces common to the edge.
|
159
|
+
#
|
160
|
+
# @example
|
161
|
+
# edge = Sketchup.active_model.entities.add_line([0,0,0],[100,100,0])
|
162
|
+
# faces = edge.faces
|
163
|
+
# if (faces)
|
164
|
+
# # Display the pointer to the first face returned in the array
|
165
|
+
# UI.messagebox faces[0]
|
166
|
+
# else
|
167
|
+
# UI.messagebox "Failure: No Faces Found"
|
168
|
+
# end
|
169
|
+
#
|
170
|
+
# @return faces - an array of Face objects if successful, false
|
171
|
+
# if unsuccessful
|
172
|
+
#
|
173
|
+
# @version SketchUp 6.0
|
174
|
+
def faces
|
175
|
+
end
|
176
|
+
|
177
|
+
# The find_faces method is used to create all of the Faces that can be created
|
178
|
+
# with this edge. For example, if you use the API to draw three edges that form
|
179
|
+
# a triangle, the face between them will not show up because you've only drawn
|
180
|
+
# the edges, but if you call find_faces on one of the edges, the triangle will
|
181
|
+
# be filled in.
|
182
|
+
#
|
183
|
+
# @example
|
184
|
+
# depth = 100
|
185
|
+
# width = 100
|
186
|
+
# model = Sketchup.active_model
|
187
|
+
# entities = model.active_entities
|
188
|
+
# pts = []
|
189
|
+
# pts[0] = [0, 0, 0]
|
190
|
+
# pts[1] = [width, 0, 0]
|
191
|
+
# pts[2] = [width, depth, 0]
|
192
|
+
# pts[3] = [0, depth, 0]
|
193
|
+
# # Add the face to the entities in the model
|
194
|
+
# face = entities.add_face pts
|
195
|
+
# # I just happen to know that the second entity in the
|
196
|
+
# # entities objects is an edge.
|
197
|
+
# entity1 = entities[1]
|
198
|
+
# # Getting zero.
|
199
|
+
# number = entity1.find_faces
|
200
|
+
# if (number)
|
201
|
+
# UI.messagebox "I created " + number.to_s + " faces."
|
202
|
+
# else
|
203
|
+
# UI.messagebox "Failure"
|
204
|
+
# end
|
205
|
+
#
|
206
|
+
# @return number - the number of faces found
|
207
|
+
#
|
208
|
+
# @version SketchUp 6.0
|
209
|
+
def find_faces
|
210
|
+
end
|
211
|
+
|
212
|
+
# The length method is used to retrieve the length of an edge in current
|
213
|
+
# units.
|
214
|
+
#
|
215
|
+
# You can pass in an optional Transformation (or an array that can represent a
|
216
|
+
# transformation), to correct for a parent group's transformation. For example,
|
217
|
+
# if an edge is inside of a group that is scaled to 200%, the length method
|
218
|
+
# will return the unscaled length of the edge. So by passing a 200%
|
219
|
+
# transformation object to this method, you can account for that to get the
|
220
|
+
# "visual" length of the edge.
|
221
|
+
#
|
222
|
+
# @example
|
223
|
+
# edge = Sketchup.active_model.entities.add_line([0,0,0],[100,100,0])
|
224
|
+
# length = edge.length
|
225
|
+
# if (length)
|
226
|
+
# UI.messagebox length
|
227
|
+
# end
|
228
|
+
#
|
229
|
+
# @overload length
|
230
|
+
#
|
231
|
+
# @return length - the length of the edge in current units
|
232
|
+
#
|
233
|
+
# @overload length(transform)
|
234
|
+
#
|
235
|
+
# @param transform A Transformation object or array that can
|
236
|
+
# be interpreted as a Transformation object.
|
237
|
+
# @return length - the length of the edge in current units
|
238
|
+
#
|
239
|
+
# @version SketchUp 6.0
|
240
|
+
def length(*args)
|
241
|
+
end
|
242
|
+
|
243
|
+
# The line method is used to retrieve the line defined by the edge. Lines in
|
244
|
+
# SketchUp aren't visible entities but geometric constructs represented by
|
245
|
+
# an Array with a Point3d and a Vector3d. See the Geom module and the Array
|
246
|
+
# class for more information on lines.
|
247
|
+
#
|
248
|
+
# @example
|
249
|
+
# edge = Sketchup.active_model.entities.add_line([0,0,0],[100,100,0])
|
250
|
+
# # Returns a 3D ray
|
251
|
+
# line = edge.line
|
252
|
+
# if (line)
|
253
|
+
# UI.messagebox line
|
254
|
+
# else
|
255
|
+
# UI.messagebox "Failure"
|
256
|
+
# end
|
257
|
+
#
|
258
|
+
# @return line - an array with a Point3d object and a Vector3d
|
259
|
+
# object.
|
260
|
+
#
|
261
|
+
# @version SketchUp 6.0
|
262
|
+
def line
|
263
|
+
end
|
264
|
+
|
265
|
+
# The other_vertex method is used to find the opposite vertex given one vertex
|
266
|
+
# of the edge.
|
267
|
+
#
|
268
|
+
# @example
|
269
|
+
# edge = Sketchup.active_model.entities.add_line([0,0,0],[100,100,0])
|
270
|
+
# # Get the end vertex of an edge
|
271
|
+
# vertex = edge.end
|
272
|
+
# # Should find the starting vertex
|
273
|
+
# othervertex = edge.other_vertex vertex
|
274
|
+
# if (othervertex)
|
275
|
+
# UI.messagebox othervertex
|
276
|
+
# else
|
277
|
+
# UI.messagebox "Failure"
|
278
|
+
# end
|
279
|
+
# # The Point3d for the vertex
|
280
|
+
# point = othervertex.position
|
281
|
+
# if (point)
|
282
|
+
# UI.messagebox point
|
283
|
+
# else
|
284
|
+
# UI.messagebox "Failure"
|
285
|
+
# end
|
286
|
+
#
|
287
|
+
# @param vertex1
|
288
|
+
# One of the Vertex objects associated with the edge.
|
289
|
+
#
|
290
|
+
# @return vertex2 - the other Vertex object associated with the
|
291
|
+
# edge
|
292
|
+
#
|
293
|
+
# @version SketchUp 6.0
|
294
|
+
def other_vertex(vertex1)
|
295
|
+
end
|
296
|
+
|
297
|
+
# The {#reversed_in?} method is used to determine if the edge is reversed in
|
298
|
+
# a face's bounding loop.
|
299
|
+
#
|
300
|
+
# @example
|
301
|
+
# model = Sketchup.active_model
|
302
|
+
# entities = model.active_entities
|
303
|
+
# points = []
|
304
|
+
# points[0] = [0, 0, 0]
|
305
|
+
# points[1] = [9, 0, 0]
|
306
|
+
# points[2] = [9, 9, 0]
|
307
|
+
# points[3] = [0, 9, 0]
|
308
|
+
# # Add the face to the entities in the model
|
309
|
+
# face = entities.add_face(points)
|
310
|
+
# edge = face.edges[0]
|
311
|
+
# if edge.reversed_in?(face)
|
312
|
+
# face.reverse!
|
313
|
+
# end
|
314
|
+
#
|
315
|
+
# @param [Sketchup::Face] face
|
316
|
+
# The face that is bounded by the edge.
|
317
|
+
#
|
318
|
+
# @return [Boolean]
|
319
|
+
#
|
320
|
+
# @return [Boolean] +true+ if the edge is reversed, +false+ if it is not
|
321
|
+
# reversed. +nil+ if the edge and face is not connected.
|
322
|
+
#
|
323
|
+
# @see Sketchup::EdgeUse
|
324
|
+
#
|
325
|
+
# @see Sketchup::Loop
|
326
|
+
#
|
327
|
+
# @version SketchUp 6.0
|
328
|
+
def reversed_in?(face)
|
329
|
+
end
|
330
|
+
|
331
|
+
# The {#smooth=} method is used to set the edge to be smooth.
|
332
|
+
#
|
333
|
+
# A smooth edge will cause the shading between connected faces to blend to a
|
334
|
+
# smooth transition. The edge will still be visible.
|
335
|
+
#
|
336
|
+
# @example
|
337
|
+
# edge = Sketchup.active_model.entities.add_line([0,0,0], [100,100,0])
|
338
|
+
# # Soft and Smooth are normally set in pairs.
|
339
|
+
# edge.soft = true
|
340
|
+
# edge.smooth = true
|
341
|
+
#
|
342
|
+
# @note The soft and smooth properties are normally set in pairs. You can
|
343
|
+
# observer this when the Soften/Smooth Edges feature or holding down Ctrl
|
344
|
+
# when using the Eraser Tool.
|
345
|
+
#
|
346
|
+
# @param [Boolean] value
|
347
|
+
#
|
348
|
+
# @return [Boolean]
|
349
|
+
#
|
350
|
+
# @see https://help.sketchup.com/en/article/3000097
|
351
|
+
#
|
352
|
+
# @version SketchUp 6.0
|
353
|
+
def smooth=(value)
|
354
|
+
end
|
355
|
+
|
356
|
+
# The {#smooth?} method is used to retrieve the current smooth setting for an
|
357
|
+
# edge.
|
358
|
+
#
|
359
|
+
# A smooth edge will cause the shading between connected faces to blend to a
|
360
|
+
# smooth transition. The edge will still be visible.
|
361
|
+
#
|
362
|
+
# @example
|
363
|
+
# edge = Sketchup.active_model.entities.add_line([0,0,0], [100,100,0])
|
364
|
+
# # Soft and Smooth are normally set in pairs.
|
365
|
+
# edge.smooth = !edge.smooth?
|
366
|
+
# edge.soft = edge.smooth?
|
367
|
+
#
|
368
|
+
# @return [Boolean]
|
369
|
+
#
|
370
|
+
# @see https://help.sketchup.com/en/article/3000097
|
371
|
+
#
|
372
|
+
# @version SketchUp 6.0
|
373
|
+
def smooth?
|
374
|
+
end
|
375
|
+
|
376
|
+
# The {#soft=} method is used to set the edge to be soft.
|
377
|
+
#
|
378
|
+
# A soft edge will cause the connected faces to be treated as a surface. This
|
379
|
+
# means that if you have Hidden Geometry off and select one face it will also
|
380
|
+
# select all faces connected with soft edges. A soft edge will also appear
|
381
|
+
# hidden.
|
382
|
+
#
|
383
|
+
# @example
|
384
|
+
# edge = Sketchup.active_model.entities.add_line([0,0,0], [100,100,0])
|
385
|
+
# # Soft and Smooth are normally set in pairs.
|
386
|
+
# edge.soft = true
|
387
|
+
# edge.smooth = true
|
388
|
+
#
|
389
|
+
# @note The soft and smooth properties are normally set in pairs. You can
|
390
|
+
# observer this when the Soften/Smooth Edges feature or holding down Ctrl
|
391
|
+
# when using the Eraser Tool.
|
392
|
+
#
|
393
|
+
# @param [Boolean] value
|
394
|
+
#
|
395
|
+
# @return [Boolean]
|
396
|
+
#
|
397
|
+
# @see https://help.sketchup.com/en/article/3000097
|
398
|
+
#
|
399
|
+
# @version SketchUp 6.0
|
400
|
+
def soft=(value)
|
401
|
+
end
|
402
|
+
|
403
|
+
# The {#soft?} method is used to retrieve the current smooth setting for an
|
404
|
+
# edge.
|
405
|
+
#
|
406
|
+
# A soft edge will cause the connected faces to be treated as a surface. This
|
407
|
+
# means that if you have Hidden Geometry off and select one face it will also
|
408
|
+
# select all faces connected with soft edges. A soft edge will also appear
|
409
|
+
# hidden.
|
410
|
+
#
|
411
|
+
# @example
|
412
|
+
# edge = Sketchup.active_model.entities.add_line([0,0,0], [100,100,0])
|
413
|
+
# # Soft and Smooth are normally set in pairs.
|
414
|
+
# edge.soft = !edge.soft?
|
415
|
+
# edge.smooth = edge.soft?
|
416
|
+
#
|
417
|
+
# @return [Boolean]
|
418
|
+
#
|
419
|
+
# @see https://help.sketchup.com/en/article/3000097
|
420
|
+
#
|
421
|
+
# @version SketchUp 6.0
|
422
|
+
def soft?
|
423
|
+
end
|
424
|
+
|
425
|
+
# The split method is used to to split an edge into to or more distinct
|
426
|
+
# edges. If a Point3d is given, it must be a point that is on the Edge.
|
427
|
+
#
|
428
|
+
# If a Float is given, it is a number between 0 and 1 that gives the
|
429
|
+
# relative position along the edge at which to split it. For example,
|
430
|
+
# edge.split(0.5) will split the Edge at its midpoint. This split position
|
431
|
+
# is measured from the Edge.start.
|
432
|
+
#
|
433
|
+
# Returns the new Edge that was created as a result of splitting this one.
|
434
|
+
#
|
435
|
+
# @example
|
436
|
+
# # Split a line in half.
|
437
|
+
# edge = Sketchup.active_model.entities.add_line([0,0,0],[100,100,0])
|
438
|
+
# new_edge = edge.split 0.5
|
439
|
+
#
|
440
|
+
# @param position
|
441
|
+
# A Point3d object whose location is along the edge, or
|
442
|
+
# a Float between 0.0 and 1.0 defining how far along the
|
443
|
+
# edge to split.
|
444
|
+
#
|
445
|
+
# @return edge - the new Edge object that was split off
|
446
|
+
# the old one if successful
|
447
|
+
#
|
448
|
+
# @version SketchUp 6.0
|
449
|
+
def split(position)
|
450
|
+
end
|
451
|
+
|
452
|
+
# The end method is used to retrieve the Vertex object at the start of the
|
453
|
+
# edge.
|
454
|
+
#
|
455
|
+
# @example
|
456
|
+
# edge = Sketchup.active_model.entities.add_line([0,0,0],[100,100,0])
|
457
|
+
# vertex = edge.start
|
458
|
+
# if (vertex)
|
459
|
+
# # display a pointer to the Vertex
|
460
|
+
# UI.messagebox vertex
|
461
|
+
# else
|
462
|
+
# UI.messagebox "Failure"
|
463
|
+
# end
|
464
|
+
# point = vertex.position
|
465
|
+
# # Let's get the Point3d of the vertex
|
466
|
+
# if (point)
|
467
|
+
# UI.messagebox point
|
468
|
+
# else
|
469
|
+
# UI.messagebox "Failure"
|
470
|
+
# end
|
471
|
+
#
|
472
|
+
# @return vertex - a Vertex object if successful
|
473
|
+
#
|
474
|
+
# @version SketchUp 6.0
|
475
|
+
def start
|
476
|
+
end
|
477
|
+
|
478
|
+
# The used_by? method is used to see if an edge is used by a given Face or
|
479
|
+
# Vertex.
|
480
|
+
#
|
481
|
+
# @example
|
482
|
+
# edge = Sketchup.active_model.entities.add_line([0,0,0],[100,100,0])
|
483
|
+
# # Returns a vertex
|
484
|
+
# vertex = edge.start
|
485
|
+
# # Check to see if the edge is used by the Vertex.
|
486
|
+
# status = edge.used_by? vertex
|
487
|
+
# if (status)
|
488
|
+
# UI.messagebox status
|
489
|
+
# else
|
490
|
+
# UI.messagebox "Failure"
|
491
|
+
# end
|
492
|
+
#
|
493
|
+
# @param element
|
494
|
+
# A Vertex or Face object.
|
495
|
+
#
|
496
|
+
# @return status - true if the face belongs to the element,
|
497
|
+
# false if not.
|
498
|
+
#
|
499
|
+
# @return [Boolean]
|
500
|
+
#
|
501
|
+
# @version SketchUp 6.0
|
502
|
+
def used_by?(element)
|
503
|
+
end
|
504
|
+
|
505
|
+
# The vertices method is used to retrieve the vertices on the edge.
|
506
|
+
#
|
507
|
+
# @example
|
508
|
+
# edge = Sketchup.active_model.entities.add_line([0,0,0],[100,100,0])
|
509
|
+
# vertices = edge.vertices
|
510
|
+
#
|
511
|
+
# @return vertices - an array of Vertex objects
|
512
|
+
#
|
513
|
+
# @version SketchUp 6.0
|
514
|
+
def vertices
|
515
|
+
end
|
516
|
+
|
517
|
+
end
|