sketchup-api-stubs 0.6.1 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +2 -0
- data/lib/sketchup-api-stubs.rb +1 -1
- data/lib/sketchup-api-stubs/sketchup.rb +145 -145
- data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +318 -318
- data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +172 -172
- data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +126 -126
- data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
- data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +400 -401
- data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +661 -661
- data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +492 -492
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +478 -478
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +263 -263
- data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +141 -141
- data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +522 -523
- data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +691 -691
- data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +573 -569
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +411 -411
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +174 -186
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +514 -455
- data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
- data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +143 -155
- data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +353 -359
- data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +349 -349
- data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -123
- data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
- data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -86
- data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +371 -371
- data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +218 -218
- data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +128 -128
- data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +220 -232
- data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +567 -563
- data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +10 -10
- data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +11 -11
- data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +183 -183
- data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +387 -387
- data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +204 -216
- data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +344 -344
- data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +174 -174
- data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +694 -547
- data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1519 -1519
- data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
- data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
- data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
- data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +140 -140
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +157 -157
- data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +209 -209
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +152 -152
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +281 -281
- data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +328 -328
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +577 -577
- data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
- data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +122 -122
- data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +281 -281
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +562 -554
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +593 -593
- data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +257 -257
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
- data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +194 -194
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +329 -329
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +72 -72
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +102 -102
- data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +165 -165
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +312 -312
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +38 -38
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
- data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +390 -390
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +508 -508
- data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1119 -1097
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +125 -125
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +544 -537
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +59 -59
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +125 -125
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +750 -750
- data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +104 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +697 -697
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +285 -285
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +62 -62
- data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +409 -409
- data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +226 -226
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +190 -190
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +393 -393
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +82 -82
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +303 -303
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +285 -262
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +244 -231
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +136 -136
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +48 -48
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +112 -123
- data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +416 -416
- data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +311 -311
- data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +141 -141
- data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +95 -95
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1638 -1483
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +356 -356
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +132 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +284 -282
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +770 -650
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +76 -76
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +456 -456
- data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +364 -356
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +44 -44
- data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +454 -454
- data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
- data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +212 -212
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +257 -257
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +57 -57
- data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +69 -69
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +211 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +262 -262
- data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +225 -225
- data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +829 -829
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +154 -154
- data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +61 -61
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1301 -995
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +43 -43
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +310 -310
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +356 -356
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +229 -229
- data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +240 -240
- data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +633 -633
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +311 -303
- data/lib/sketchup-api-stubs/stubs/array.rb +741 -741
- data/lib/sketchup-api-stubs/stubs/geom.rb +348 -233
- data/lib/sketchup-api-stubs/stubs/languagehandler.rb +92 -92
- data/lib/sketchup-api-stubs/stubs/length.rb +278 -262
- data/lib/sketchup-api-stubs/stubs/numeric.rb +249 -249
- data/lib/sketchup-api-stubs/stubs/sketchup.rb +1310 -1310
- data/lib/sketchup-api-stubs/stubs/sketchupextension.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/string.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/ui.rb +667 -660
- metadata +2 -16
@@ -1,577 +1,577 @@
|
|
1
|
-
# Copyright:: Copyright
|
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 [Boolean] bool - true if vertical, false otherwise
|
260
|
-
#
|
261
|
-
# @version SketchUp 2015
|
262
|
-
def fov_is_height?
|
263
|
-
end
|
264
|
-
|
265
|
-
# The height method retrieves the height of a Camera in inches.
|
266
|
-
#
|
267
|
-
# This is only valid if it is not a perspective camera.
|
268
|
-
#
|
269
|
-
# @example
|
270
|
-
# camera = Sketchup::Camera.new
|
271
|
-
# camera.perspective = false
|
272
|
-
# h = camera.height
|
273
|
-
# if (h)
|
274
|
-
# UI.messagebox h.to_s
|
275
|
-
# else
|
276
|
-
# UI.messagebox "Failure"
|
277
|
-
# end
|
278
|
-
#
|
279
|
-
# @return height - height in current units if successful
|
280
|
-
#
|
281
|
-
# @version SketchUp 6.0
|
282
|
-
def height
|
283
|
-
end
|
284
|
-
|
285
|
-
# The height= method is used to set the height for the Camera in inches.
|
286
|
-
#
|
287
|
-
# This is only valid if it is not a perspective camera.
|
288
|
-
#
|
289
|
-
# @example
|
290
|
-
# camera = Sketchup::Camera.new
|
291
|
-
# camera.perspective = false
|
292
|
-
# h = camera.height = 20
|
293
|
-
# if (h)
|
294
|
-
# UI.messagebox h.to_s
|
295
|
-
# else
|
296
|
-
# UI.messagebox "Failure"
|
297
|
-
# end
|
298
|
-
#
|
299
|
-
# @param [Float] value
|
300
|
-
#
|
301
|
-
# @return height - height in current units if successful
|
302
|
-
#
|
303
|
-
# @version SketchUp 6.0
|
304
|
-
def height=(value)
|
305
|
-
end
|
306
|
-
|
307
|
-
# The image_width method retrieves the size of the image on the image plane of
|
308
|
-
# the Camera.
|
309
|
-
#
|
310
|
-
# By default, this value is not set. If it is set, it is used in the
|
311
|
-
# calculation of the focal length from the field of view. Unlike most length
|
312
|
-
# values in SketchUp, the image_width and focal_length values are specified in
|
313
|
-
# millimeters rather than in inches.
|
314
|
-
#
|
315
|
-
# @example
|
316
|
-
# camera = Sketchup::Camera.new
|
317
|
-
# w = camera.image_width
|
318
|
-
# if (w)
|
319
|
-
# UI.messagebox w.to_s
|
320
|
-
# else
|
321
|
-
# UI.messagebox "Failure"
|
322
|
-
# end
|
323
|
-
#
|
324
|
-
# @return width - the width of the camera if successful
|
325
|
-
#
|
326
|
-
# @version SketchUp 6.0
|
327
|
-
def image_width
|
328
|
-
end
|
329
|
-
|
330
|
-
# The image_width= method is used to set the size of the image on the "film"
|
331
|
-
# for a perspective camera.
|
332
|
-
#
|
333
|
-
# The value is given in millimeters. It is used in the conversions between
|
334
|
-
# field of view and focal length.
|
335
|
-
#
|
336
|
-
# @example
|
337
|
-
# camera = Sketchup::Camera.new
|
338
|
-
# w = camera.image_width=1.0
|
339
|
-
# if (w)
|
340
|
-
# UI.messagebox w.to_s
|
341
|
-
# else
|
342
|
-
# UI.messagebox "Failure"
|
343
|
-
# end
|
344
|
-
#
|
345
|
-
# @param [Float] value
|
346
|
-
#
|
347
|
-
# @return width - the width of the camera if successful
|
348
|
-
#
|
349
|
-
# @version SketchUp 6.0
|
350
|
-
def image_width=(value)
|
351
|
-
end
|
352
|
-
|
353
|
-
# Returns a new camera with eye (where the camera is) and targets (where the
|
354
|
-
# camera is looking).
|
355
|
-
#
|
356
|
-
# @example
|
357
|
-
# eye = Geom::Point3d.new(20, 5, 30)
|
358
|
-
# target = Geom::Point3d.new(20, 60, 25)
|
359
|
-
# up = Z_AXIS
|
360
|
-
# camera = Sketchup::Camera.new(eye, target, up)
|
361
|
-
#
|
362
|
-
# @example Default paramaters
|
363
|
-
# camera = Sketchup::Camera.new
|
364
|
-
#
|
365
|
-
# @overload initialize
|
366
|
-
#
|
367
|
-
# @return [Sketchup::Camera]
|
368
|
-
#
|
369
|
-
# @overload initialize(eye, target, up, perspective = true, fov = 30.0)
|
370
|
-
#
|
371
|
-
# @param [Geom::Point3d] eye See {#eye}.
|
372
|
-
# @param [Geom::Point3d] target See {#target}.
|
373
|
-
# @param [Geom::Point3d] up See {#up}.
|
374
|
-
# @param [Boolean] perspective see {#perspective?}.
|
375
|
-
# @param [Float] fov see {#fov}.
|
376
|
-
# @return [Sketchup::Camera]
|
377
|
-
#
|
378
|
-
# @version SketchUp 6.0
|
379
|
-
def initialize(*args)
|
380
|
-
end
|
381
|
-
|
382
|
-
# The is_2d? method indicates if the camera is in 2d mode. 2 point
|
383
|
-
# perspective mode and PhotoMatch mode are 2d cameras.
|
384
|
-
#
|
385
|
-
# @example
|
386
|
-
# Sketchup.active_model.active_view.camera.is_2d?
|
387
|
-
#
|
388
|
-
# @return [Boolean] Boolean - true if camera is in 2d mode, false otherwise
|
389
|
-
#
|
390
|
-
# @version SketchUp 2015
|
391
|
-
def is_2d?
|
392
|
-
end
|
393
|
-
|
394
|
-
# The perspective= method is used to set whether or not this is a perspective
|
395
|
-
# camera or an orthographic camera.
|
396
|
-
#
|
397
|
-
# @example
|
398
|
-
# camera = Sketchup::Camera.new
|
399
|
-
# status = camera.perspective = false
|
400
|
-
# if (status)
|
401
|
-
# UI.messagebox "Perspective"
|
402
|
-
# else
|
403
|
-
# UI.messagebox "Orthographic"
|
404
|
-
# end
|
405
|
-
#
|
406
|
-
# @param perspective
|
407
|
-
# true for perspective, false for orthographic
|
408
|
-
#
|
409
|
-
# @return status - true if perspective, false if orthographic
|
410
|
-
#
|
411
|
-
# @version SketchUp 6.0
|
412
|
-
def perspective=(perspective)
|
413
|
-
end
|
414
|
-
|
415
|
-
# The perspective? method is used to determine whether a camera is a
|
416
|
-
# perspective or orthographic camera.
|
417
|
-
#
|
418
|
-
# @example
|
419
|
-
# camera = Sketchup::Camera.new
|
420
|
-
# status = camera.perspective?
|
421
|
-
# if (status)
|
422
|
-
# UI.messagebox "Perspective"
|
423
|
-
# else
|
424
|
-
# UI.messagebox "Orthographic"
|
425
|
-
# end
|
426
|
-
#
|
427
|
-
# @return [Boolean] status - true if perspective, false if orthographic
|
428
|
-
#
|
429
|
-
# @version SketchUp 6.0
|
430
|
-
def perspective?
|
431
|
-
end
|
432
|
-
|
433
|
-
# The scale_2d method returns a float indicating the scaling factor of 2d
|
434
|
-
# cameras.
|
435
|
-
#
|
436
|
-
# When the camera is in two-point perspective and the user uses the zoom tools,
|
437
|
-
# this value will change. Zooming out will produce a value greater than 1.0.
|
438
|
-
#
|
439
|
-
# @example
|
440
|
-
# Sketchup.active_model.active_view.camera.scale_2d
|
441
|
-
#
|
442
|
-
# @return float
|
443
|
-
#
|
444
|
-
# @version SketchUp 2015
|
445
|
-
def scale_2d
|
446
|
-
end
|
447
|
-
|
448
|
-
# The {#set} method sets the camera orientation. You have to set the camera eye,
|
449
|
-
# target and up parameters at the same time to make sure that you have a valid
|
450
|
-
# camera definition.
|
451
|
-
#
|
452
|
-
# @example
|
453
|
-
# camera = Sketchup::Camera.new
|
454
|
-
# eye = Geom::Point3d.new(20, 5, 30)
|
455
|
-
# target = Geom::Point3d.new(20, 60, 25)
|
456
|
-
# up = Z_AXIS
|
457
|
-
# camera.set(eye, target, up)
|
458
|
-
#
|
459
|
-
# @param [Geom::Point3d] eye
|
460
|
-
# See {#eye}.
|
461
|
-
#
|
462
|
-
# @param [Geom::Point3d] target
|
463
|
-
# See {#target}.
|
464
|
-
#
|
465
|
-
# @param [Geom::Point3d] up
|
466
|
-
# See {#up}.
|
467
|
-
#
|
468
|
-
# @return [Sketchup::Camera]
|
469
|
-
#
|
470
|
-
# @version SketchUp 6.0
|
471
|
-
def set(eye, target, up)
|
472
|
-
end
|
473
|
-
|
474
|
-
# The target method retrieves Point3d that the camera is pointing at.
|
475
|
-
#
|
476
|
-
# @example
|
477
|
-
# camera = Sketchup::Camera.new
|
478
|
-
# # Target point is 0,0,0
|
479
|
-
# t = camera.target
|
480
|
-
# if (t)
|
481
|
-
# UI.messagebox t.to_s
|
482
|
-
# else
|
483
|
-
# UI.messagebox "Failure".
|
484
|
-
# end
|
485
|
-
#
|
486
|
-
# @return target - a Point3d object if successful
|
487
|
-
#
|
488
|
-
# @version SketchUp 6.0
|
489
|
-
def target
|
490
|
-
end
|
491
|
-
|
492
|
-
# The up method is used to retrieve the up vector for the camera. This is the
|
493
|
-
# direction that the top of the camera is facing.
|
494
|
-
#
|
495
|
-
# @example
|
496
|
-
# camera = Sketchup::Camera.new
|
497
|
-
# # 0.0, 1.0, 0.0
|
498
|
-
# up = camera.up
|
499
|
-
# if (up)
|
500
|
-
# UI.messagebox up.to_s
|
501
|
-
# else
|
502
|
-
# UI.messagebox "Failure"
|
503
|
-
# end
|
504
|
-
#
|
505
|
-
# @return up - a Vector3d object if successful
|
506
|
-
#
|
507
|
-
# @version SketchUp 6.0
|
508
|
-
def up
|
509
|
-
end
|
510
|
-
|
511
|
-
# The xaxis method is used to retrieve the x axis of the camera coordinate
|
512
|
-
# system defined by the camera's direction and up vector.
|
513
|
-
#
|
514
|
-
# This value is computed from the cross product between the camera direction
|
515
|
-
# and the up vector.
|
516
|
-
#
|
517
|
-
# @example
|
518
|
-
# camera = Sketchup::Camera.new
|
519
|
-
# # 1.0, 0.0, 0.0
|
520
|
-
# v = camera.xaxis
|
521
|
-
# if (v)
|
522
|
-
# UI.messagebox v.to_s
|
523
|
-
# else
|
524
|
-
# UI.messagebox "Failure"
|
525
|
-
# end
|
526
|
-
#
|
527
|
-
# @return vector - a Vector3d object if successful
|
528
|
-
#
|
529
|
-
# @version SketchUp 6.0
|
530
|
-
def xaxis
|
531
|
-
end
|
532
|
-
|
533
|
-
# The yaxis method retrieves the y axis of the camera coordinate system
|
534
|
-
# defined by the camera's direction and up vector.
|
535
|
-
#
|
536
|
-
# This value is computed to be perpendicular the camera x and z axes. It is
|
537
|
-
# equivalent to the up direction, but is computed to make sure that it is
|
538
|
-
# perpendicular to the direction.
|
539
|
-
#
|
540
|
-
# @example
|
541
|
-
# camera = Sketchup::Camera.new
|
542
|
-
# # 0.0, 1.0, 0.0
|
543
|
-
# v = camera.yaxis
|
544
|
-
# if (v)
|
545
|
-
# UI.messagebox v.to_s
|
546
|
-
# else
|
547
|
-
# UI.messagebox "Failure"
|
548
|
-
# end
|
549
|
-
#
|
550
|
-
# @return vector - a Vector3d object if successful
|
551
|
-
#
|
552
|
-
# @version SketchUp 6.0
|
553
|
-
def yaxis
|
554
|
-
end
|
555
|
-
|
556
|
-
# The zaxis method retrieves the z axis of the camera coordinate system
|
557
|
-
# defined by the camera's direction and up vector.
|
558
|
-
#
|
559
|
-
# This value is computed. It is the same as Camera.direction
|
560
|
-
#
|
561
|
-
# @example
|
562
|
-
# camera = Sketchup::Camera.new
|
563
|
-
# # 0.0, 1.0, 0.0
|
564
|
-
# v = camera.zaxis
|
565
|
-
# if (v)
|
566
|
-
# UI.messagebox v.to_s
|
567
|
-
# else
|
568
|
-
# UI.messagebox "Failure"
|
569
|
-
# end
|
570
|
-
#
|
571
|
-
# @return vector - a Vector3d object if successful
|
572
|
-
#
|
573
|
-
# @version SketchUp 6.0
|
574
|
-
def zaxis
|
575
|
-
end
|
576
|
-
|
577
|
-
end
|
1
|
+
# Copyright:: Copyright 2020 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 [Boolean] bool - true if vertical, false otherwise
|
260
|
+
#
|
261
|
+
# @version SketchUp 2015
|
262
|
+
def fov_is_height?
|
263
|
+
end
|
264
|
+
|
265
|
+
# The height method retrieves the height of a Camera in inches.
|
266
|
+
#
|
267
|
+
# This is only valid if it is not a perspective camera.
|
268
|
+
#
|
269
|
+
# @example
|
270
|
+
# camera = Sketchup::Camera.new
|
271
|
+
# camera.perspective = false
|
272
|
+
# h = camera.height
|
273
|
+
# if (h)
|
274
|
+
# UI.messagebox h.to_s
|
275
|
+
# else
|
276
|
+
# UI.messagebox "Failure"
|
277
|
+
# end
|
278
|
+
#
|
279
|
+
# @return height - height in current units if successful
|
280
|
+
#
|
281
|
+
# @version SketchUp 6.0
|
282
|
+
def height
|
283
|
+
end
|
284
|
+
|
285
|
+
# The height= method is used to set the height for the Camera in inches.
|
286
|
+
#
|
287
|
+
# This is only valid if it is not a perspective camera.
|
288
|
+
#
|
289
|
+
# @example
|
290
|
+
# camera = Sketchup::Camera.new
|
291
|
+
# camera.perspective = false
|
292
|
+
# h = camera.height = 20
|
293
|
+
# if (h)
|
294
|
+
# UI.messagebox h.to_s
|
295
|
+
# else
|
296
|
+
# UI.messagebox "Failure"
|
297
|
+
# end
|
298
|
+
#
|
299
|
+
# @param [Float] value
|
300
|
+
#
|
301
|
+
# @return height - height in current units if successful
|
302
|
+
#
|
303
|
+
# @version SketchUp 6.0
|
304
|
+
def height=(value)
|
305
|
+
end
|
306
|
+
|
307
|
+
# The image_width method retrieves the size of the image on the image plane of
|
308
|
+
# the Camera.
|
309
|
+
#
|
310
|
+
# By default, this value is not set. If it is set, it is used in the
|
311
|
+
# calculation of the focal length from the field of view. Unlike most length
|
312
|
+
# values in SketchUp, the image_width and focal_length values are specified in
|
313
|
+
# millimeters rather than in inches.
|
314
|
+
#
|
315
|
+
# @example
|
316
|
+
# camera = Sketchup::Camera.new
|
317
|
+
# w = camera.image_width
|
318
|
+
# if (w)
|
319
|
+
# UI.messagebox w.to_s
|
320
|
+
# else
|
321
|
+
# UI.messagebox "Failure"
|
322
|
+
# end
|
323
|
+
#
|
324
|
+
# @return width - the width of the camera if successful
|
325
|
+
#
|
326
|
+
# @version SketchUp 6.0
|
327
|
+
def image_width
|
328
|
+
end
|
329
|
+
|
330
|
+
# The image_width= method is used to set the size of the image on the "film"
|
331
|
+
# for a perspective camera.
|
332
|
+
#
|
333
|
+
# The value is given in millimeters. It is used in the conversions between
|
334
|
+
# field of view and focal length.
|
335
|
+
#
|
336
|
+
# @example
|
337
|
+
# camera = Sketchup::Camera.new
|
338
|
+
# w = camera.image_width=1.0
|
339
|
+
# if (w)
|
340
|
+
# UI.messagebox w.to_s
|
341
|
+
# else
|
342
|
+
# UI.messagebox "Failure"
|
343
|
+
# end
|
344
|
+
#
|
345
|
+
# @param [Float] value
|
346
|
+
#
|
347
|
+
# @return width - the width of the camera if successful
|
348
|
+
#
|
349
|
+
# @version SketchUp 6.0
|
350
|
+
def image_width=(value)
|
351
|
+
end
|
352
|
+
|
353
|
+
# Returns a new camera with eye (where the camera is) and targets (where the
|
354
|
+
# camera is looking).
|
355
|
+
#
|
356
|
+
# @example
|
357
|
+
# eye = Geom::Point3d.new(20, 5, 30)
|
358
|
+
# target = Geom::Point3d.new(20, 60, 25)
|
359
|
+
# up = Z_AXIS
|
360
|
+
# camera = Sketchup::Camera.new(eye, target, up)
|
361
|
+
#
|
362
|
+
# @example Default paramaters
|
363
|
+
# camera = Sketchup::Camera.new
|
364
|
+
#
|
365
|
+
# @overload initialize
|
366
|
+
#
|
367
|
+
# @return [Sketchup::Camera]
|
368
|
+
#
|
369
|
+
# @overload initialize(eye, target, up, perspective = true, fov = 30.0)
|
370
|
+
#
|
371
|
+
# @param [Geom::Point3d] eye See {#eye}.
|
372
|
+
# @param [Geom::Point3d] target See {#target}.
|
373
|
+
# @param [Geom::Point3d] up See {#up}.
|
374
|
+
# @param [Boolean] perspective see {#perspective?}.
|
375
|
+
# @param [Float] fov see {#fov}.
|
376
|
+
# @return [Sketchup::Camera]
|
377
|
+
#
|
378
|
+
# @version SketchUp 6.0
|
379
|
+
def initialize(*args)
|
380
|
+
end
|
381
|
+
|
382
|
+
# The is_2d? method indicates if the camera is in 2d mode. 2 point
|
383
|
+
# perspective mode and PhotoMatch mode are 2d cameras.
|
384
|
+
#
|
385
|
+
# @example
|
386
|
+
# Sketchup.active_model.active_view.camera.is_2d?
|
387
|
+
#
|
388
|
+
# @return [Boolean] Boolean - true if camera is in 2d mode, false otherwise
|
389
|
+
#
|
390
|
+
# @version SketchUp 2015
|
391
|
+
def is_2d?
|
392
|
+
end
|
393
|
+
|
394
|
+
# The perspective= method is used to set whether or not this is a perspective
|
395
|
+
# camera or an orthographic camera.
|
396
|
+
#
|
397
|
+
# @example
|
398
|
+
# camera = Sketchup::Camera.new
|
399
|
+
# status = camera.perspective = false
|
400
|
+
# if (status)
|
401
|
+
# UI.messagebox "Perspective"
|
402
|
+
# else
|
403
|
+
# UI.messagebox "Orthographic"
|
404
|
+
# end
|
405
|
+
#
|
406
|
+
# @param perspective
|
407
|
+
# true for perspective, false for orthographic
|
408
|
+
#
|
409
|
+
# @return status - true if perspective, false if orthographic
|
410
|
+
#
|
411
|
+
# @version SketchUp 6.0
|
412
|
+
def perspective=(perspective)
|
413
|
+
end
|
414
|
+
|
415
|
+
# The perspective? method is used to determine whether a camera is a
|
416
|
+
# perspective or orthographic camera.
|
417
|
+
#
|
418
|
+
# @example
|
419
|
+
# camera = Sketchup::Camera.new
|
420
|
+
# status = camera.perspective?
|
421
|
+
# if (status)
|
422
|
+
# UI.messagebox "Perspective"
|
423
|
+
# else
|
424
|
+
# UI.messagebox "Orthographic"
|
425
|
+
# end
|
426
|
+
#
|
427
|
+
# @return [Boolean] status - true if perspective, false if orthographic
|
428
|
+
#
|
429
|
+
# @version SketchUp 6.0
|
430
|
+
def perspective?
|
431
|
+
end
|
432
|
+
|
433
|
+
# The scale_2d method returns a float indicating the scaling factor of 2d
|
434
|
+
# cameras.
|
435
|
+
#
|
436
|
+
# When the camera is in two-point perspective and the user uses the zoom tools,
|
437
|
+
# this value will change. Zooming out will produce a value greater than 1.0.
|
438
|
+
#
|
439
|
+
# @example
|
440
|
+
# Sketchup.active_model.active_view.camera.scale_2d
|
441
|
+
#
|
442
|
+
# @return float
|
443
|
+
#
|
444
|
+
# @version SketchUp 2015
|
445
|
+
def scale_2d
|
446
|
+
end
|
447
|
+
|
448
|
+
# The {#set} method sets the camera orientation. You have to set the camera eye,
|
449
|
+
# target and up parameters at the same time to make sure that you have a valid
|
450
|
+
# camera definition.
|
451
|
+
#
|
452
|
+
# @example
|
453
|
+
# camera = Sketchup::Camera.new
|
454
|
+
# eye = Geom::Point3d.new(20, 5, 30)
|
455
|
+
# target = Geom::Point3d.new(20, 60, 25)
|
456
|
+
# up = Z_AXIS
|
457
|
+
# camera.set(eye, target, up)
|
458
|
+
#
|
459
|
+
# @param [Geom::Point3d] eye
|
460
|
+
# See {#eye}.
|
461
|
+
#
|
462
|
+
# @param [Geom::Point3d] target
|
463
|
+
# See {#target}.
|
464
|
+
#
|
465
|
+
# @param [Geom::Point3d] up
|
466
|
+
# See {#up}.
|
467
|
+
#
|
468
|
+
# @return [Sketchup::Camera]
|
469
|
+
#
|
470
|
+
# @version SketchUp 6.0
|
471
|
+
def set(eye, target, up)
|
472
|
+
end
|
473
|
+
|
474
|
+
# The target method retrieves Point3d that the camera is pointing at.
|
475
|
+
#
|
476
|
+
# @example
|
477
|
+
# camera = Sketchup::Camera.new
|
478
|
+
# # Target point is 0,0,0
|
479
|
+
# t = camera.target
|
480
|
+
# if (t)
|
481
|
+
# UI.messagebox t.to_s
|
482
|
+
# else
|
483
|
+
# UI.messagebox "Failure".
|
484
|
+
# end
|
485
|
+
#
|
486
|
+
# @return target - a Point3d object if successful
|
487
|
+
#
|
488
|
+
# @version SketchUp 6.0
|
489
|
+
def target
|
490
|
+
end
|
491
|
+
|
492
|
+
# The up method is used to retrieve the up vector for the camera. This is the
|
493
|
+
# direction that the top of the camera is facing.
|
494
|
+
#
|
495
|
+
# @example
|
496
|
+
# camera = Sketchup::Camera.new
|
497
|
+
# # 0.0, 1.0, 0.0
|
498
|
+
# up = camera.up
|
499
|
+
# if (up)
|
500
|
+
# UI.messagebox up.to_s
|
501
|
+
# else
|
502
|
+
# UI.messagebox "Failure"
|
503
|
+
# end
|
504
|
+
#
|
505
|
+
# @return up - a Vector3d object if successful
|
506
|
+
#
|
507
|
+
# @version SketchUp 6.0
|
508
|
+
def up
|
509
|
+
end
|
510
|
+
|
511
|
+
# The xaxis method is used to retrieve the x axis of the camera coordinate
|
512
|
+
# system defined by the camera's direction and up vector.
|
513
|
+
#
|
514
|
+
# This value is computed from the cross product between the camera direction
|
515
|
+
# and the up vector.
|
516
|
+
#
|
517
|
+
# @example
|
518
|
+
# camera = Sketchup::Camera.new
|
519
|
+
# # 1.0, 0.0, 0.0
|
520
|
+
# v = camera.xaxis
|
521
|
+
# if (v)
|
522
|
+
# UI.messagebox v.to_s
|
523
|
+
# else
|
524
|
+
# UI.messagebox "Failure"
|
525
|
+
# end
|
526
|
+
#
|
527
|
+
# @return vector - a Vector3d object if successful
|
528
|
+
#
|
529
|
+
# @version SketchUp 6.0
|
530
|
+
def xaxis
|
531
|
+
end
|
532
|
+
|
533
|
+
# The yaxis method retrieves the y axis of the camera coordinate system
|
534
|
+
# defined by the camera's direction and up vector.
|
535
|
+
#
|
536
|
+
# This value is computed to be perpendicular the camera x and z axes. It is
|
537
|
+
# equivalent to the up direction, but is computed to make sure that it is
|
538
|
+
# perpendicular to the direction.
|
539
|
+
#
|
540
|
+
# @example
|
541
|
+
# camera = Sketchup::Camera.new
|
542
|
+
# # 0.0, 1.0, 0.0
|
543
|
+
# v = camera.yaxis
|
544
|
+
# if (v)
|
545
|
+
# UI.messagebox v.to_s
|
546
|
+
# else
|
547
|
+
# UI.messagebox "Failure"
|
548
|
+
# end
|
549
|
+
#
|
550
|
+
# @return vector - a Vector3d object if successful
|
551
|
+
#
|
552
|
+
# @version SketchUp 6.0
|
553
|
+
def yaxis
|
554
|
+
end
|
555
|
+
|
556
|
+
# The zaxis method retrieves the z axis of the camera coordinate system
|
557
|
+
# defined by the camera's direction and up vector.
|
558
|
+
#
|
559
|
+
# This value is computed. It is the same as Camera.direction
|
560
|
+
#
|
561
|
+
# @example
|
562
|
+
# camera = Sketchup::Camera.new
|
563
|
+
# # 0.0, 1.0, 0.0
|
564
|
+
# v = camera.zaxis
|
565
|
+
# if (v)
|
566
|
+
# UI.messagebox v.to_s
|
567
|
+
# else
|
568
|
+
# UI.messagebox "Failure"
|
569
|
+
# end
|
570
|
+
#
|
571
|
+
# @return vector - a Vector3d object if successful
|
572
|
+
#
|
573
|
+
# @version SketchUp 6.0
|
574
|
+
def zaxis
|
575
|
+
end
|
576
|
+
|
577
|
+
end
|