sketchup-api-stubs 0.7.0 → 0.7.5

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.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sketchup-api-stubs/sketchup.rb +2 -0
  3. data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +14 -10
  4. data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +4 -4
  5. data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +4 -4
  6. data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +4 -5
  7. data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +17 -17
  8. data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +6 -0
  9. data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +1 -2
  10. data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +3 -3
  11. data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +4 -0
  12. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +6 -13
  13. data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +60 -4
  14. data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +6 -13
  15. data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +188 -0
  16. data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +8 -3
  17. data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +1 -2
  18. data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +6 -13
  19. data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +5 -1
  20. data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +6 -13
  21. data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +147 -4
  22. data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +4 -0
  23. data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +3 -3
  24. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +2 -2
  25. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +5 -0
  26. data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +31 -57
  27. data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +109 -208
  28. data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +23 -10
  29. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +22 -7
  30. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +23 -12
  31. data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +15 -8
  32. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +60 -27
  33. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +5 -3
  34. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +5 -3
  35. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +2 -8
  36. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +4 -0
  37. data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +9 -3
  38. data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +7 -13
  39. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +54 -25
  40. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +5 -3
  41. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +19 -14
  42. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +5 -4
  43. data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +8 -7
  44. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +8 -7
  45. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +46 -44
  46. data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +8 -0
  47. data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +46 -6
  48. data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +10 -11
  49. data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +32 -20
  50. data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +5 -3
  51. data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +4 -1
  52. data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +112 -69
  53. data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +422 -0
  54. data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +224 -28
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +117 -4
  56. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +1 -12
  57. data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +7 -9
  58. data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +14 -7
  59. data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +5 -4
  60. data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +8 -10
  61. data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +122 -72
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +4 -3
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +1 -2
  64. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +6 -6
  65. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +3 -3
  66. data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +142 -39
  67. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +21 -11
  68. data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +5 -4
  69. data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +36 -14
  70. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +4 -3
  71. data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +9 -4
  72. data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +19 -19
  73. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +4 -4
  74. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +5 -3
  75. data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -0
  76. data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +8 -2
  77. data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +13 -21
  78. data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +30 -24
  79. data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +1 -1
  80. data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +5 -3
  81. data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +31 -21
  82. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +72 -66
  83. data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +5 -3
  84. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +12 -5
  85. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +34 -3
  86. data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +36 -10
  87. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +2 -2
  88. data/lib/sketchup-api-stubs/stubs/_top_level.rb +2 -0
  89. data/lib/sketchup-api-stubs/stubs/geom.rb +3 -0
  90. data/lib/sketchup-api-stubs/stubs/sketchup.rb +54 -22
  91. data/lib/sketchup-api-stubs/stubs/ui.rb +9 -8
  92. metadata +4 -16
@@ -32,6 +32,10 @@
32
32
  #
33
33
  # Sketchup.active_model.active_view.animation = nil
34
34
  #
35
+ # @abstract Implement the methods described in this class to create a an
36
+ # animation. You can not sub-class this class because it is not defined by
37
+ # the API.
38
+ #
35
39
  # @version SketchUp 6.0
36
40
  class Sketchup::Animation
37
41
 
@@ -12,9 +12,9 @@
12
12
  # callbacks unless you've attached a {Sketchup::SelectionObserver} to the new
13
13
  # model as well. By watching for {#onNewModel}, you can be sure to do so.
14
14
  #
15
- # To implement this observer, create a Ruby class of this type, override the
16
- # desired methods, and add an instance of the observer to the
17
- # application class.
15
+ # @abstract To implement this observer, create a Ruby class of this type, override the
16
+ # desired methods, and add an instance of the observer to the
17
+ # application class.
18
18
  #
19
19
  # @example
20
20
  # # This is an example of an observer that watches the application for
@@ -103,9 +103,9 @@ class Sketchup::AttributeDictionaries < Sketchup::Entity
103
103
  #
104
104
  # @example
105
105
  # model = Sketchup.active_model
106
- # attrdicts = model.attribute_dictionaries
106
+ # dictionaries = model.attribute_dictionaries
107
107
  # # Iterates through all dictionaries and prints to screen.
108
- # attrdicts.each { | dict | UI.messagebox dict }
108
+ # dictionaries.each { |dictionary| puts dictionary.name }
109
109
  #
110
110
  # @return nil
111
111
  #
@@ -120,6 +120,11 @@ class Sketchup::AttributeDictionary < Sketchup::Entity
120
120
  # puts "#{key} = #{value}"
121
121
  # }
122
122
  #
123
+ # @note Don't remove content from this collection while iterating over it with
124
+ # {#each}. This would change the size of the collection and cause elements to
125
+ # be skipped as the indices change. Instead copy the current collection to an
126
+ # array using +to_a+ and then use +each+ on the array, when removing content.
127
+ #
123
128
  # @see #each_pair
124
129
  #
125
130
  # @version SketchUp 6.0
@@ -88,13 +88,9 @@ class Sketchup::Behavior < Sketchup::Entity
88
88
  # @example
89
89
  # model = Sketchup.active_model
90
90
  # behavior = model.definitions[0].behavior
91
- # status = behavior.cuts_opening = false
92
- # if (status)
93
- # # if status is true, print the status
94
- # UI.messagebox status
95
- # else
96
- # # code to respond cuts_opening being false
97
- # end
91
+ # behavior.cuts_opening = false
92
+ #
93
+ # @note To enable cut opening, also set {#is2d=} to true.
98
94
  #
99
95
  # @param setting
100
96
  # Sets the cuts_opening behavior to true or false.
@@ -113,57 +109,39 @@ class Sketchup::Behavior < Sketchup::Entity
113
109
  # model = Sketchup.active_model
114
110
  # behavior = model.definitions[0].behavior
115
111
  # status = behavior.cuts_opening?
116
- # if (status)
117
- # # if status is true, do something
118
- # else
119
- # # if status is false, do something else
120
- # end
121
112
  #
122
- # @return [Boolean] status - the status of the cuts_opening behavior
123
- # (either true or false)
113
+ # @return [Boolean]
124
114
  #
125
115
  # @version SketchUp 6.0
126
116
  def cuts_opening?
127
117
  end
128
118
 
129
- # The is2d= method is used to set the 2D behavior for a component: whether it
130
- # can be glued or aligned to a face.
119
+ # The {#is2d=} method is used to set whether the component can glue to other
120
+ # entities or not.
131
121
  #
132
122
  # @example
133
123
  # model = Sketchup.active_model
134
124
  # behavior = model.definitions[0].behavior
135
- # status = behavior.is2d = false
136
- # if (status)
137
- # # if status is true, print the status
138
- # UI.messagebox status
139
- # else
140
- # # code to respond is2d behavior being false
141
- # end
125
+ # behavior.is2d = false
142
126
  #
143
- # @param setting
144
- # Sets the 2D behavior to true or false.
145
- #
146
- # @return status - the new setting
127
+ # @param [Boolean] is2d
147
128
  #
148
129
  # @version SketchUp 6.0
149
- def is2d=(setting)
130
+ def is2d=(is2d)
150
131
  end
151
132
 
152
- # The is2d? method is used to get the 2D behavior for a component: whether it
153
- # can be glued or aligned to a face.
133
+ # The {#is2d?} method is used to get whether the component can glue to other
134
+ # entities or not.
154
135
  #
155
136
  # @example
156
137
  # model = Sketchup.active_model
157
138
  # behavior = model.definitions[0].behavior
158
- # status = behavior.is2d?
159
- # if (status)
160
- # # if status is true, do something
161
- # else
162
- # # if status is false, do something else
139
+ # if behavior.is2d?
140
+ # # We can also set what planes component can glue to.
141
+ # behavior.snapto = SnapTo_Arbitrary
163
142
  # end
164
143
  #
165
- # @return [Boolean] status - the status of the 2D behavior (either true or
166
- # false)
144
+ # @return [Boolean]
167
145
  #
168
146
  # @version SketchUp 6.0
169
147
  def is2d?
@@ -271,14 +249,14 @@ class Sketchup::Behavior < Sketchup::Entity
271
249
  def shadows_face_sun?
272
250
  end
273
251
 
274
- # The snapto method is used to verify the status of a component's "snap to"
275
- # behavior.
252
+ # The {#snapto} method is used to see how a component can glue to other
253
+ # entities.
276
254
  #
277
- # Returns a constant indicating the snapping behavior of the component
278
- # described by behavior. Snapping behavior is how the x-y plane of a component
279
- # instance will be snapped against a face. Possible values are:
255
+ # Returns a value indicating the snapping behavior of the component. Snapping
256
+ # behavior is how the x-y plane of a component instance will be snapped against
257
+ # a face. Possible values are:
280
258
  #
281
- # - +SnapTo_Arbitrary+ => Snap to any aribrary face,
259
+ # - +SnapTo_Arbitrary+ => Snap to any arbitrary face,
282
260
  # - +SnapTo_Horizontal+ => Snap to horizontal face like floors,
283
261
  # - +SnapTo_Vertical+ => Snap to vertical face like walls,
284
262
  # - +SnapTo_Sloped+ => Snap to sloped face like sloping roofs.
@@ -286,26 +264,21 @@ class Sketchup::Behavior < Sketchup::Entity
286
264
  # @example
287
265
  # model = Sketchup.active_model
288
266
  # behavior = model.definitions[0].behavior
289
- # status = behavior.snapto
290
- # if (status)
291
- # # if status is true, do something
292
- # else
293
- # # if status is false, do something else
294
- # end
267
+ # snapto = behavior.snapto
295
268
  #
296
- # @return status - the status of the snapto behavior (either true
297
- # or false)
269
+ # @return [Integer]
298
270
  #
299
271
  # @version SketchUp 6.0
300
272
  def snapto
301
273
  end
302
274
 
303
- # The snapto= method sets a component's "snap to" behavior.
275
+ # The {#snapto=} method is used to set how a component can glue to other
276
+ # entities.
304
277
  #
305
278
  # Snapping behavior is how the x-y plane of a component instance will be
306
279
  # snapped against a face. Possible constant values are:
307
280
  #
308
- # - +SnapTo_Arbitrary+ => Snap to any aribrary face,
281
+ # - +SnapTo_Arbitrary+ => Snap to any arbitrary face,
309
282
  # - +SnapTo_Horizontal+ => Snap to horizontal face like floors,
310
283
  # - +SnapTo_Vertical+ => Snap to vertical face like walls,
311
284
  # - +SnapTo_Sloped+ => Snap to sloped face like sloping roofs.
@@ -313,13 +286,14 @@ class Sketchup::Behavior < Sketchup::Entity
313
286
  # @example
314
287
  # model = Sketchup.active_model
315
288
  # behavior = model.definitions[0].behavior
289
+ # behavior.is2d = true
316
290
  # behavior.snapto = SnapTo_Horizontal
317
291
  #
318
- # @param snapto
319
- # A numeric constant identifying one of the snapto
320
- # types.
292
+ # @note To enable gluing, also set {#is2d=} to true.
321
293
  #
322
- # @return behavior - the Behavior object
294
+ # @note To disable gluing, set {#is2d=} to false.
295
+ #
296
+ # @param [Integer] snapto
323
297
  #
324
298
  # @version SketchUp 6.0
325
299
  def snapto=(snapto)
@@ -23,86 +23,68 @@ class Sketchup::Camera
23
23
 
24
24
  # Instance Methods
25
25
 
26
- # The aspect_ratio method is used to retrieve the aspect ratio of the Camera.
26
+ # The {#aspect_ratio} method is used to retrieve the aspect ratio of the Camera.
27
+ #
28
+ # `0.0` is the default value and denotes an aspect ratio matching that of the
29
+ # View.
27
30
  #
28
31
  # @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
32
+ # camera = Sketchup.active_model.active_view.camera
33
+ # aspect_ratio = camera.aspect_ratio
36
34
  #
37
- # @return aspectratio - an aspect ratio, such as 1.85, if
38
- # successful
35
+ # @return [Float]
39
36
  #
40
37
  # @version SketchUp 6.0
41
38
  def aspect_ratio
42
39
  end
43
40
 
44
- # The aspect_ratio= method is used to set the aspect ratio for a Camera.
41
+ # The {#aspect_ratio=} method is used to set the aspect ratio for a Camera.
45
42
  # Changing this value will cause SketchUp to show gray bars over the screen
46
43
  # to show the resulting view.
47
44
  #
48
- # If you set the value to 0.0, then the aspect ratio of the Camera will match
45
+ # If you set the value to `0.0`, then the aspect ratio of the Camera will match
49
46
  # the aspect ratio of its View.
50
47
  #
51
48
  # @example
52
49
  # 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
50
+ # camera.aspect_ratio = 1.85
59
51
  #
60
52
  # @param [Float] ratio
61
53
  #
62
- # @return aspectratio - an aspect ratio, such as 1.85, if
63
- # successful
64
- #
65
54
  # @version SketchUp 6.0
66
55
  def aspect_ratio=(ratio)
67
56
  end
68
57
 
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.
58
+ # The {#center_2d} method returns a point with the x and y offset of the camera
59
+ # when it's in two-point perspective or math photo mode. When the camera is
60
+ # in two-point perspective and the user pans around, the x and y values will
61
+ # change. These values are in normalized device coordinates, so for instance,
62
+ # the range [-1.0, 1.0] spans the full width or height of the screen.
74
63
  #
75
64
  # The z value is unused and it is always zero.
76
65
  #
77
66
  # @example
78
67
  # Sketchup.active_model.active_view.camera.center_2d
79
68
  #
80
- # @return Point3d
69
+ # @return [Geom::Point3d] ]
81
70
  #
82
71
  # @version SketchUp 2015
83
72
  def center_2d
84
73
  end
85
74
 
86
- # The description method is used to retrieve the description for a Camera
87
- # object.
75
+ # The {#description} method is used to retrieve the description for a Camera.
88
76
  #
89
77
  # @example
90
78
  # camera = Sketchup::Camera.new
91
79
  # description = camera.description
92
- # if (description)
93
- # UI.messagebox description
94
- # else
95
- # UI.messagebox "Failure"
96
- # end
97
80
  #
98
- # @return description - a string description for the camera if
99
- # successful
81
+ # @return [String]
100
82
  #
101
83
  # @version SketchUp 6.0
102
84
  def description
103
85
  end
104
86
 
105
- # The description= method is used to set the description for the Camera.
87
+ # The {#description=} method is used to set the description for the Camera.
106
88
  #
107
89
  # @example
108
90
  # camera = Sketchup::Camera.new
@@ -110,46 +92,30 @@ class Sketchup::Camera
110
92
  #
111
93
  # @param [String] description
112
94
  #
113
- # @return description - a string description for the camera if
114
- # successful
115
- #
116
95
  # @version SketchUp 6.0
117
96
  def description=(description)
118
97
  end
119
98
 
120
- # The direction method is used to retrieve a Vector3d object in the direction
121
- # that the Camera is pointing.
99
+ # The {#direction} method is used to retrieve a Vector3d object in the
100
+ # direction that the Camera is pointing.
122
101
  #
123
102
  # @example
124
103
  # camera = Sketchup::Camera.new
125
- # # Returns 0,0,-1 which indicates it is pointed down the Z axis
126
104
  # direction = camera.direction
127
- # if (direction)
128
- # UI.messagebox direction.to_s
129
- # else
130
- # UI.messagebox "Failure"
131
- # end
132
105
  #
133
- # @return direction - a Vector3d object pointing in the direction
134
- # that the Camera is pointing if successful
106
+ # @return [Geom::Vector3d]
135
107
  #
136
108
  # @version SketchUp 6.0
137
109
  def direction
138
110
  end
139
111
 
140
- # The eye method is used to retrieve the eye Point3d object for the Camera.
112
+ # The {#eye} method is used to retrieve the eye Point3d object for the Camera.
141
113
  #
142
114
  # @example
143
115
  # camera = Sketchup::Camera.new
144
- # # Returns 0,0,1 which indicates it is right in line with the Z axis.
145
116
  # eye = camera.eye
146
- # if (eye)
147
- # UI.messagebox eye
148
- # else
149
- # UI.messagebox "Failure"
150
- # end
151
117
  #
152
- # @return eye - a Point3d object if successful
118
+ # @return [Geom::Point3d]
153
119
  #
154
120
  # @version SketchUp 6.0
155
121
  def eye
@@ -158,93 +124,82 @@ class Sketchup::Camera
158
124
  # The focal_length method is used to get the focal length in millimeters of
159
125
  # perspective Camera.
160
126
  #
161
- # This value is computed based on the field of view (see the fov method) and
162
- # the image width (see image_width).
127
+ # This value is computed on the fly based on the camera {#fov} value and
128
+ # the camera {#image_width} value.
163
129
  #
164
130
  # @example
131
+ # # Calculate focal length based on camera's current #image_width.
165
132
  # 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
133
+ # focal_length = camera.focal_length
172
134
  #
173
- # @param length
174
- # The focal length for the camera if successful.
135
+ # # If you want the 35 mm focal length equivalent, a common measurement of
136
+ # # camera field of view, you can instead calculate it from the #fov angle.
137
+ # camera = Sketchup.active_model.active_view.camera
138
+ # focal_length_35_eqv = 36.0 / (2 * Math.tan(camera.fov.degrees / 2))
175
139
  #
176
- # @return nil
140
+ # @return [Float]
177
141
  #
178
142
  # @version SketchUp 6.0
179
143
  def focal_length(length)
180
144
  end
181
145
 
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.
146
+ # The {#focal_length=} method allows you to set the field of view by specifying
147
+ # a focal length in millimeters. Focal length must be between 1 and 3000,
148
+ # inclusive.
149
+ #
150
+ # The camera {#fov} value is set based on the provided +focal_length+ and
151
+ # the current {#image_width} for the camera.
185
152
  #
186
153
  # @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
154
+ # # Set field of view from focal length using camera's current #image_width.
155
+ # camera = Sketchup.active_model.active_view.camera
156
+ # camera.focal_length = 120
194
157
  #
195
- # @param [Float] value
158
+ # # If you instead want to set the 35 mm focal length equivalent, a common
159
+ # # measurement of camera field of view, you can first convert it to an angle
160
+ # # and use #fov=.
161
+ # camera = Sketchup.active_model.active_view.camera
162
+ # focal_length_35_eqv = 120
163
+ # camera.fov = 2 * Math.atan(36.0 / (2 * focal_length_35_eqv)).radians
196
164
  #
197
- # @return length - the new focal length for the camera if
198
- # successful
165
+ # @param [Float] focal_length
199
166
  #
200
167
  # @version SketchUp 6.0
201
- def focal_length=(value)
168
+ def focal_length=(focal_length)
202
169
  end
203
170
 
204
- # The fov method retrieves the field of view of the camera (in degrees).
171
+ # The {#fov} method retrieves the field of view of the Camera.
205
172
  #
206
173
  # This is only applicable to perspective cameras.
207
174
  #
208
175
  # @example
209
176
  # camera = Sketchup::Camera.new
210
177
  # fov = camera.fov
211
- # if (fov)
212
- # UI.messagebox fov.to_s
213
- # else
214
- # UI.messagebox "Failure"
215
- # end
216
178
  #
217
- # @return fov - field of view, in degrees, if successful
179
+ # @return [Float] Field of view in degrees
218
180
  #
219
181
  # @version SketchUp 6.0
220
182
  def fov
221
183
  end
222
184
 
223
- # The fov= method sets the field of view, in millimeters, for a Camera. It
224
- # must be between 1 and 120, inclusive.
185
+ # The {#fov=} method sets the field of view for a Camera. Field of view
186
+ # must be between 1 and 120 degrees, inclusive.
225
187
  #
226
188
  # This is only valid on a perspective camera.
227
189
  #
228
190
  # @example
229
191
  # camera = Sketchup::Camera.new
230
192
  # fov = camera.fov = 56.78
231
- # if (fov)
232
- # UI.messagebox fov.to_s
233
- # else
234
- # UI.messagebox "Failure"
235
- # end
236
193
  #
237
- # @param fov
238
- # A field of view in millimeters.
239
- #
240
- # @return fov - the new field of view if successful
194
+ # @param [Numeric] fov
195
+ # Field of view in degrees
241
196
  #
242
197
  # @version SketchUp 6.0
243
198
  def fov=(fov)
244
199
  end
245
200
 
246
- # The fov_is_height? method indicates whether the field of view is horizontal
247
- # or vertical.
201
+ # The {#fov_is_height?} method indicates whether the field of view is
202
+ # measured vertically, as opposed horizontally.
248
203
  #
249
204
  # @example
250
205
  # camera = Sketchup.active_model.active_view.camera
@@ -256,98 +211,76 @@ class Sketchup::Camera
256
211
  # # Compute the vertical FOV.
257
212
  # end
258
213
  #
259
- # @return [Boolean] bool - true if vertical, false otherwise
214
+ # @return [Boolean]
260
215
  #
261
216
  # @version SketchUp 2015
262
217
  def fov_is_height?
263
218
  end
264
219
 
265
- # The height method retrieves the height of a Camera in inches.
220
+ # The {#height} method retrieves the height of a Camera.
266
221
  #
267
222
  # This is only valid if it is not a perspective camera.
268
223
  #
269
224
  # @example
270
225
  # camera = Sketchup::Camera.new
271
226
  # camera.perspective = false
272
- # h = camera.height
273
- # if (h)
274
- # UI.messagebox h.to_s
275
- # else
276
- # UI.messagebox "Failure"
277
- # end
227
+ # height = camera.height
278
228
  #
279
- # @return height - height in current units if successful
229
+ # @return [Float] height in inches.
280
230
  #
281
231
  # @version SketchUp 6.0
282
232
  def height
283
233
  end
284
234
 
285
- # The height= method is used to set the height for the Camera in inches.
235
+ # The {#height=} method is used to set the height for the Camera in inches.
286
236
  #
287
237
  # This is only valid if it is not a perspective camera.
288
238
  #
289
239
  # @example
290
240
  # camera = Sketchup::Camera.new
291
241
  # 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
242
+ # camera.height = 20
298
243
  #
299
244
  # @param [Float] value
300
245
  #
301
- # @return height - height in current units if successful
302
- #
303
246
  # @version SketchUp 6.0
304
247
  def height=(value)
305
248
  end
306
249
 
307
- # The image_width method retrieves the size of the image on the image plane of
308
- # the Camera.
250
+ # The {#image_width} method returns the width of the image, as used to
251
+ # calculate the {#focal_length}. This value has no effect on how the view
252
+ # is displayed in SketchUp.
309
253
  #
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.
254
+ # The default value, 0, is interpreted by SketchUp as 36 mm (the width of
255
+ # traditional 35 mm film).
314
256
  #
315
257
  # @example
316
258
  # 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
259
+ # width = camera.image_width
323
260
  #
324
- # @return width - the width of the camera if successful
261
+ # @return [Float] Width in mm.
325
262
  #
326
263
  # @version SketchUp 6.0
327
264
  def image_width
328
265
  end
329
266
 
330
- # The image_width= method is used to set the size of the image on the "film"
331
- # for a perspective camera.
267
+ # The {#image_width=} method is used to set the width of the image, as used to
268
+ # calculate the {#focal_length}. This value has no effect on how the view
269
+ # is displayed in SketchUp.
332
270
  #
333
- # The value is given in millimeters. It is used in the conversions between
334
- # field of view and focal length.
271
+ # The default value, 0, is interpreted by SketchUp as 36 mm (the width of
272
+ # traditional 35 mm film).
335
273
  #
336
274
  # @example
337
275
  # 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
276
+ # camera.image_width = 1.0
277
+ # focal_length = camera.focal_length
344
278
  #
345
- # @param [Float] value
346
- #
347
- # @return width - the width of the camera if successful
279
+ # @param [Float] image_width
280
+ # Width in mm.
348
281
  #
349
282
  # @version SketchUp 6.0
350
- def image_width=(value)
283
+ def image_width=(image_width)
351
284
  end
352
285
 
353
286
  # Returns a new camera with eye (where the camera is) and targets (where the
@@ -359,7 +292,7 @@ class Sketchup::Camera
359
292
  # up = Z_AXIS
360
293
  # camera = Sketchup::Camera.new(eye, target, up)
361
294
  #
362
- # @example Default paramaters
295
+ # @example Arbitrary camera
363
296
  # camera = Sketchup::Camera.new
364
297
  #
365
298
  # @overload initialize
@@ -379,59 +312,52 @@ class Sketchup::Camera
379
312
  def initialize(*args)
380
313
  end
381
314
 
382
- # The is_2d? method indicates if the camera is in 2d mode. 2 point
383
- # perspective mode and PhotoMatch mode are 2d cameras.
315
+ # The {#is_2d?} method indicates if the camera two-point perspective or match photo
316
+ # mode.
384
317
  #
385
318
  # @example
386
319
  # Sketchup.active_model.active_view.camera.is_2d?
387
320
  #
388
- # @return [Boolean] Boolean - true if camera is in 2d mode, false otherwise
321
+ # @return [Boolean]
389
322
  #
390
323
  # @version SketchUp 2015
391
324
  def is_2d?
392
325
  end
393
326
 
394
- # The perspective= method is used to set whether or not this is a perspective
395
- # camera or an orthographic camera.
327
+ # The {#perspective=} method is used to set whether or not this is a
328
+ # perspective camera or an orthographic camera.
396
329
  #
397
330
  # @example
398
331
  # camera = Sketchup::Camera.new
399
- # status = camera.perspective = false
400
- # if (status)
401
- # UI.messagebox "Perspective"
402
- # else
403
- # UI.messagebox "Orthographic"
404
- # end
332
+ # camera.perspective = false
405
333
  #
406
- # @param perspective
407
- # true for perspective, false for orthographic
334
+ # @param [Boolean] perspective
408
335
  #
409
- # @return status - true if perspective, false if orthographic
410
336
  #
411
337
  # @version SketchUp 6.0
412
338
  def perspective=(perspective)
413
339
  end
414
340
 
415
- # The perspective? method is used to determine whether a camera is a
341
+ # The {#perspective?} method is used to determine whether a camera is a
416
342
  # perspective or orthographic camera.
417
343
  #
418
344
  # @example
419
345
  # camera = Sketchup::Camera.new
420
346
  # status = camera.perspective?
421
347
  # if (status)
422
- # UI.messagebox "Perspective"
348
+ # puts "Perspective"
423
349
  # else
424
- # UI.messagebox "Orthographic"
350
+ # puts "Orthographic"
425
351
  # end
426
352
  #
427
- # @return [Boolean] status - true if perspective, false if orthographic
353
+ # @return [Boolean]
428
354
  #
429
355
  # @version SketchUp 6.0
430
356
  def perspective?
431
357
  end
432
358
 
433
- # The scale_2d method returns a float indicating the scaling factor of 2d
434
- # cameras.
359
+ # The {#scale_2d} method returns a float indicating the scaling factor of 2
360
+ # point perspective cameras.
435
361
  #
436
362
  # When the camera is in two-point perspective and the user uses the zoom tools,
437
363
  # this value will change. Zooming out will produce a value greater than 1.0.
@@ -471,67 +397,48 @@ class Sketchup::Camera
471
397
  def set(eye, target, up)
472
398
  end
473
399
 
474
- # The target method retrieves Point3d that the camera is pointing at.
400
+ # The {#target} method retrieves Point3d that the camera is pointing at.
475
401
  #
476
402
  # @example
477
403
  # 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
404
+ # target = camera.target
485
405
  #
486
- # @return target - a Point3d object if successful
406
+ # @return [Geom::Point3d]
487
407
  #
488
408
  # @version SketchUp 6.0
489
409
  def target
490
410
  end
491
411
 
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.
412
+ # The {#up} method is used to retrieve the up vector for the camera. This is
413
+ # the direction that the top of the camera is facing.
494
414
  #
495
415
  # @example
496
416
  # camera = Sketchup::Camera.new
497
- # # 0.0, 1.0, 0.0
498
417
  # up = camera.up
499
- # if (up)
500
- # UI.messagebox up.to_s
501
- # else
502
- # UI.messagebox "Failure"
503
- # end
504
418
  #
505
- # @return up - a Vector3d object if successful
419
+ # @return [Geom::Vector3d]
506
420
  #
507
421
  # @version SketchUp 6.0
508
422
  def up
509
423
  end
510
424
 
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.
425
+ # The {#xaxis} method is used to retrieve the x axis of the camera coordinate
426
+ # system.
513
427
  #
514
428
  # This value is computed from the cross product between the camera direction
515
429
  # and the up vector.
516
430
  #
517
431
  # @example
518
432
  # 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
433
+ # xaxis = camera.xaxis
526
434
  #
527
- # @return vector - a Vector3d object if successful
435
+ # @return [Geom::Vector3d] ]
528
436
  #
529
437
  # @version SketchUp 6.0
530
438
  def xaxis
531
439
  end
532
440
 
533
- # The yaxis method retrieves the y axis of the camera coordinate system
534
- # defined by the camera's direction and up vector.
441
+ # The {#yaxis} method retrieves the y axis of the camera coordinate system.
535
442
  #
536
443
  # This value is computed to be perpendicular the camera x and z axes. It is
537
444
  # equivalent to the up direction, but is computed to make sure that it is
@@ -540,21 +447,15 @@ class Sketchup::Camera
540
447
  # @example
541
448
  # camera = Sketchup::Camera.new
542
449
  # # 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
450
+ # yaxis = camera.yaxis
549
451
  #
550
- # @return vector - a Vector3d object if successful
452
+ # @return [Geom::Vector3d] ]
551
453
  #
552
454
  # @version SketchUp 6.0
553
455
  def yaxis
554
456
  end
555
457
 
556
- # The zaxis method retrieves the z axis of the camera coordinate system
557
- # defined by the camera's direction and up vector.
458
+ # The {#zaxis} method retrieves the z axis of the camera coordinate system.
558
459
  #
559
460
  # This value is computed. It is the same as Camera.direction
560
461
  #