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,338 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The Behavior class is used to control the "behavior" of components, which
|
5
|
+
# roughly correlates to the series of options that you see in the
|
6
|
+
# Components dialog under the "edit" tab, such as whether it casts shadows,
|
7
|
+
# glues to walls, etc.
|
8
|
+
#
|
9
|
+
# A Behavior object is accessed from a ComponentDefinition object, not created
|
10
|
+
# with a Behavior.new call.
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# # Grab the Behavior object from the first component definition.
|
14
|
+
# model = Sketchup.active_model
|
15
|
+
# definition = model.definitions[0]
|
16
|
+
# behavior = definition.behavior
|
17
|
+
#
|
18
|
+
# @version SketchUp 6.0
|
19
|
+
class Sketchup::Behavior < Sketchup::Entity
|
20
|
+
|
21
|
+
# Instance Methods
|
22
|
+
|
23
|
+
# The always_face_camera= method is used to set the always_face_camera
|
24
|
+
# behavior for a component.
|
25
|
+
#
|
26
|
+
# If the always_face_camera behavior is true, a component will always try to
|
27
|
+
# orient itself so that the Y axis of the component is facing the camera.
|
28
|
+
#
|
29
|
+
# @example
|
30
|
+
# model = Sketchup.active_model
|
31
|
+
# behavior = model.definitions[0].behavior
|
32
|
+
# status = behavior.always_face_camera = false
|
33
|
+
#
|
34
|
+
# @param setting
|
35
|
+
# Sets the always_face_camera behavior to true or false.
|
36
|
+
#
|
37
|
+
# @return status - the status of the always_face_camera behavior.
|
38
|
+
#
|
39
|
+
# @version SketchUp 6.0
|
40
|
+
def always_face_camera=(setting)
|
41
|
+
end
|
42
|
+
|
43
|
+
# The always_face_camera? method is used to retrieve the always_face_camera
|
44
|
+
# behavior for a component.
|
45
|
+
#
|
46
|
+
# If the always_face_camera behavior is true, then a component will always try
|
47
|
+
# to orient itself so that the -Y axis of the component is facing the camera.
|
48
|
+
#
|
49
|
+
# @example
|
50
|
+
# model = Sketchup.active_model
|
51
|
+
# # Returns a DefinitionList
|
52
|
+
# definitions = model.definitions
|
53
|
+
# path = Sketchup.find_support_file "Bed.skp",
|
54
|
+
# "Components/Components Sampler/"
|
55
|
+
#
|
56
|
+
# begin
|
57
|
+
# definition = definitions.load path
|
58
|
+
# rescue
|
59
|
+
# UI.messagebox $!.message
|
60
|
+
# end
|
61
|
+
#
|
62
|
+
# behavior = definition.behavior
|
63
|
+
# b = behavior.always_face_camera?
|
64
|
+
# if (b)
|
65
|
+
# UI.messagebox b
|
66
|
+
# else
|
67
|
+
# UI.messagebox "Always Face Camera is equal to false"
|
68
|
+
# end
|
69
|
+
# status = behavior.always_face_camera = true
|
70
|
+
# b = behavior.always_face_camera?
|
71
|
+
# if (b)
|
72
|
+
# UI.messagebox b
|
73
|
+
# else
|
74
|
+
# UI.messagebox "Failure"
|
75
|
+
# end
|
76
|
+
#
|
77
|
+
# @return behavior - true if the component is set to always face
|
78
|
+
# the camera, false if the component is not set to always
|
79
|
+
# face camera.
|
80
|
+
#
|
81
|
+
# @return [Boolean]
|
82
|
+
#
|
83
|
+
# @version SketchUp 6.0
|
84
|
+
def always_face_camera?
|
85
|
+
end
|
86
|
+
|
87
|
+
# The cuts_opening= method is used to set the cut opening behavior for a
|
88
|
+
# component.
|
89
|
+
#
|
90
|
+
# @example
|
91
|
+
# model = Sketchup.active_model
|
92
|
+
# behavior = model.definitions[0].behavior
|
93
|
+
# status = behavior.cuts_opening = false
|
94
|
+
# if (status)
|
95
|
+
# # if status is true, print the status
|
96
|
+
# UI.messagebox status
|
97
|
+
# else
|
98
|
+
# # code to respond cuts_opening being false
|
99
|
+
# end
|
100
|
+
#
|
101
|
+
# @param setting
|
102
|
+
# Sets the cuts_opening behavior to true or false.
|
103
|
+
#
|
104
|
+
# @return status - the status of the cuts_opening behavior
|
105
|
+
# (either true or false)
|
106
|
+
#
|
107
|
+
# @version SketchUp 6.0
|
108
|
+
def cuts_opening=(setting)
|
109
|
+
end
|
110
|
+
|
111
|
+
# The cuts_opening? method is used to get the status of a component's cut
|
112
|
+
# opening behavior.
|
113
|
+
#
|
114
|
+
# @example
|
115
|
+
# model = Sketchup.active_model
|
116
|
+
# behavior = model.definitions[0].behavior
|
117
|
+
# status = behavior.cuts_opening?
|
118
|
+
# if (status)
|
119
|
+
# # if status is true, do something
|
120
|
+
# else
|
121
|
+
# # if status is false, do something else
|
122
|
+
# end
|
123
|
+
#
|
124
|
+
# @return status - the status of the cuts_opening behavior
|
125
|
+
# (either true or false)
|
126
|
+
#
|
127
|
+
# @return [Boolean]
|
128
|
+
#
|
129
|
+
# @version SketchUp 6.0
|
130
|
+
def cuts_opening?
|
131
|
+
end
|
132
|
+
|
133
|
+
# The is2d= method is used to set the 2D behavior for a component: whether it
|
134
|
+
# can be glued or aligned to a face.
|
135
|
+
#
|
136
|
+
# @example
|
137
|
+
# model = Sketchup.active_model
|
138
|
+
# behavior = model.definitions[0].behavior
|
139
|
+
# status = behavior.is2d = false
|
140
|
+
# if (status)
|
141
|
+
# # if status is true, print the status
|
142
|
+
# UI.messagebox status
|
143
|
+
# else
|
144
|
+
# # code to respond is2d behavior being false
|
145
|
+
# end
|
146
|
+
#
|
147
|
+
# @param setting
|
148
|
+
# Sets the 2D behavior to true or false.
|
149
|
+
#
|
150
|
+
# @return status - the new setting
|
151
|
+
#
|
152
|
+
# @version SketchUp 6.0
|
153
|
+
def is2d=(setting)
|
154
|
+
end
|
155
|
+
|
156
|
+
# The is2d? method is used to get the 2D behavior for a component: whether it
|
157
|
+
# can be glued or aligned to a face.
|
158
|
+
#
|
159
|
+
# @example
|
160
|
+
# model = Sketchup.active_model
|
161
|
+
# behavior = model.definitions[0].behavior
|
162
|
+
# status = behavior.is2d?
|
163
|
+
# if (status)
|
164
|
+
# # if status is true, do something
|
165
|
+
# else
|
166
|
+
# # if status is false, do something else
|
167
|
+
# end
|
168
|
+
#
|
169
|
+
# @return status - the status of the 2D behavior (either true or
|
170
|
+
# false)
|
171
|
+
#
|
172
|
+
# @return [Boolean]
|
173
|
+
#
|
174
|
+
# @version SketchUp 6.0
|
175
|
+
def is2d?
|
176
|
+
end
|
177
|
+
|
178
|
+
# Sets an integer that is really a bit-by-bit description of which scale
|
179
|
+
# tool handles are hidden on a given component. This is useful for creating
|
180
|
+
# definitions that can only be scaled in particular ways. If a bit contains a
|
181
|
+
# a 1, then a certain handle set will be hidden when the user selects the
|
182
|
+
# component and activates the Scale tool. Here is the map of which bits
|
183
|
+
# control which handles.
|
184
|
+
#
|
185
|
+
# - Bit0: disable scale along red (X),
|
186
|
+
# - Bit1: disable scale along green (Y),
|
187
|
+
# - Bit2: disable scale along blue (Z),
|
188
|
+
# - Bit3: disable scale in red/blue plane (X+Z),
|
189
|
+
# - Bit4: disable scale in green/blue plane (Y+Z),
|
190
|
+
# - Bit5: disable scale in red/green plane (X+Y),
|
191
|
+
# - Bit6: disable scale uniform (from corners) (XYZ).
|
192
|
+
#
|
193
|
+
# Note that for 2-dimensional components (such as face-me components), not all
|
194
|
+
# of the handles in the list above are even used. Also, if the component you
|
195
|
+
# are modifying is already selected with the scale tool, then you or your user
|
196
|
+
# must deactivate and reactivate the scale tool for your new behavior to take
|
197
|
+
# effect.
|
198
|
+
#
|
199
|
+
# @example
|
200
|
+
# # Disable the green and red-axes handles by setting bits 1 and 2 to 1.
|
201
|
+
# definition = Sketchup.active_model.definitions[0]
|
202
|
+
# behavior = definition.behavior
|
203
|
+
# behavior.no_scale_mask = (1 << 1) + (1 << 2)
|
204
|
+
#
|
205
|
+
# @param scale_mask
|
206
|
+
# An integer describing which scale tool
|
207
|
+
# handles are hidden.
|
208
|
+
#
|
209
|
+
# @return behavior - the Behavior object
|
210
|
+
#
|
211
|
+
# @version SketchUp 7.0
|
212
|
+
def no_scale_mask=(scale_mask)
|
213
|
+
end
|
214
|
+
|
215
|
+
# The no_scale_mask? method returns an integer that is a bit-by-bit
|
216
|
+
# description of which scale tool handles are hidden when the user selects
|
217
|
+
# this single component with the scale tool. See the no_scale_mask=
|
218
|
+
# method for details on the bit encodings used.
|
219
|
+
#
|
220
|
+
# @example
|
221
|
+
# definition = Sketchup.active_model.definitions[0]
|
222
|
+
# behavior = definition.behavior
|
223
|
+
# no_scale_mask = behavior.no_scale_mask?
|
224
|
+
#
|
225
|
+
# @return scale_mask - an integer describing which scale tool
|
226
|
+
# handles are hidden.
|
227
|
+
#
|
228
|
+
# @return [Boolean]
|
229
|
+
#
|
230
|
+
# @version SketchUp 7.0
|
231
|
+
def no_scale_mask?
|
232
|
+
end
|
233
|
+
|
234
|
+
# The shadows_face_sun= method is used to identify whether the component's
|
235
|
+
# shadow will be cast from the component's current position as though the
|
236
|
+
# component were facing the sun. See the Component entity within the SketchUp
|
237
|
+
# User's guide for more information on this feature.
|
238
|
+
#
|
239
|
+
# @example
|
240
|
+
# model = Sketchup.active_model
|
241
|
+
# behavior = model.definitions[0].behavior
|
242
|
+
# behavior = behavior.shadows_face_sun = true
|
243
|
+
#
|
244
|
+
# @param status
|
245
|
+
# true if the component's is to be cast from the
|
246
|
+
# component's current position as though the component
|
247
|
+
# were facing the sun. False to cause the shadow to be
|
248
|
+
# cast from the component's current position.
|
249
|
+
#
|
250
|
+
# @return behavior - the Behavior object
|
251
|
+
#
|
252
|
+
# @version SketchUp 6.0
|
253
|
+
def shadows_face_sun=(status)
|
254
|
+
end
|
255
|
+
|
256
|
+
# The shadows_face_sun? method is used to determine whether the component's
|
257
|
+
# shadow is being cast from the component's current position (as though the
|
258
|
+
# component were facing the sun). See the Component entity within the SketchUp
|
259
|
+
# User's guide for more information on this feature.
|
260
|
+
#
|
261
|
+
# @example
|
262
|
+
# model = Sketchup.active_model
|
263
|
+
# # Returns a DefinitionList
|
264
|
+
# definitions = model.definitions
|
265
|
+
# path = Sketchup.find_support_file "Bed.skp",
|
266
|
+
# "Components/Components Sampler/"
|
267
|
+
# begin
|
268
|
+
# definition = definitions.load path
|
269
|
+
# rescue
|
270
|
+
# UI.messagebox $!.message
|
271
|
+
# end
|
272
|
+
#
|
273
|
+
# @return status - true if the component's is to be cast from the
|
274
|
+
# component's current position as though the component
|
275
|
+
# were facing the sun. False to cause the shadow to be
|
276
|
+
# cast from the component's current position.
|
277
|
+
#
|
278
|
+
# @return [Boolean]
|
279
|
+
#
|
280
|
+
# @version SketchUp 6.0
|
281
|
+
def shadows_face_sun?
|
282
|
+
end
|
283
|
+
|
284
|
+
# The snapto method is used to verify the status of a component's "snap to"
|
285
|
+
# behavior.
|
286
|
+
#
|
287
|
+
# Returns a constant indicating the snapping behavior of the component
|
288
|
+
# described by behavior. Snapping behavior is how the x-y plane of a component
|
289
|
+
# instance will be snapped against a face. Possible values are:
|
290
|
+
#
|
291
|
+
# - +SnapTo_Arbitrary+ => Snap to any aribrary face,
|
292
|
+
# - +SnapTo_Horizontal+ => Snap to horizontal face like floors,
|
293
|
+
# - +SnapTo_Vertical+ => Snap to vertical face like walls,
|
294
|
+
# - +SnapTo_Sloped+ => Snap to sloped face like sloping roofs.
|
295
|
+
#
|
296
|
+
# @example
|
297
|
+
# model = Sketchup.active_model
|
298
|
+
# behavior = model.definitions[0].behavior
|
299
|
+
# status = behavior.snapto
|
300
|
+
# if (status)
|
301
|
+
# # if status is true, do something
|
302
|
+
# else
|
303
|
+
# # if status is false, do something else
|
304
|
+
# end
|
305
|
+
#
|
306
|
+
# @return status - the status of the snapto behavior (either true
|
307
|
+
# or false)
|
308
|
+
#
|
309
|
+
# @version SketchUp 6.0
|
310
|
+
def snapto
|
311
|
+
end
|
312
|
+
|
313
|
+
# The snapto= method sets a component's "snap to" behavior.
|
314
|
+
#
|
315
|
+
# Snapping behavior is how the x-y plane of a component instance will be
|
316
|
+
# snapped against a face. Possible constant values are:
|
317
|
+
#
|
318
|
+
# - +SnapTo_Arbitrary+ => Snap to any aribrary face,
|
319
|
+
# - +SnapTo_Horizontal+ => Snap to horizontal face like floors,
|
320
|
+
# - +SnapTo_Vertical+ => Snap to vertical face like walls,
|
321
|
+
# - +SnapTo_Sloped+ => Snap to sloped face like sloping roofs.
|
322
|
+
#
|
323
|
+
# @example
|
324
|
+
# model = Sketchup.active_model
|
325
|
+
# behavior = model.definitions[0].behavior
|
326
|
+
# behavior.snapto = SnapTo_Horizontal
|
327
|
+
#
|
328
|
+
# @param snapto
|
329
|
+
# A numeric constant identifying one of the snapto
|
330
|
+
# types.
|
331
|
+
#
|
332
|
+
# @return behavior - the Behavior object
|
333
|
+
#
|
334
|
+
# @version SketchUp 6.0
|
335
|
+
def snapto=(snapto)
|
336
|
+
end
|
337
|
+
|
338
|
+
end
|
@@ -0,0 +1,594 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The Camera class contains methods for creating and manipulating a camera.
|
5
|
+
# The camera in SketchUp is the "point of view" from which you look at the
|
6
|
+
# model.
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# # Create a camera from scratch with an "eye" position in
|
10
|
+
# # x, y, z coordinates, a "target" position that
|
11
|
+
# # defines what to look at, and an "up" vector.
|
12
|
+
# eye = [1000,1000,1000]
|
13
|
+
# target = [0,0,0]
|
14
|
+
# up = [0,0,1]
|
15
|
+
# my_camera = Sketchup::Camera.new eye, target, up
|
16
|
+
#
|
17
|
+
# # Get a handle to the current view and change its camera.
|
18
|
+
# view = Sketchup.active_model.active_view
|
19
|
+
# view.camera = my_camera
|
20
|
+
#
|
21
|
+
# @version SketchUp 6.0
|
22
|
+
class Sketchup::Camera
|
23
|
+
|
24
|
+
# Instance Methods
|
25
|
+
|
26
|
+
# The aspect_ratio method is used to retrieve the aspect ratio of the Camera.
|
27
|
+
#
|
28
|
+
# @example
|
29
|
+
# camera = Sketchup::Camera.new
|
30
|
+
# ar = camera.aspect_ratio
|
31
|
+
# if (ar)
|
32
|
+
# UI.messagebox ar.to_s
|
33
|
+
# else
|
34
|
+
# UI.messagebox "Failure"
|
35
|
+
# end
|
36
|
+
#
|
37
|
+
# @return aspectratio - an aspect ratio, such as 1.85, if
|
38
|
+
# successful
|
39
|
+
#
|
40
|
+
# @version SketchUp 6.0
|
41
|
+
def aspect_ratio
|
42
|
+
end
|
43
|
+
|
44
|
+
# The aspect_ratio= method is used to set the aspect ratio for a Camera.
|
45
|
+
# Changing this value will cause SketchUp to show gray bars over the screen
|
46
|
+
# to show the resulting view.
|
47
|
+
#
|
48
|
+
# If you set the value to 0.0, then the aspect ratio of the Camera will match
|
49
|
+
# the aspect ratio of its View.
|
50
|
+
#
|
51
|
+
# @example
|
52
|
+
# camera = Sketchup::Camera.new
|
53
|
+
# ar = camera.aspect_ratio = 1.85
|
54
|
+
# if (ar)
|
55
|
+
# UI.messagebox ar.to_s
|
56
|
+
# else
|
57
|
+
# UI.messagebox "Failure"
|
58
|
+
# end
|
59
|
+
#
|
60
|
+
# @param [Float] ratio
|
61
|
+
#
|
62
|
+
# @return aspectratio - an aspect ratio, such as 1.85, if
|
63
|
+
# successful
|
64
|
+
#
|
65
|
+
# @version SketchUp 6.0
|
66
|
+
def aspect_ratio=(ratio)
|
67
|
+
end
|
68
|
+
|
69
|
+
# The center_2d method returns a point with the x and y offset of the camera
|
70
|
+
# when it's in 2d mode. When the camera is in two-point perspective and the
|
71
|
+
# user pans around, the x and y values will change. These values are in
|
72
|
+
# normalized device coordinates, so for instance, the range [-1.0, 1.0] spans
|
73
|
+
# the full width or height of the screen.
|
74
|
+
#
|
75
|
+
# The z value is unused and it is always zero.
|
76
|
+
#
|
77
|
+
# @example
|
78
|
+
# Sketchup.active_model.active_view.camera.center_2d
|
79
|
+
#
|
80
|
+
# @return Point3d
|
81
|
+
#
|
82
|
+
# @version SketchUp 2015
|
83
|
+
def center_2d
|
84
|
+
end
|
85
|
+
|
86
|
+
# The description method is used to retrieve the description for a Camera
|
87
|
+
# object.
|
88
|
+
#
|
89
|
+
# @example
|
90
|
+
# camera = Sketchup::Camera.new
|
91
|
+
# description = camera.description
|
92
|
+
# if (description)
|
93
|
+
# UI.messagebox description
|
94
|
+
# else
|
95
|
+
# UI.messagebox "Failure"
|
96
|
+
# end
|
97
|
+
#
|
98
|
+
# @return description - a string description for the camera if
|
99
|
+
# successful
|
100
|
+
#
|
101
|
+
# @version SketchUp 6.0
|
102
|
+
def description
|
103
|
+
end
|
104
|
+
|
105
|
+
# The description= method is used to set the description for the Camera.
|
106
|
+
#
|
107
|
+
# @example
|
108
|
+
# camera = Sketchup::Camera.new
|
109
|
+
# description = camera.description = "35 mm Camera"
|
110
|
+
#
|
111
|
+
# @param [String] description
|
112
|
+
#
|
113
|
+
# @return description - a string description for the camera if
|
114
|
+
# successful
|
115
|
+
#
|
116
|
+
# @version SketchUp 6.0
|
117
|
+
def description=(description)
|
118
|
+
end
|
119
|
+
|
120
|
+
# The direction method is used to retrieve a Vector3d object in the direction
|
121
|
+
# that the Camera is pointing.
|
122
|
+
#
|
123
|
+
# @example
|
124
|
+
# camera = Sketchup::Camera.new
|
125
|
+
# # Returns 0,0,-1 which indicates it is pointed down the Z axis
|
126
|
+
# direction = camera.direction
|
127
|
+
# if (direction)
|
128
|
+
# UI.messagebox direction.to_s
|
129
|
+
# else
|
130
|
+
# UI.messagebox "Failure"
|
131
|
+
# end
|
132
|
+
#
|
133
|
+
# @return direction - a Vector3d object pointing in the direction
|
134
|
+
# that the Camera is pointing if successful
|
135
|
+
#
|
136
|
+
# @version SketchUp 6.0
|
137
|
+
def direction
|
138
|
+
end
|
139
|
+
|
140
|
+
# The eye method is used to retrieve the eye Point3d object for the Camera.
|
141
|
+
#
|
142
|
+
# @example
|
143
|
+
# camera = Sketchup::Camera.new
|
144
|
+
# # Returns 0,0,1 which indicates it is right in line with the Z axis.
|
145
|
+
# eye = camera.eye
|
146
|
+
# if (eye)
|
147
|
+
# UI.messagebox eye
|
148
|
+
# else
|
149
|
+
# UI.messagebox "Failure"
|
150
|
+
# end
|
151
|
+
#
|
152
|
+
# @return eye - a Point3d object if successful
|
153
|
+
#
|
154
|
+
# @version SketchUp 6.0
|
155
|
+
def eye
|
156
|
+
end
|
157
|
+
|
158
|
+
# The focal_length method is used to get the focal length in millimeters of
|
159
|
+
# perspective Camera.
|
160
|
+
#
|
161
|
+
# This value is computed based on the field of view (see the fov method) and
|
162
|
+
# the image width (see image_width).
|
163
|
+
#
|
164
|
+
# @example
|
165
|
+
# camera = Sketchup::Camera.new
|
166
|
+
# l = camera.focal_length
|
167
|
+
# if (l)
|
168
|
+
# UI.messagebox l.to_s
|
169
|
+
# else
|
170
|
+
# UI.messagebox "Failure"
|
171
|
+
# end
|
172
|
+
#
|
173
|
+
# @param length
|
174
|
+
# The focal length for the camera if successful.
|
175
|
+
#
|
176
|
+
# @return nil
|
177
|
+
#
|
178
|
+
# @version SketchUp 6.0
|
179
|
+
def focal_length(length)
|
180
|
+
end
|
181
|
+
|
182
|
+
# The focal_length= method allows you to sent the focal length (in
|
183
|
+
# millimeters) of a perspective camera. It must be between 1 and 3000,
|
184
|
+
# inclusive. This is an alternate way of setting the field of view.
|
185
|
+
#
|
186
|
+
# @example
|
187
|
+
# camera = Sketchup::Camera.new
|
188
|
+
# l = camera.focal_length=120
|
189
|
+
# if (l)
|
190
|
+
# UI.messagebox l
|
191
|
+
# else
|
192
|
+
# UI.messagebox "Failure"
|
193
|
+
# end
|
194
|
+
#
|
195
|
+
# @param [Float] value
|
196
|
+
#
|
197
|
+
# @return length - the new focal length for the camera if
|
198
|
+
# successful
|
199
|
+
#
|
200
|
+
# @version SketchUp 6.0
|
201
|
+
def focal_length=(value)
|
202
|
+
end
|
203
|
+
|
204
|
+
# The fov method retrieves the field of view of the camera (in degrees).
|
205
|
+
#
|
206
|
+
# This is only applicable to perspective cameras.
|
207
|
+
#
|
208
|
+
# @example
|
209
|
+
# camera = Sketchup::Camera.new
|
210
|
+
# fov = camera.fov
|
211
|
+
# if (fov)
|
212
|
+
# UI.messagebox fov.to_s
|
213
|
+
# else
|
214
|
+
# UI.messagebox "Failure"
|
215
|
+
# end
|
216
|
+
#
|
217
|
+
# @return fov - field of view, in degrees, if successful
|
218
|
+
#
|
219
|
+
# @version SketchUp 6.0
|
220
|
+
def fov
|
221
|
+
end
|
222
|
+
|
223
|
+
# The fov= method sets the field of view, in millimeters, for a Camera. It
|
224
|
+
# must be between 1 and 120, inclusive.
|
225
|
+
#
|
226
|
+
# This is only valid on a perspective camera.
|
227
|
+
#
|
228
|
+
# @example
|
229
|
+
# camera = Sketchup::Camera.new
|
230
|
+
# fov = camera.fov = 56.78
|
231
|
+
# if (fov)
|
232
|
+
# UI.messagebox fov.to_s
|
233
|
+
# else
|
234
|
+
# UI.messagebox "Failure"
|
235
|
+
# end
|
236
|
+
#
|
237
|
+
# @param fov
|
238
|
+
# A field of view in millimeters.
|
239
|
+
#
|
240
|
+
# @return fov - the new field of view if successful
|
241
|
+
#
|
242
|
+
# @version SketchUp 6.0
|
243
|
+
def fov=(fov)
|
244
|
+
end
|
245
|
+
|
246
|
+
# The fov_is_height? method indicates whether the field of view is horizontal
|
247
|
+
# or vertical.
|
248
|
+
#
|
249
|
+
# @example
|
250
|
+
# camera = Sketchup.active_model.active_view.camera
|
251
|
+
# if camera.fov_is_height?
|
252
|
+
# fov_vertical = camera.fov
|
253
|
+
# # Compute the horizontal FOV.
|
254
|
+
# else
|
255
|
+
# fov_horizontal = camera.fov
|
256
|
+
# # Compute the vertical FOV.
|
257
|
+
# end
|
258
|
+
#
|
259
|
+
# @return bool - true if vertical, false otherwise
|
260
|
+
#
|
261
|
+
# @return [Boolean]
|
262
|
+
#
|
263
|
+
# @version SketchUp 2015
|
264
|
+
def fov_is_height?
|
265
|
+
end
|
266
|
+
|
267
|
+
# The height method retrieves the height of a Camera in inches.
|
268
|
+
#
|
269
|
+
# This is only valid if it is not a perspective camera.
|
270
|
+
#
|
271
|
+
# @example
|
272
|
+
# camera = Sketchup::Camera.new
|
273
|
+
# camera.perspective = false
|
274
|
+
# h = camera.height
|
275
|
+
# if (h)
|
276
|
+
# UI.messagebox h.to_s
|
277
|
+
# else
|
278
|
+
# UI.messagebox "Failure"
|
279
|
+
# end
|
280
|
+
#
|
281
|
+
# @return height - height in current units if successful
|
282
|
+
#
|
283
|
+
# @version SketchUp 6.0
|
284
|
+
def height
|
285
|
+
end
|
286
|
+
|
287
|
+
# The height= method is used to set the height for the Camera in inches.
|
288
|
+
#
|
289
|
+
# This is only valid if it is not a perspective camera.
|
290
|
+
#
|
291
|
+
# @example
|
292
|
+
# camera = Sketchup::Camera.new
|
293
|
+
# camera.perspective = false
|
294
|
+
# h = camera.height = 20
|
295
|
+
# if (h)
|
296
|
+
# UI.messagebox h.to_s
|
297
|
+
# else
|
298
|
+
# UI.messagebox "Failure"
|
299
|
+
# end
|
300
|
+
#
|
301
|
+
# @param [Float] value
|
302
|
+
#
|
303
|
+
# @return height - height in current units if successful
|
304
|
+
#
|
305
|
+
# @version SketchUp 6.0
|
306
|
+
def height=(value)
|
307
|
+
end
|
308
|
+
|
309
|
+
# The image_width method retrieves the size of the image on the image plane of
|
310
|
+
# the Camera.
|
311
|
+
#
|
312
|
+
# By default, this value is not set. If it is set, it is used in the
|
313
|
+
# calculation of the focal length from the field of view. Unlike most length
|
314
|
+
# values in SketchUp, the image_width and focal_length values are specified in
|
315
|
+
# millimeters rather than in inches.
|
316
|
+
#
|
317
|
+
# @example
|
318
|
+
# camera = Sketchup::Camera.new
|
319
|
+
# w = camera.image_width
|
320
|
+
# if (w)
|
321
|
+
# UI.messagebox w.to_s
|
322
|
+
# else
|
323
|
+
# UI.messagebox "Failure"
|
324
|
+
# end
|
325
|
+
#
|
326
|
+
# @return width - the width of the camera if successful
|
327
|
+
#
|
328
|
+
# @version SketchUp 6.0
|
329
|
+
def image_width
|
330
|
+
end
|
331
|
+
|
332
|
+
# The image_width= method is used to set the size of the image on the "film"
|
333
|
+
# for a perspective camera.
|
334
|
+
#
|
335
|
+
# The value is given in millimeters. It is used in the conversions between
|
336
|
+
# field of view and focal length.
|
337
|
+
#
|
338
|
+
# @example
|
339
|
+
# camera = Sketchup::Camera.new
|
340
|
+
# w = camera.image_width=1.0
|
341
|
+
# if (w)
|
342
|
+
# UI.messagebox w.to_s
|
343
|
+
# else
|
344
|
+
# UI.messagebox "Failure"
|
345
|
+
# end
|
346
|
+
#
|
347
|
+
# @param [Float] value
|
348
|
+
#
|
349
|
+
# @return width - the width of the camera if successful
|
350
|
+
#
|
351
|
+
# @version SketchUp 6.0
|
352
|
+
def image_width=(value)
|
353
|
+
end
|
354
|
+
|
355
|
+
# Returns a new camera with eye (where the camera is) and targets (where the
|
356
|
+
# camera is looking) of type Point3d, up direction of type Vector3d, optional
|
357
|
+
# perspective flag of value true or false, and optional field-of-view value in
|
358
|
+
# degrees of type Float.
|
359
|
+
#
|
360
|
+
# @example
|
361
|
+
# camera = Sketchup::Camera.new
|
362
|
+
# if (camera)
|
363
|
+
# UI.messagebox camera
|
364
|
+
# else
|
365
|
+
# UI.messagebox "Failure"
|
366
|
+
# end
|
367
|
+
#
|
368
|
+
# @param target
|
369
|
+
# See {#target}.
|
370
|
+
#
|
371
|
+
# @param eye
|
372
|
+
# See {#eye}.
|
373
|
+
#
|
374
|
+
# @param up
|
375
|
+
# See {#up}.
|
376
|
+
#
|
377
|
+
# @param fov
|
378
|
+
# see {#fov}.
|
379
|
+
#
|
380
|
+
# @param perspective
|
381
|
+
# see {#perspective?}.
|
382
|
+
#
|
383
|
+
# @return camera - a new Camera object if successful
|
384
|
+
#
|
385
|
+
# @version SketchUp 6.0
|
386
|
+
def initialize(eye, target, up, perspective = true, fov = 30.0)
|
387
|
+
end
|
388
|
+
|
389
|
+
# The is_2d? method indicates if the camera is in 2d mode. 2 point
|
390
|
+
# perspective mode and PhotoMatch mode are 2d cameras.
|
391
|
+
#
|
392
|
+
# @example
|
393
|
+
# Sketchup.active_model.active_view.camera.is_2d?
|
394
|
+
#
|
395
|
+
# @return Boolean - true if camera is in 2d mode, false otherwise
|
396
|
+
#
|
397
|
+
# @return [Boolean]
|
398
|
+
#
|
399
|
+
# @version SketchUp 2015
|
400
|
+
def is_2d?
|
401
|
+
end
|
402
|
+
|
403
|
+
# The perspective= method is used to set whether or not this is a perspective
|
404
|
+
# camera or an orthographic camera.
|
405
|
+
#
|
406
|
+
# @example
|
407
|
+
# camera = Sketchup::Camera.new
|
408
|
+
# status = camera.perspective = false
|
409
|
+
# if (status)
|
410
|
+
# UI.messagebox "Perspective"
|
411
|
+
# else
|
412
|
+
# UI.messagebox "Orthographic"
|
413
|
+
# end
|
414
|
+
#
|
415
|
+
# @param perspective
|
416
|
+
# true for perspective, false for orthographic
|
417
|
+
#
|
418
|
+
# @return status - true if perspective, false if orthographic
|
419
|
+
#
|
420
|
+
# @version SketchUp 6.0
|
421
|
+
def perspective=(perspective)
|
422
|
+
end
|
423
|
+
|
424
|
+
# The perspective? method is used to determine whether a camera is a
|
425
|
+
# perspective or orthographic camera.
|
426
|
+
#
|
427
|
+
# @example
|
428
|
+
# camera = Sketchup::Camera.new
|
429
|
+
# status = camera.perspective?
|
430
|
+
# if (status)
|
431
|
+
# UI.messagebox "Perspective"
|
432
|
+
# else
|
433
|
+
# UI.messagebox "Orthographic"
|
434
|
+
# end
|
435
|
+
#
|
436
|
+
# @return status - true if perspective, false if orthographic
|
437
|
+
#
|
438
|
+
# @return [Boolean]
|
439
|
+
#
|
440
|
+
# @version SketchUp 6.0
|
441
|
+
def perspective?
|
442
|
+
end
|
443
|
+
|
444
|
+
# The scale_2d method returns a float indicating the scaling factor of 2d
|
445
|
+
# cameras.
|
446
|
+
#
|
447
|
+
# When the camera is in two-point perspective and the user uses the zoom tools,
|
448
|
+
# this value will change. Zooming out will produce a value greater than 1.0.
|
449
|
+
#
|
450
|
+
# @example
|
451
|
+
# Sketchup.active_model.active_view.camera.scale_2d
|
452
|
+
#
|
453
|
+
# @return float
|
454
|
+
#
|
455
|
+
# @version SketchUp 2015
|
456
|
+
def scale_2d
|
457
|
+
end
|
458
|
+
|
459
|
+
# The set method sets the camera orientation. You have to set the camera eye,
|
460
|
+
# target and up parameters at the same time to make sure that you have a valid
|
461
|
+
# camera definition.
|
462
|
+
#
|
463
|
+
# @example
|
464
|
+
# camera = Sketchup::Camera.new
|
465
|
+
# eye = camera.eye
|
466
|
+
# target = camera.target
|
467
|
+
# up = camera.up
|
468
|
+
# # We just set it to exactly what it was pointing at in the first place
|
469
|
+
# camera.set eye, target, up
|
470
|
+
# if (camera)
|
471
|
+
# UI.messagebox camera.to_s
|
472
|
+
# else
|
473
|
+
# UI.messagebox "Failure"
|
474
|
+
# end
|
475
|
+
#
|
476
|
+
# @param eye
|
477
|
+
# See Camera.eye.
|
478
|
+
#
|
479
|
+
# @param target
|
480
|
+
# See Camera.target.
|
481
|
+
#
|
482
|
+
# @param up
|
483
|
+
# See Camera.up.
|
484
|
+
#
|
485
|
+
# @return camera - the modified camera
|
486
|
+
#
|
487
|
+
# @version SketchUp 6.0
|
488
|
+
def set(eye, target, up)
|
489
|
+
end
|
490
|
+
|
491
|
+
# The target method retrieves Point3d that the camera is pointing at.
|
492
|
+
#
|
493
|
+
# @example
|
494
|
+
# camera = Sketchup::Camera.new
|
495
|
+
# # Target point is 0,0,0
|
496
|
+
# t = camera.target
|
497
|
+
# if (t)
|
498
|
+
# UI.messagebox t.to_s
|
499
|
+
# else
|
500
|
+
# UI.messagebox "Failure".
|
501
|
+
# end
|
502
|
+
#
|
503
|
+
# @return target - a Point3d object if successful
|
504
|
+
#
|
505
|
+
# @version SketchUp 6.0
|
506
|
+
def target
|
507
|
+
end
|
508
|
+
|
509
|
+
# The up method is used to retrieve the up vector for the camera. This is the
|
510
|
+
# direction that the top of the camera is facing.
|
511
|
+
#
|
512
|
+
# @example
|
513
|
+
# camera = Sketchup::Camera.new
|
514
|
+
# # 0.0, 1.0, 0.0
|
515
|
+
# up = camera.up
|
516
|
+
# if (up)
|
517
|
+
# UI.messagebox up.to_s
|
518
|
+
# else
|
519
|
+
# UI.messagebox "Failure"
|
520
|
+
# end
|
521
|
+
#
|
522
|
+
# @return up - a Vector3d object if successful
|
523
|
+
#
|
524
|
+
# @version SketchUp 6.0
|
525
|
+
def up
|
526
|
+
end
|
527
|
+
|
528
|
+
# The xaxis method is used to retrieve the x axis of the camera coordinate
|
529
|
+
# system defined by the camera's direction and up vector.
|
530
|
+
#
|
531
|
+
# This value is computed from the cross product between the camera direction
|
532
|
+
# and the up vector.
|
533
|
+
#
|
534
|
+
# @example
|
535
|
+
# camera = Sketchup::Camera.new
|
536
|
+
# # 1.0, 0.0, 0.0
|
537
|
+
# v = camera.xaxis
|
538
|
+
# if (v)
|
539
|
+
# UI.messagebox v.to_s
|
540
|
+
# else
|
541
|
+
# UI.messagebox "Failure"
|
542
|
+
# end
|
543
|
+
#
|
544
|
+
# @return vector - a Vector3d object if successful
|
545
|
+
#
|
546
|
+
# @version SketchUp 6.0
|
547
|
+
def xaxis
|
548
|
+
end
|
549
|
+
|
550
|
+
# The yaxis method retrieves the y axis of the camera coordinate system
|
551
|
+
# defined by the camera's direction and up vector.
|
552
|
+
#
|
553
|
+
# This value is computed to be perpendicular the camera x and z axes. It is
|
554
|
+
# equivalent to the up direction, but is computed to make sure that it is
|
555
|
+
# perpendicular to the direction.
|
556
|
+
#
|
557
|
+
# @example
|
558
|
+
# camera = Sketchup::Camera.new
|
559
|
+
# # 0.0, 1.0, 0.0
|
560
|
+
# v = camera.yaxis
|
561
|
+
# if (v)
|
562
|
+
# UI.messagebox v.to_s
|
563
|
+
# else
|
564
|
+
# UI.messagebox "Failure"
|
565
|
+
# end
|
566
|
+
#
|
567
|
+
# @return vector - a Vector3d object if successful
|
568
|
+
#
|
569
|
+
# @version SketchUp 6.0
|
570
|
+
def yaxis
|
571
|
+
end
|
572
|
+
|
573
|
+
# The zaxis method retrieves the z axis of the camera coordinate system
|
574
|
+
# defined by the camera's direction and up vector.
|
575
|
+
#
|
576
|
+
# This value is computed. It is the same as Camera.direction
|
577
|
+
#
|
578
|
+
# @example
|
579
|
+
# camera = Sketchup::Camera.new
|
580
|
+
# # 0.0, 1.0, 0.0
|
581
|
+
# v = camera.zaxis
|
582
|
+
# if (v)
|
583
|
+
# UI.messagebox v.to_s
|
584
|
+
# else
|
585
|
+
# UI.messagebox "Failure"
|
586
|
+
# end
|
587
|
+
#
|
588
|
+
# @return vector - a Vector3d object if successful
|
589
|
+
#
|
590
|
+
# @version SketchUp 6.0
|
591
|
+
def zaxis
|
592
|
+
end
|
593
|
+
|
594
|
+
end
|