sketchup-api-stubs 0.7.9 → 0.7.11

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 (160) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sketchup-api-stubs/sketchup.rb +157 -151
  3. data/lib/sketchup-api-stubs/stubs/Array.rb +741 -741
  4. data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +322 -322
  5. data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +182 -172
  6. data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +111 -126
  7. data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
  8. data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +423 -400
  9. data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +693 -661
  10. data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +535 -509
  11. data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +500 -476
  12. data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +267 -263
  13. data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +133 -141
  14. data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +547 -522
  15. data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +678 -693
  16. data/lib/sketchup-api-stubs/stubs/Geom.rb +351 -351
  17. data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +93 -93
  18. data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +595 -595
  19. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +751 -747
  20. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +183 -183
  21. data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
  22. data/lib/sketchup-api-stubs/stubs/Layout/Dictionary.rb +234 -0
  23. data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +683 -517
  24. data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
  25. data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +148 -148
  26. data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +464 -353
  27. data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +354 -354
  28. data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -311
  29. data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
  30. data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -91
  31. data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +370 -370
  32. data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +218 -218
  33. data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +128 -128
  34. data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +225 -225
  35. data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +614 -567
  36. data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +10 -10
  37. data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +11 -11
  38. data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +282 -183
  39. data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +458 -387
  40. data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +209 -209
  41. data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +346 -344
  42. data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +174 -174
  43. data/lib/sketchup-api-stubs/stubs/Layout/ReferenceEntity.rb +82 -82
  44. data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +714 -692
  45. data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1565 -1519
  46. data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
  47. data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
  48. data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
  49. data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
  50. data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
  51. data/lib/sketchup-api-stubs/stubs/Length.rb +286 -278
  52. data/lib/sketchup-api-stubs/stubs/Numeric.rb +249 -249
  53. data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +196 -144
  54. data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +169 -169
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +226 -209
  56. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +145 -150
  57. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +294 -281
  58. data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
  59. data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +296 -302
  60. data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +473 -478
  61. data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +121 -121
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +294 -294
  64. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +673 -659
  65. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +600 -593
  66. data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
  67. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +252 -257
  68. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
  69. data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +201 -201
  70. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +443 -449
  71. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +74 -74
  72. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +104 -104
  73. data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +167 -165
  74. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +306 -306
  75. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +42 -42
  76. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
  77. data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +403 -406
  78. data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +397 -397
  79. data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
  80. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1282 -1239
  81. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +261 -261
  82. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -127
  83. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +519 -545
  84. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -60
  85. data/lib/sketchup-api-stubs/stubs/Sketchup/Environment.rb +406 -0
  86. data/lib/sketchup-api-stubs/stubs/Sketchup/Environments.rb +185 -0
  87. data/lib/sketchup-api-stubs/stubs/Sketchup/EnvironmentsObserver.rb +113 -0
  88. data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +122 -125
  89. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +1006 -937
  90. data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +102 -102
  91. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +740 -750
  92. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +289 -282
  93. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +64 -62
  94. data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
  95. data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +405 -468
  96. data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +266 -266
  97. data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +189 -189
  98. data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +432 -406
  99. data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +84 -84
  100. data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +307 -306
  101. data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +332 -326
  102. data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +380 -422
  103. data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +409 -427
  104. data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +241 -249
  105. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
  106. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +55 -48
  107. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
  108. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +114 -114
  109. data/lib/sketchup-api-stubs/stubs/Sketchup/LoadHandler.rb +70 -0
  110. data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
  111. data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +1115 -414
  112. data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +330 -317
  113. data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +142 -142
  114. data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +93 -93
  115. data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1714 -1652
  116. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +372 -357
  117. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +133 -130
  118. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +271 -271
  119. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
  120. data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +463 -490
  121. data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +104 -116
  122. data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +939 -797
  123. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +388 -361
  124. data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -77
  125. data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +501 -478
  126. data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
  127. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +385 -361
  128. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +45 -45
  129. data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
  130. data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +451 -458
  131. data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
  132. data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +211 -212
  133. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +259 -255
  134. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +59 -59
  135. data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -40
  136. data/lib/sketchup-api-stubs/stubs/Sketchup/Snap.rb +125 -0
  137. data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +88 -69
  138. data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +263 -217
  139. data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +283 -262
  140. data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +199 -217
  141. data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
  142. data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +924 -834
  143. data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
  144. data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +156 -156
  145. data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +75 -75
  146. data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +143 -142
  147. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1566 -1311
  148. data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +71 -45
  149. data/lib/sketchup-api-stubs/stubs/Sketchup.rb +1429 -1377
  150. data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +353 -353
  151. data/lib/sketchup-api-stubs/stubs/String.rb +24 -24
  152. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +399 -389
  153. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +580 -494
  154. data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +280 -269
  155. data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +258 -241
  156. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +636 -635
  157. data/lib/sketchup-api-stubs/stubs/UI.rb +791 -683
  158. data/lib/sketchup-api-stubs/stubs/_top_level.rb +303 -303
  159. data/lib/sketchup-api-stubs.rb +1 -1
  160. metadata +10 -24
@@ -1,1311 +1,1566 @@
1
- # Copyright:: Copyright 2023 Trimble Inc.
2
- # License:: The MIT License (MIT)
3
-
4
- # This class contains methods to manipulate the current point of view of the
5
- # model. The drawing methods here (draw_line, draw_polyline, etc) are meant to
6
- # be invoked within a tool's Tool.draw method. Calling them outside Tool.draw
7
- # will have no effect.
8
- #
9
- # You access the View by calling the Model.active_view method.
10
- #
11
- # @example
12
- # view = Sketchup.active_model.active_view
13
- #
14
- # @version SketchUp 6.0
15
- class Sketchup::View
16
-
17
- # Instance Methods
18
-
19
- # The add_observer method is used to add an observer to the current object.
20
- #
21
- # @example
22
- # view = Sketchup.active_model.active_view
23
- # status = view.add_observer observer
24
- #
25
- # @param [Object] observer
26
- # An observer.
27
- #
28
- # @return [Boolean] true if successful, false if unsuccessful.
29
- #
30
- # @version SketchUp 6.0
31
- def add_observer(observer)
32
- end
33
-
34
- # The {#animation=} method is used to set an animation that is displayed for a
35
- # view. See {Sketchup::Animation} for details on how to create an animation object.
36
- #
37
- # @example
38
- # animation = ViewSpinner.new
39
- # model = Sketchup.active_model
40
- # view = model.active_view
41
- # anim = view.animation = animation
42
- #
43
- # @param [#nextFrame] animation
44
- #
45
- # @version SketchUp 6.0
46
- def animation=(animation)
47
- end
48
-
49
- # The average_refresh_time is used to set the average time used to refresh the
50
- # current model in the view. This can be used to estimate the frame rate for
51
- # an animation.
52
- #
53
- # @example
54
- # model = Sketchup.active_model
55
- # view = model.active_view
56
- # time = view.average_refresh_time
57
- #
58
- # @return [Float] the time in seconds
59
- #
60
- # @version SketchUp 6.0
61
- def average_refresh_time
62
- end
63
-
64
- # The camera method is used to retrieve the camera for the view.
65
- #
66
- # @example
67
- # camera = view.camera
68
- #
69
- # @return [Sketchup::Camera] a Camera object
70
- #
71
- # @version SketchUp 6.0
72
- def camera
73
- end
74
-
75
- # The {#camera=} method is used to set the camera for the view. If a transition
76
- # time is given, then it will animate the transition from the current camera
77
- # to the new one.
78
- #
79
- # @example
80
- # camera = Sketchup::Camera.new([5, 5, 9], [5, 10, 0], Z_AXIS)
81
- # view = Sketchup.active_model.active_view
82
- # view.camera = camera
83
- #
84
- # @overload camera=(camera)
85
- #
86
- # @param [Sketchup::Camera] camera The new camera object.
87
- #
88
- # @overload camera=(camera_and_transition)
89
- #
90
- # @param [Array(Sketchup::Camera, Float)] camera_and_transition
91
- # The second item in the array represents the transition time from the
92
- # existing camera to the new one.
93
- #
94
- # @version SketchUp 6.0
95
- def camera=(arg)
96
- end
97
-
98
- # The center method is used to retrieve the coordinates of the center of the
99
- # view in pixels. It is returned as an array of 2 values for x and y.
100
- #
101
- # @example
102
- # model = Sketchup.active_model
103
- # view = model.active_view
104
- # c = view.center
105
- #
106
- # @return [Geom::Point3d] the center of the view
107
- #
108
- # @version SketchUp 6.0
109
- def center
110
- end
111
-
112
- # The corner method is used to retrieve the coordinates of one of the corners
113
- # of the view. The argument is an index between 0 and 3 that identifies which
114
- # corner you want. This method returns an array with two integers which are
115
- # the coordinates of the corner of the view in the view space. If the view
116
- # uses a Camera with a fixed aspect ratio, then the corners are the corners of
117
- # the viewing are of the camera which might be different than the actual
118
- # corners of the view itself.
119
- #
120
- # The index numbers are as follows:
121
- # - 0: top left,
122
- # - 1: top right,
123
- # - 2: bottom left,
124
- # - 3: bottom right.
125
- #
126
- # @example
127
- # point = view.corner index
128
- #
129
- # @param [Integer] index
130
- # A value between (or including) 0 and 3 identifying the
131
- # corner whose coordinate you want to retrieve.
132
- #
133
- # @return [Array(Integer, Integer)] a 2d array [w,h] representing the screen point
134
- #
135
- # @version SketchUp 6.0
136
- def corner(index)
137
- end
138
-
139
- # The {#draw} method is used to do basic drawing. This method can only be
140
- # called from within the {Tool#draw} method of a tool that you implement in
141
- # Ruby.
142
- #
143
- # The following constants are all OpenGL terms and have been externalized to
144
- # Ruby. Here is a summary of their meanings:
145
- #
146
- # [GL_POINTS]
147
- # Treats each vertex as a single point. Vertex n defines point n. N
148
- # points are drawn.
149
- #
150
- # [GL_LINES]
151
- # Treats each pair of vertices as
152
- # an independent line segment. Vertices 2n-1 and 2n define line n. N/2 lines
153
- # are drawn.
154
- #
155
- # [GL_LINE_STRIP]
156
- # Draws a connected group of line
157
- # segments from the first vertex to the last. Vertices n and n+1 define
158
- # line n. N-1 lines are drawn.
159
- #
160
- # [GL_LINE_LOOP]
161
- # Draws a connected group of line segments from the first vertex to the last,
162
- # then back to the first. Vertices n and n+1 define line n. The last line,
163
- # however, is defined by vertices N and 1. N lines are drawn.
164
- #
165
- # [GL_TRIANGLES]
166
- # Treats each triplet of vertices as an independent
167
- # triangle. Vertices 3n-2, 3n-1, and 3n define triangle n. N/3 triangles are
168
- # drawn.
169
- #
170
- # [GL_TRIANGLE_STRIP]
171
- # Draws a connected group of triangles. One triangle is defined for each
172
- # vertex presented after the first two vertices. For odd n, vertices n, n+1,
173
- # and n+2 define triangle n. For even n, vertices n+1, n, and n+2 define
174
- # triangle n. N-2 triangles are drawn.
175
- #
176
- # [GL_TRIANGLE_FAN]
177
- # Draws a connected group of triangles.
178
- # One triangle is defined for each vertex presented after the first two
179
- # vertices. Vertices 1, n+1, and n+2 define triangle n. N-2 triangles are
180
- # drawn.
181
- #
182
- # [GL_QUADS]
183
- # Treats each group of four vertices as an
184
- # independent quadrilateral. Vertices 4n-3, 4n-2, 4n-1, and 4n define
185
- # quadrilateral n. N/4 quadrilaterals are drawn.
186
- #
187
- # [GL_QUAD_STRIP]
188
- # Draws a connected group of quadrilaterals. One quadrilateral is
189
- # defined for each pair of vertices presented after the first pair.
190
- # Vertices 2n-1, 2n, 2n+2, and 2n+1 define quadrilateral n. N/2-1
191
- # quadrilaterals are drawn. Note that the order in which vertices are used to
192
- # construct a quadrilateral from strip data is different from that used with
193
- # independent data.
194
- #
195
- # [GL_POLYGON]
196
- # Draws a single, convex polygon. Vertices 1
197
- # through N define this polygon.
198
- #
199
- # @example
200
- # points = [
201
- # Geom::Point3d.new(0, 0, 0),
202
- # Geom::Point3d.new(9, 0, 0),
203
- # Geom::Point3d.new(9, 9, 0),
204
- # Geom::Point3d.new(0, 9, 0)
205
- # ]
206
- # view.draw(GL_LINE_LOOP, points)
207
- #
208
- # @note If you draw outside the model bounds you need to implement
209
- # {Tool#getExtents} which returns a bounding box large enough to include the
210
- # points you draw. Otherwise your drawing will be clipped.
211
- #
212
- # @overload draw(openglenum, points)
213
- #
214
- # @param [Integer] openglenum
215
- # The item you are going to draw, one of the constants
216
- # from the comments, such as +GL_LINES+.
217
- # @param [Array<Geom::Point3d>] points
218
- #
219
- # @overload draw(openglenum, *points)
220
- #
221
- # @param [Integer] openglenum
222
- # The item you are going to draw, one of the constants
223
- # from the comments, such as +GL_LINES+.
224
- # @param [Array<Geom::Point3d>] points
225
- #
226
- # @overload draw(openglenum, points, **options)
227
- #
228
- # @version SketchUp 2020.0
229
- # @param [Integer] openglenum
230
- # The item you are going to draw, one of the constants
231
- # from the comments, such as +GL_LINES+.
232
- # @param [Array<Geom::Point3d>] points
233
- # @param [Hash] options
234
- # @option options [Array<Geom::Vector3d>] :normals
235
- # Without normals the polygons will be rendered with flat shading. No
236
- # light will affect it. By providing an array of vertex normals lighting
237
- # is turned on and will use the model's current light. Note that the number
238
- # of normals must match the number of points provided.
239
- # @option options [Integer] :texture
240
- # A texture id provided by {#load_texture}.
241
- # @option options [Array<Geom::Vector3d>] :uvs
242
- # Set of UV (Not UVQ) coordinates matching the number of points provided.
243
- # This must be used along with the +:texture+ option.
244
- #
245
- # @overload draw(openglenum, *points, **options)
246
- #
247
- # @version SketchUp 2020.0
248
- # @param [Integer] openglenum
249
- # The item you are going to draw, one of the constants
250
- # from the comments, such as +GL_LINES+.
251
- # @param [Array<Geom::Point3d>] points
252
- # @param [Hash] options
253
- # @option options [Array<Geom::Vector3d>] :normals ([])
254
- # Without normals the polygons will be rendered with flat shading. No
255
- # light will affect it. By providing an array of vertex normals lighting
256
- # is turned on and will use the model's current light. Note that the number
257
- # of normals must match the number of points provided.
258
- # @option options [Integer] :texture
259
- # A texture id provided by {#load_texture}.
260
- # @option options [Array<Geom::Vector3d>] :uvs
261
- # Set of UV (Not UVQ) coordinates matching the number of points provided.
262
- # This must be used along with the +:texture+ option.
263
- #
264
- # @return [Sketchup::View]
265
- #
266
- # @see Tool#getExtents
267
- #
268
- # @version SketchUp 6.0
269
- def draw(*args)
270
- end
271
-
272
- # The {#draw2d} method is used to draw in screen space (using 2D screen
273
- # coordinates) instead of 3D space.
274
- #
275
- # The second parameter is an {Array} of {Geom::Point3d} objects (or several
276
- # individual {Geom::Point3d} objects). These {Geom::Point3d} objects are in
277
- # screen space, not 3D space.
278
- # The X value corresponds to the number of pixels from the left edge of the
279
- # drawing area. The Y value corresponds to the number of pixels down from
280
- # the top of the drawing area. The Z value is not used.
281
- #
282
- # @example
283
- # points = [
284
- # Geom::Point3d.new(0, 0, 0),
285
- # Geom::Point3d.new(8, 0, 0),
286
- # Geom::Point3d.new(8, 4, 0),
287
- # Geom::Point3d.new(0, 4, 0)
288
- # ]
289
- # view.draw2d(GL_LINE_STRIP, points)
290
- #
291
- # @overload draw2d(openglenum, points)
292
- #
293
- # @param [Integer] openglenum
294
- # The item you are going to draw, one of the constants
295
- # from the comments, such as +GL_LINES+.
296
- # @param [Array<Geom::Point3d>] points
297
- #
298
- # @overload draw2d(openglenum, *points)
299
- #
300
- # @param [Integer] openglenum
301
- # The item you are going to draw, one of the constants
302
- # from the comments, such as +GL_LINES+.
303
- # @param [Array<Geom::Point3d>] points
304
- #
305
- # @overload draw2d(openglenum, points, **options)
306
- #
307
- # @version SketchUp 2020.0
308
- # @param [Integer] openglenum
309
- # The item you are going to draw, one of the constants
310
- # from the comments, such as +GL_LINES+.
311
- # @param [Array<Geom::Point3d>] points
312
- # @param [Hash] options
313
- # @option options [Integer] :texture
314
- # A texture id provided by {#load_texture}.
315
- # @option options [Array<Geom::Vector3d>] :uvs
316
- # Set of UV (Not UVQ) coordinates matching the number of points provided.
317
- # This must be used along with the +:texture+ option.
318
- #
319
- # @overload draw2d(openglenum, *points, **options)
320
- #
321
- # @version SketchUp 2020.0
322
- # @param [Integer] openglenum
323
- # The item you are going to draw, one of the constants
324
- # from the comments, such as +GL_LINES+.
325
- # @param [Array<Geom::Point3d>] points
326
- # @param [Hash] options
327
- # @option options [Integer] :texture
328
- # A texture id provided by {#load_texture}.
329
- # @option options [Array<Geom::Vector3d>] :uvs
330
- # Set of UV (Not UVQ) coordinates matching the number of points provided.
331
- # This must be used along with the +:texture+ option.
332
- #
333
- # @return [Sketchup::View]
334
- #
335
- # @see #draw
336
- #
337
- # @see UI.scale_factor
338
- #
339
- # @version SketchUp 6.0
340
- def draw2d(*args)
341
- end
342
-
343
- # The draw_lines method is used to draw disconnected lines.
344
- #
345
- # You must have an even number of points. This method is usually invoked
346
- # within the draw method of a tool.
347
- #
348
- # @example
349
- # point4 = Geom::Point3d.new 0,0,0
350
- # point5 = Geom::Point3d.new 100,100,100
351
- # # returns a view
352
- # status = view.drawing_color="red"
353
- # status = view.draw_lines point4, point5
354
- #
355
- # @overload draw_lines(points, ...)
356
- #
357
- # @param [Array<Geom::Point3d>] points
358
- # An even number of Point3d objects.
359
- # @return [Sketchup::View]
360
- #
361
- # @overload draw_lines(points)
362
- #
363
- # @param [Array<Geom::Point3d>] points An array of Point3d objects.
364
- # @return [Sketchup::View]
365
- #
366
- # @version SketchUp 6.0
367
- def draw_line(*args)
368
- end
369
-
370
- # The draw_lines method is used to draw disconnected lines.
371
- #
372
- # You must have an even number of points. This method is usually invoked
373
- # within the draw method of a tool.
374
- #
375
- # @example
376
- # point4 = Geom::Point3d.new 0,0,0
377
- # point5 = Geom::Point3d.new 100,100,100
378
- # # returns a view
379
- # status = view.drawing_color="red"
380
- # status = view.draw_lines point4, point5
381
- #
382
- # @overload draw_lines(points, ...)
383
- #
384
- # @param [Array<Geom::Point3d>] points
385
- # An even number of Point3d objects.
386
- # @return [Sketchup::View]
387
- #
388
- # @overload draw_lines(points)
389
- #
390
- # @param [Array<Geom::Point3d>] points An array of Point3d objects.
391
- # @return [Sketchup::View]
392
- #
393
- # @version SketchUp 6.0
394
- def draw_lines(*args)
395
- end
396
-
397
- # This method is used to draw points.
398
- #
399
- # This method is usually invoked within the draw method of a tool.
400
- #
401
- # @example
402
- # point3 = Geom::Point3d.new 0,0,0
403
- # # returns a view
404
- # status = view.draw_points(point3, 10, 1, "red")
405
- #
406
- # @param [Array<Geom::Point3d>] points
407
- #
408
- # @param [Integer] size
409
- # Size of the point in pixels.
410
- #
411
- # @param [Integer] style
412
- # 1 = open square, 2 = filled square, 3 = "+", 4 = "X", 5 = "*",
413
- # 6 = open triangle, 7 = filled triangle.
414
- #
415
- # @param [Sketchup::Color] color
416
- #
417
- # @return [Sketchup::View] a View object
418
- #
419
- # @version SketchUp 6.0
420
- def draw_points(points, size = 6, style = 3, color = 'black')
421
- end
422
-
423
- # The draw_polyline method is used to draw a series of connected line segments
424
- # from pt1 to pt2 to pt3, and so on.
425
- #
426
- # This method is usually invoked within the draw method of a tool.
427
- #
428
- # @example
429
- # point12 = Geom::Point3d.new 0,0,0
430
- # point13 = Geom::Point3d.new 10,10,10
431
- # point14 = Geom::Point3d.new 20,20,20
432
- # point15 = Geom::Point3d.new 30,30,30
433
- # status = view.draw_polyline point12, point13, point14, point15
434
- #
435
- # @overload draw_polyline(points, ...)
436
- #
437
- # @param [Array<Geom::Point3d>] points An even number of Point3d objects.
438
- # @return [Sketchup::View]
439
- #
440
- # @overload draw_polyline(points)
441
- #
442
- # @param [Array<Geom::Point3d>] points An array of Point3d objects.
443
- # @return [Sketchup::View]
444
- #
445
- # @version SketchUp 6.0
446
- def draw_polyline(*args)
447
- end
448
-
449
- # This method is used to draw text on the screen and is usually invoked within
450
- # the draw method of a tool.
451
- #
452
- # The {TextVerticalAlignCenter} option will align the text to the center of the
453
- # height of the first line, not the whole boundingbox of the text. To align
454
- # around the full bounds of the text, use {#text_bounds} to compute the
455
- # desired alignment.
456
- #
457
- # The vertical alignment can vary between fonts and platforms. It's recommended
458
- # to test different fonts and find one that fits well across both platforms
459
- # for your purposes.
460
- #
461
- # <b>Example of different vertical alignment and text bounds:</b>
462
- #
463
- # rdoc-image:../images/view-draw-text-with-bounds.png
464
- #
465
- # @bug Prior to SU2022.0, on macOS, the vertical text alignment for some fonts
466
- # could appear to be offset from their expected positions. As of SU2022.0 the
467
- # vertical alignment should be more accurate and consistent.
468
- #
469
- # @example
470
- # class ExampleTool
471
- # def draw(view)
472
- # # This works in all SketchUp versions and draws the text using the
473
- # # default font, size and color (i.e. the model edge color).
474
- # point = Geom::Point3d.new(200, 100, 0)
475
- # view.draw_text(point, "This is a test")
476
- #
477
- # # This works in SketchUp 2016 and up.
478
- # options = {
479
- # :font => "Arial",
480
- # :size => 20,
481
- # :bold => true,
482
- # :align => TextAlignRight
483
- # }
484
- # point = Geom::Point3d.new(200, 200, 0)
485
- # view.draw_text(point, "This is another\ntest", options)
486
- #
487
- # # You can also use Ruby 2.0's named arguments:
488
- # point = Geom::Point3d.new(200, 200, 0)
489
- # view.draw_text(point, "Hello world!", color: "Red")
490
- # end
491
- # end
492
- #
493
- # @example Cross Platform Font Size
494
- # class ExampleTool
495
- # IS_WIN = Sketchup.platform == :platform_win
496
- #
497
- # def draw(view)
498
- # draw_text(view, [100, 200, 0], "Hello World", size: 20)
499
- # end
500
- #
501
- # private
502
- #
503
- # # This will ensure text is drawn with consistent size across platforms,
504
- # # using pixels as size units.
505
- # def draw_text(view, position, text, **options)
506
- # native_options = options.dup
507
- # if IS_WIN && options.key?(:size)
508
- # native_options[:size] = pixels_to_points(options[:size])
509
- # end
510
- # view.draw_text(position, text, **native_options)
511
- # end
512
- #
513
- # def pixels_to_points(pixels)
514
- # ((pixels.to_f / 96.0) * 72.0).round
515
- # end
516
- # end
517
- #
518
- # @note Under Windows the font name must be less than 32 characters - due to
519
- # system limitations.
520
- #
521
- # @note As of SU2017 this will automatically scale the font-size by the same
522
- # factor as {UI.scale_factor}.
523
- #
524
- # @note The font size is platform dependent. On Windows the method expects
525
- # points, where on Mac it's pixels. See "Cross Platform Font Size" example
526
- # for details.
527
- #
528
- # @overload draw_text(point, text)
529
- #
530
- # @param [Geom::Point3d] point A Point3d object representing a 2D coordinate
531
- # in view space.
532
- # @param [String] text The text string to draw.
533
- #
534
- # @overload draw_text(point, text, options = {})
535
- #
536
- # @version SketchUp 2016
537
- # @param [Geom::Point3d] point A Point3d object representing a 2D coordinate
538
- # in view space.
539
- # @param [String] text The text string to draw.
540
- # @param [Hash] options The text can be customized by providing a hash or
541
- # named arguments of options.
542
- # @option options [String] :font The name of the font to use. If it does not
543
- # exist on the system, a default font will be used instead.
544
- # @option options [Integer] :size The size of the font in points
545
- # @option options [Boolean] :bold Controls the Bold property of the font.
546
- # @option options [Boolean] :italic Controls the Italic property of the font.
547
- # @option options [Sketchup::Color] :color The color to draw the text with.
548
- # @option options [Integer] :align The text alignment, one of the following
549
- # constants: {TextAlignLeft}, {TextAlignCenter} or {TextAlignRight}.
550
- # @option options [Integer] :vertical_align <b>Added SketchUp 2020.0.</b>
551
- # The vertical text alignment, one of the following constants:
552
- # {TextVerticalAlignBoundsTop}, {TextVerticalAlignBaseline},
553
- # {TextVerticalAlignCapHeight} or {TextVerticalAlignCenter}. Note that
554
- # some fonts on Mac might not align as expected due to the system
555
- # reporting incorrect font metrics.
556
- #
557
- # @return [Sketchup::View]
558
- #
559
- # @version SketchUp 6.0
560
- def draw_text(*args)
561
- end
562
-
563
- # The drawing_color method is used to set the color that is used for drawing
564
- # to the view.
565
- #
566
- # This method is usually invoked within the draw method of a tool.
567
- #
568
- # @example
569
- # view = view.drawing_color = color
570
- #
571
- # @param [Sketchup::Color, String] color
572
- # A Color object.
573
- #
574
- # @return [Sketchup::View]
575
- #
576
- # @version SketchUp 6.0
577
- def drawing_color=(color)
578
- end
579
-
580
- # The dynamic= method allows you to degrade visual quality while improving
581
- # performance when a model is large and view refresh time is slow. For
582
- # example, if you were using a Ruby script to animate the camera through
583
- # a large scene, you may want to set dynamic to true during that time.
584
- #
585
- # See also camera.rb which is part of the film and stage ruby
586
- # scripts.
587
- #
588
- # @deprecated This method is no longer doing anything.
589
- #
590
- # @example
591
- # view.dynamic = true
592
- #
593
- # @param [Boolean] value
594
- #
595
- # @return [Boolean]
596
- #
597
- # @version SketchUp 6.0
598
- def dynamic=(value)
599
- end
600
-
601
- # The field_of_view method is used get the view's field of view setting, in
602
- # degrees.
603
- #
604
- # @example
605
- # fov = Sketchup.active_model.active_view.field_of_view
606
- #
607
- # @return [Float] the field of view
608
- #
609
- # @version SketchUp 6.0
610
- def field_of_view
611
- end
612
-
613
- # The field_of_view= method is used set the view's field of view setting,
614
- # in degrees.
615
- #
616
- # @example
617
- # my_view = Sketchup.active_model.active_view
618
- # my_view.field_of_view = 45
619
- # my_view.invalidate
620
- #
621
- # @param [Numeric] fov
622
- # the field of view
623
- #
624
- # @return [Numeric]
625
- #
626
- # @version SketchUp 6.0
627
- def field_of_view=(fov)
628
- end
629
-
630
- # The guess_target method is used to guess at what the user is looking at when
631
- # you have a perspective view.
632
- #
633
- # This method is useful when writing a viewing tool. See also camera.rb which
634
- # is part of the film and stage ruby scripts.
635
- #
636
- # @example
637
- # target = view.guess_target
638
- #
639
- # @return [Geom::Point3d] a Point3d object representing the point in the
640
- # model that the user is likely interested in.
641
- #
642
- # @version SketchUp 6.0
643
- def guess_target(*args)
644
- end
645
-
646
- # The inference_locked? method is used to determine if inference locking is on
647
- # for the view.
648
- #
649
- # @example
650
- # model = Sketchup.active_model
651
- # view = model.active_view
652
- # status = view.inference_locked
653
- #
654
- # @return [Boolean]
655
- #
656
- # @version SketchUp 6.0
657
- def inference_locked?
658
- end
659
-
660
- # The inputpoint method is used to retrieve an input point.
661
- #
662
- # This will normally be used inside one of the mouse event handling methods in
663
- # a tool. Usually, it is preferable to create the InputPoint first and then
664
- # use the pick method on it.
665
- #
666
- # @example
667
- # inputpoint = view.inputpoint x, y, inputpoint1
668
- #
669
- # @param [Numeric] x
670
- # A x value.
671
- #
672
- # @param [Numeric] y
673
- # A y value.
674
- #
675
- # @param [Sketchup::InputPoint] inputpoint1
676
- # An InputPoint object.
677
- #
678
- # @return [Sketchup::InputPoint]
679
- #
680
- # @version SketchUp 6.0
681
- def inputpoint(x, y, inputpoint1)
682
- end
683
-
684
- # The invalidate method is used mark the view as in need of a redraw.
685
- #
686
- # @example
687
- # model = Sketchup.active_model
688
- # view = model.active_view
689
- # invalidated_view = view.invalidate
690
- #
691
- # @note This is the preferred method to update the viewport. Use this before
692
- # trying to use {#refresh}.
693
- #
694
- # @return [Sketchup::View] the invalidated View object
695
- #
696
- # @version SketchUp 6.0
697
- def invalidate
698
- end
699
-
700
- # The last_refresh_time method is used to retrieve the time for the last full
701
- # view refresh.
702
- #
703
- # @example
704
- # time = view.last_refresh_time
705
- #
706
- # @return [Float] time in milliseconds
707
- #
708
- # @version SketchUp 6.0
709
- def last_refresh_time(*args)
710
- end
711
-
712
- # The line_stipple= method is used to set the line pattern to use for drawing.
713
- # The stipple pattern is given as a string.
714
- # Valid strings are:
715
- # "." (Dotted Line),
716
- # "-" (Short Dashes Line),
717
- # "_" (Long Dashes Line),
718
- # "-.-" (Dash Dot Dash Line),
719
- # "" (Solid Line).
720
- #
721
- # This method is usually invoked within the draw method of a tool.
722
- #
723
- # @example
724
- # point8 = Geom::Point3d.new 0,0,0
725
- # point9 = Geom::Point3d.new 100,100,100
726
- # view.line_stipple = "-.-"
727
- # view = view.draw_lines point8, point9
728
- #
729
- # @param [String] pattern
730
- # A string stipple pattern, such as "-.-"
731
- #
732
- # @return [Sketchup::View] the View object
733
- #
734
- # @version SketchUp 6.0
735
- def line_stipple=(pattern)
736
- end
737
-
738
- # The line_width= method is used to set the line width to use for drawing. The
739
- # value is a Double indicating the desired width in pixels.
740
- #
741
- # This method is usually invoked within the draw method of a tool.
742
- #
743
- # @example
744
- # view.line_width = width
745
- #
746
- # @note As of SU2017 this will automatically scale the line width by the same
747
- # factor as {UI.scale_factor}.
748
- #
749
- # @param [Integer] width
750
- # The width in pixels.
751
- #
752
- # @return [Integer]
753
- #
754
- # @version SketchUp 6.0
755
- def line_width=(width)
756
- end
757
-
758
- # Loads a texture to be drawn with {#draw} or {#draw2d}.
759
- #
760
- # @example
761
- # module Example
762
- # class MyTool
763
- # def activate
764
- # view = Sketchup.active_model.active_view
765
- # image_rep = view.model.materials.current.texture.image_rep
766
- # @texture_id = view.load_texture(image_rep)
767
- # end
768
- #
769
- # def deactivate(view)
770
- # view.release_texture(@texture_id)
771
- # end
772
- #
773
- # def draw(view)
774
- # points = [ [0, 0, 0], [9, 0, 0], [9, 9, 0], [0, 9, 0] ]
775
- # uvs = [ [0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0] ]
776
- # view.draw(GL_QUADS, points, texture: @texture_id, uvs: uvs)
777
- # end
778
- # end
779
- # end
780
- # Sketchup.active_model.select_tool(Example::MyTool.new)
781
- #
782
- # @note Avoid loading and releasing textures within the {Sketchup::Tool#draw}
783
- # event as that is not efficient.
784
- #
785
- # @note SketchUp 2020.0-2022.0: To conserve resources on the user's machine,
786
- # textures can be loaded only when there is a Ruby tool on the tool stack.
787
- # Make sure to release the texture when it's no longer needed. Any textures
788
- # not already released when the last Ruby tool on the tool stack is removed
789
- # will be automatically released by SketchUp. As of SketchUp 2023.0 this
790
- # automatic cleanup was removed to allow Overlays to draw textures.
791
- #
792
- # @param [Sketchup::ImageRep] image_rep
793
- #
794
- # @raise [ArgumentError] if the provided {Sketchup::ImageRep} is not valid.
795
- #
796
- # @raise [RuntimeError] if a Ruby tool was not on the tool stack.
797
- # (Applies to SketchUp 2020.0-2022.0).
798
- #
799
- # @return [Integer] A resource ID referring to the image loaded.
800
- #
801
- # @see #release_texture
802
- #
803
- # @see #draw
804
- #
805
- # @version SketchUp 2020.0
806
- def load_texture(image_rep)
807
- end
808
-
809
- # The {#lock_inference} method is used to lock or unlock an inference.
810
- #
811
- # This method will typically be called from inside a tool class when the user
812
- # presses the shift key or arrow keys.
813
- #
814
- # With no arguments it unlocks all inferences. With one argument it locks
815
- # inference based on that passed {Sketchup::InputPoint}'s entities, e.g. along
816
- # a {Sketchup::Edge}'s line or a {Sketchup::Face}'s plane. With two arguments,
817
- # it locks inference along an axis.
818
- #
819
- # @example
820
- # view = view.lock_inference
821
- # view = view.lock_inference(inputpoint)
822
- # view = view.lock_inference(inputpoint1, inputpoint2)
823
- #
824
- # @overload lock_inference
825
- #
826
- #
827
- # @overload lock_inference(inputpoint)
828
- #
829
- # @param [Sketchup::InputPoint] inputpoint
830
- #
831
- # @overload lock_inference(inputpoint, inputpoint2)
832
- #
833
- # @param [Sketchup::InputPoint] inputpoint
834
- # @param [Sketchup::InputPoint] inputpoint2
835
- # @example
836
- # # Lock inference to X axis.
837
- # # The points can be anywhere; only the vector between them affects
838
- # # the result.
839
- # view.lock_inference(
840
- # Sketchup::InputPoint.new(ORIGIN),
841
- # Sketchup::InputPoint.new(Geom::Point3d.new(1, 0, 0))
842
- # )
843
- #
844
- # @return [Sketchup::View] a View object
845
- #
846
- # @version SketchUp 6.0
847
- def lock_inference(*args)
848
- end
849
-
850
- # The model method is used to retrieve the model for the current view.
851
- #
852
- # @example
853
- # model = view.model
854
- #
855
- # @return [Sketchup::Model] the model for this view
856
- #
857
- # @version SketchUp 6.0
858
- def model
859
- end
860
-
861
- # The pick_helper method is used to retrieve a pick helper for the view. See
862
- # the PickHelper class for information on pick helpers.
863
- #
864
- # This call returns an initialized PickHelper.
865
- #
866
- # @example
867
- # model = Sketchup.active_model
868
- # view = model.active_view
869
- # ph = view.pick_helper
870
- #
871
- # @overload pick_helper
872
- #
873
- # @return [Sketchup::PickHelper] a PickHelper object
874
- #
875
- # @overload pick_helper(x, y, aperture = 0)
876
- #
877
- # @param [Integer] x
878
- # @param [Integer] y
879
- # @param [Integer] aperture
880
- # @return [Sketchup::PickHelper] a PickHelper object
881
- #
882
- # @version SketchUp 6.0
883
- def pick_helper(*args)
884
- end
885
-
886
- # The pickray method is used to retrieve a ray passing through a given screen
887
- # position in the viewing direction.
888
- #
889
- # @example
890
- # ray = view.pickray x, y
891
- #
892
- # @overload pickray(screen_point)
893
- #
894
- # @param [Array(Integer, Integer)] screen_point
895
- # @return [Array(Geom::Point3d, Geom::Vector3d)] a ray
896
- #
897
- # @overload pickray(x, y)
898
- #
899
- # @param [Integer] x
900
- # @param [Integer] y
901
- # @return [Array(Geom::Point3d, Geom::Vector3d)] a ray
902
- #
903
- # @version SketchUp 6.0
904
- def pickray(*args)
905
- end
906
-
907
- # The pixels_to_model method is used to compute a model size from a pixel size
908
- # at a given point.
909
- #
910
- # This method is useful for deciding how big to draw something based on a
911
- # desired size in pixels.
912
- #
913
- # @example
914
- # size = view.pixels_to_model(pixels, point)
915
- #
916
- # @note As of SU2017 this will automatically scale the pixel-size by the same
917
- # factor as {UI.scale_factor}.
918
- #
919
- # @param [Numeric] pixels
920
- # The pixel size.
921
- #
922
- # @param [Geom::Point3d] point
923
- # A Point3d object where the size will be calculated from.
924
- #
925
- # @return [Float] the model size
926
- #
927
- # @version SketchUp 6.0
928
- def pixels_to_model(pixels, point)
929
- end
930
-
931
- # The refresh method is used to immediately force a redraw of the view.
932
- #
933
- # @example
934
- # model = Sketchup.active_model
935
- # view = model.active_view
936
- # refreshed_view = view.refresh
937
- #
938
- # @note This method might impact performance and if used incorrectly cause
939
- # instability or crashes. Don't use this unless you have verified that
940
- # you cannot use {#invalidate} instead.
941
- #
942
- # @return [Sketchup::View] the refreshed View object
943
- #
944
- # @version SketchUp 7.1
945
- def refresh
946
- end
947
-
948
- # Releases a texture loaded via {#load_texture}, freeing up it's memory.
949
- # It's good practice to do so whenever there is no longer any need for the
950
- # resource.
951
- #
952
- # For example, when your tool deactivates you probably want to release your
953
- # resources as you don't know if your tool will be used again.
954
- #
955
- # @example
956
- # module Example
957
- # class MyTool
958
- # def activate
959
- # view = Sketchup.active_model.active_view
960
- # image_rep = view.model.materials.current.texture.image_rep
961
- # @texture_id = view.load_texture(image_rep)
962
- # end
963
- #
964
- # def deactivate(view)
965
- # view.release_texture(@texture_id)
966
- # end
967
- #
968
- # def draw(view)
969
- # points = [ [0, 0, 0], [9, 0, 0], [9, 9, 0], [0, 9, 0] ]
970
- # uvs = [ [0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0] ]
971
- # view.draw(GL_QUADS, points, texture: @texture_id, uvs: uvs)
972
- # end
973
- # end
974
- # end
975
- # Sketchup.active_model.select_tool(Example::MyTool.new)
976
- #
977
- # @param [Integer] texture_id
978
- #
979
- # @return [Boolean] +true+ if texture was released. +false+ otherwise.
980
- #
981
- # @see #load_texture
982
- def release_texture(texture_id)
983
- end
984
-
985
- # The remove_observer method is used to remove an observer from the current
986
- # object.
987
- #
988
- # @example
989
- # view = Sketchup.active_model.active_view
990
- # status = view.remove_observer observer
991
- #
992
- # @param [Object] observer
993
- # An observer.
994
- #
995
- # @return [Boolean] true if successful, false if unsuccessful.
996
- #
997
- # @version SketchUp 6.0
998
- def remove_observer(observer)
999
- end
1000
-
1001
- # The screen_coords method is used to retrieve the screen coordinates of the
1002
- # given point on the screen.
1003
- #
1004
- # The x and y values returned correspond to the x and y screen coordinates.
1005
- # Ignore the z values. If the referenced point is not in the current
1006
- # viewport, the x and/or y value may be negative.
1007
- #
1008
- # @example
1009
- # point = view.screen_coords(ORIGIN)
1010
- #
1011
- # @param [Geom::Point3d] point3d
1012
- # A Point3d object.
1013
- #
1014
- # @return [Geom::Point3d] A Point3d containing the screen position
1015
- #
1016
- # @version SketchUp 6.0
1017
- def screen_coords(point3d)
1018
- end
1019
-
1020
- # Set the drawing color for the view based on the direction of a line that you
1021
- # want to draw. These colors will match the axes colors in the SketchUp model
1022
- # (typically blue for straight up and down, etc.)
1023
- #
1024
- # This method is usually invoked within the draw method of a tool.
1025
- #
1026
- # @example
1027
- # view = view.set_color_from_line point1, point2
1028
- #
1029
- # @param [Geom::Point3d] point1
1030
- # Point3d object representing first point in the line.
1031
- #
1032
- # @param [Geom::Point3d] point2
1033
- # Point3d object representing the second point in the line.
1034
- #
1035
- # @return [Sketchup::View] a View object
1036
- #
1037
- # @version SketchUp 6.0
1038
- def set_color_from_line(point1, point2)
1039
- end
1040
-
1041
- # The show_frame method is used to show a frame of an Animation object in the
1042
- # current view.
1043
- #
1044
- # You can supply an optional delay in seconds to wait before showing the next
1045
- # frame. This can be useful to control the speed at which the animation runs.
1046
- #
1047
- # @example
1048
- # status = view.show_frame delay
1049
- #
1050
- # @param [Numeric] delay
1051
- # An optional delay in seconds.
1052
- #
1053
- # @return [Sketchup::View]
1054
- #
1055
- # @version SketchUp 6.0
1056
- def show_frame(delay)
1057
- end
1058
-
1059
- # This method is used to compute the bounds of the text when
1060
- # using {#draw_text}. The bounds are not a tight fit around the top and bottom
1061
- # as they include varying amount of line spacing depending on the font used.
1062
- #
1063
- # The {TextVerticalAlignCenter} option will align the text to the center of the
1064
- # height of the first line, not the whole boundingbox of the text.
1065
- #
1066
- # <b>Example of different vertical alignment and text bounds:</b>
1067
- #
1068
- # rdoc-image:../images/view-draw-text-with-bounds.png
1069
- #
1070
- # @example
1071
- # class ExampleTool
1072
- # TEXT_OPTIONS = {
1073
- # :font => "Arial",
1074
- # :size => 20,
1075
- # :bold => true,
1076
- # :align => TextAlignRight,
1077
- # :align => TextVerticalAlignBaseline
1078
- # }
1079
- #
1080
- # # Since `draw` is called frequently it can be useful to pre-compute and
1081
- # # cache values used by `draw`.
1082
- # def activate
1083
- # @text = "Hello SketchUp"
1084
- # @position = Geom::Point3d.new(200, 200, 0)
1085
- #
1086
- # # Compute text bounds
1087
- # view = Sketchup.active_model.active_view
1088
- # bounds = view.text_bounds(@position, @text, TEXT_OPTIONS)
1089
- #
1090
- # # Compute polygon for the text bounds
1091
- # x1, y1 = bounds.upper_left.to_a
1092
- # x2, y2 = bounds.lower_right.to_a
1093
- # @points = [
1094
- # Geom::Point3d.new(x1, y1),
1095
- # Geom::Point3d.new(x1, y2),
1096
- # Geom::Point3d.new(x2, y2),
1097
- # Geom::Point3d.new(x2, y1),
1098
- # ]
1099
- # end
1100
- #
1101
- # def draw(view)
1102
- # # Draw text bounds
1103
- # view.drawing_color = Sketchup::Color.new(255, 0, 0, 64)
1104
- # view.draw2d(GL_QUADS, @points)
1105
- #
1106
- # # Draw text
1107
- # view.draw_text(@position, @text, TEXT_OPTIONS)
1108
- # end
1109
- # end
1110
- #
1111
- # @note Under Windows the font name must be less than 32 characters - due to
1112
- # system limitations.
1113
- #
1114
- # @option options [String] :font The name of the font to use. If it does not
1115
- # exist on the system, a default font will be used instead.
1116
- #
1117
- # @option options [Integer] :size The size of the font in points
1118
- #
1119
- # @option options [Boolean] :bold Controls the Bold property of the font.
1120
- #
1121
- # @option options [Boolean] :italic Controls the Italic property of the font.
1122
- #
1123
- # @option options [Integer] :align The text alignment, one of the following
1124
- # constants: {TextAlignLeft}, {TextAlignCenter} or {TextAlignRight}.
1125
- #
1126
- # @option options [Integer] :vertical_align The vertical text alignment
1127
- # one of the following constants:
1128
- # {TextVerticalAlignBoundsTop}, {TextVerticalAlignBaseline},
1129
- # {TextVerticalAlignCapHeight} or {TextVerticalAlignCenter}.
1130
- #
1131
- # @param [Geom::Point3d] point
1132
- # A Point3d object representing a 2D coordinate
1133
- # in view space.
1134
- #
1135
- # @param [String] text
1136
- # The text string to draw.
1137
- #
1138
- # @param [Hash] options
1139
- # The text can be customized by providing a hash or
1140
- # named arguments of options.
1141
- #
1142
- # @return [Geom::Bounds2d]
1143
- #
1144
- # @see #draw_text
1145
- #
1146
- # @version SketchUp 2020.0
1147
- def text_bounds(point, text, options = {})
1148
- end
1149
-
1150
- # Set a tooltip to display in the view. This is useful for displaying tooltips
1151
- # in a tool that you write in Ruby.
1152
- #
1153
- # @example
1154
- # tooltip = view.tooltip = string
1155
- #
1156
- # @param [String] string
1157
- # The string tooltip.
1158
- #
1159
- # @return [String] the new tooltip string
1160
- #
1161
- # @version SketchUp 6.0
1162
- def tooltip=(string)
1163
- end
1164
-
1165
- # The vpheight method is used to retrieve the height of the viewport for the
1166
- # view.
1167
- #
1168
- # @example
1169
- # model = Sketchup.active_model
1170
- # view = model.active_view
1171
- # height = view.vpheight
1172
- #
1173
- # @return [Integer] the height of the viewport in physical pixels.
1174
- #
1175
- # @version SketchUp 6.0
1176
- def vpheight
1177
- end
1178
-
1179
- # The vpwidth method is used to retrieve the width of the viewport for the
1180
- # view.
1181
- #
1182
- # @example
1183
- # width = view.vpwidth
1184
- #
1185
- # @return [Integer] the width of the viewport in physical pixels.
1186
- #
1187
- # @version SketchUp 6.0
1188
- def vpwidth
1189
- end
1190
-
1191
- # The {#write_image} method is used to write the current view to an image file.
1192
- #
1193
- # Supported file types are `.png`, `.jpg`, `.jpeg`, `gif`, `.bmp`, `.tif`.
1194
- # For other file formats available from the GUI in File > Export > 2D
1195
- # Graphics, .e.g `.pdf`, use {Sketchup::Model#export}.
1196
- #
1197
- # compression = 1.0)
1198
- # @note Prefer the overload with option hash instead of this variant. This
1199
- # overload is not updated with new options.
1200
- #
1201
- # @example
1202
- # filename = File.join(Sketchup.temp_dir, 'example.png')
1203
- # antialias = false
1204
- # compression = 0.9
1205
- # model = Sketchup.active_model
1206
- # view = model.active_view
1207
- # view.write_image(filename, 640, 480, antialias, compression)
1208
- #
1209
- # @param [String] filename
1210
- # The filename for the saved image
1211
- # @param [Integer] width
1212
- # Width in pixels, defaults to the current viewport width {#vpwidth}.
1213
- # @param [Integer] height
1214
- # Height in pixels, defaults to the current viewport height {#vpheight}.
1215
- # @param [Boolean] antialias
1216
- # @param [Float] compression
1217
- # Compression factor for JPEG images, between +0.0+ and +1.0+.
1218
- #
1219
- # @overload write_image(filename, width = view.vpwidth, height = view.vpheight, antialias = false,
1220
- #
1221
- #
1222
- # @overload write_image(options)
1223
- #
1224
- # @example
1225
- # options = {
1226
- # :filename => File.join(Sketchup.temp_dir, 'example.png'),
1227
- # :width => 640,
1228
- # :height => 480,
1229
- # :antialias => false,
1230
- # :compression => 0.9,
1231
- # :transparent => true
1232
- # }
1233
- # model = Sketchup.active_model
1234
- # view = model.active_view
1235
- # view.write_image(options)
1236
- #
1237
- # @version SketchUp 7
1238
- # @param [Hash] options
1239
- # @option options [String] filename The filename for the saved image.
1240
- # @option options [Integer] width (#vpwidth) Width in pixels (max +16000+).
1241
- # @option options [Integer] height (#vpheight) Height in pixels (max +16000+).
1242
- # @option options [Float] scale_factor (1.0) Scaling factor for
1243
- # elements that are viewport dependent, such as text heights, arrow heads,
1244
- # line widths, stipple patterns, etc. (Added in SketchUp 2019.2)
1245
- # @option options [Boolean] antialias (false)
1246
- # @option options [Float] compression (1.0) Compression factor for JPEG,
1247
- # images between +0.0+ and +1.0+.
1248
- # @option options [Boolean] transparent (false) Added in SketchUp 8.
1249
- #
1250
- # @overload write_image(options)
1251
- #
1252
- # It is possible to dump the framebuffer to file by setting +:source+ to
1253
- # +:framebuffer+. When saving the framebuffer only the following options are
1254
- # valid.
1255
- #
1256
- # @example
1257
- # options = {
1258
- # :filename => File.join(Sketchup.temp_dir, 'example.png'),
1259
- # :source => :framebuffer,
1260
- # :compression => 0.9,
1261
- # }
1262
- # model = Sketchup.active_model
1263
- # view = model.active_view
1264
- # view.write_image(options)
1265
- #
1266
- # @version SketchUp 7
1267
- # @param [Hash] options
1268
- # @option options [String] filename The filename for the saved image.
1269
- # @option options [Boolean] source (:image) Set to +:framebuffer+ to dump the
1270
- # current framebuffer.
1271
- # @option options [Float] compression (1.0) Compression factor for JPEG,
1272
- # images between +0.0+ and +1.0+.
1273
- #
1274
- # @return [Boolean]
1275
- #
1276
- # @version SketchUp 6.0
1277
- def write_image(*args)
1278
- end
1279
-
1280
- # The zoom method is used to zoom in or out by some zoom factor.
1281
- #
1282
- # @example
1283
- # view = view.zoom factor
1284
- # view = view.zoom selection
1285
- # view = view.zoom entity
1286
- # view = view.zoom array_of_entities
1287
- #
1288
- # @param [Numeric, Sketchup::Selection, Sketchup::Entity, Array<Sketchup::Entity>] zoom_or_ents
1289
- # A Float zoom factor from 1.0 or larger or an Array or
1290
- # collection of entities to "zoom extents" around.
1291
- #
1292
- # @return [Sketchup::View] the zoomed View object
1293
- #
1294
- # @version SketchUp 6.0
1295
- def zoom(zoom_or_ents)
1296
- end
1297
-
1298
- # The zoom_extents method is used to zoom to the extents about the entire
1299
- # model, as if the user has selected the zoom extents command from the menu.
1300
- #
1301
- # @example
1302
- # view = Sketchup.active_model.active_view
1303
- # new_view = view.zoom_extents
1304
- #
1305
- # @return [Sketchup::View] the zoomed View object
1306
- #
1307
- # @version SketchUp 6.0
1308
- def zoom_extents
1309
- end
1310
-
1311
- end
1
+ # Copyright:: Copyright 2026 Trimble Inc.
2
+ # License:: The MIT License (MIT)
3
+
4
+ # This class contains methods to manipulate the current point of view of the
5
+ # model. The drawing methods here ({#draw_line}, {#draw_polyline}, etc) are
6
+ # meant to be invoked within a tool's {Sketchup::Tool#draw} method. Calling
7
+ # them outside {Sketchup::Tool#draw} will have no effect.
8
+ #
9
+ # You access the {Sketchup::View} by calling the {Sketchup::Model#active_view}
10
+ # method.
11
+ #
12
+ # @example
13
+ # view = Sketchup.active_model.active_view
14
+ #
15
+ # @version SketchUp 6.0
16
+ class Sketchup::View
17
+
18
+ # Constants
19
+
20
+ CORNER_BOTTOM_LEFT = nil # Stub value.
21
+ CORNER_BOTTOM_RIGHT = nil # Stub value.
22
+ CORNER_TOP_LEFT = nil # Stub value.
23
+ CORNER_TOP_RIGHT = nil # Stub value.
24
+
25
+ # Instance Methods
26
+
27
+ # The add_observer method is used to add an observer to the current object.
28
+ #
29
+ # @example
30
+ # view = Sketchup.active_model.active_view
31
+ # status = view.add_observer observer
32
+ #
33
+ # @param [Object] observer
34
+ # An observer.
35
+ #
36
+ # @return [Boolean] true if successful, false if unsuccessful.
37
+ #
38
+ # @version SketchUp 6.0
39
+ def add_observer(observer)
40
+ end
41
+
42
+ # The {#animation=} method is used to set an animation that is displayed for a
43
+ # view. See {Sketchup::Animation} for details on how to create an animation object.
44
+ #
45
+ # @example
46
+ # animation = ViewSpinner.new
47
+ # model = Sketchup.active_model
48
+ # view = model.active_view
49
+ # anim = view.animation = animation
50
+ #
51
+ # @param [#nextFrame] animation
52
+ #
53
+ # @version SketchUp 6.0
54
+ def animation=(animation)
55
+ end
56
+
57
+ # The average_refresh_time is used to set the average time used to refresh the
58
+ # current model in the view. This can be used to estimate the frame rate for
59
+ # an animation.
60
+ #
61
+ # @example
62
+ # model = Sketchup.active_model
63
+ # view = model.active_view
64
+ # time = view.average_refresh_time
65
+ #
66
+ # @return [Float] the time in seconds
67
+ #
68
+ # @version SketchUp 6.0
69
+ def average_refresh_time
70
+ end
71
+
72
+ # The camera method is used to retrieve the camera for the view.
73
+ #
74
+ # @example
75
+ # camera = view.camera
76
+ #
77
+ # @return [Sketchup::Camera] a Camera object
78
+ #
79
+ # @version SketchUp 6.0
80
+ def camera
81
+ end
82
+
83
+ # The {#camera=} method is used to set the camera for the view. If a transition
84
+ # time is given, then it will animate the transition from the current camera
85
+ # to the new one.
86
+ #
87
+ # @example
88
+ # camera = Sketchup::Camera.new([5, 5, 9], [5, 10, 0], Z_AXIS)
89
+ # view = Sketchup.active_model.active_view
90
+ # view.camera = camera
91
+ #
92
+ # @overload camera=(camera)
93
+ #
94
+ # @param [Sketchup::Camera] camera The new camera object.
95
+ #
96
+ # @overload camera=(camera_and_transition)
97
+ #
98
+ # @param [Array(Sketchup::Camera, Float)] camera_and_transition
99
+ # The second item in the array represents the transition time from the
100
+ # existing camera to the new one.
101
+ #
102
+ # @version SketchUp 6.0
103
+ def camera=(arg)
104
+ end
105
+
106
+ # The {#center} method is used to retrieve the coordinates of the center of the
107
+ # view in pixels.
108
+ #
109
+ # @example
110
+ # model = Sketchup.active_model
111
+ # view = model.active_view
112
+ # center = view.center
113
+ #
114
+ # @overload center()
115
+ #
116
+ # @note Signature for versions prior to SketchUp 2025.0
117
+ # @version SketchUp 6.0
118
+ # @return [Array(Integer, Integer)] Physical pixels.
119
+ #
120
+ # @overload center()
121
+ #
122
+ # @version SketchUp 2025.0
123
+ # @return [Array(Float, Float)] Logical pixels.
124
+ def center
125
+ end
126
+
127
+ # The {#corner} method is used to retrieve the coordinates of one of the corners
128
+ # of the view. The argument is an index between +0+ and +3+ that identifies which
129
+ # corner you want. This method returns an array with two integers which are
130
+ # the coordinates of the corner of the view in the view space.
131
+ #
132
+ # The indices are as follows:
133
+ # - 0: {CORNER_TOP_LEFT}
134
+ # - 1: {CORNER_TOP_RIGHT}
135
+ # - 2: {CORNER_BOTTOM_LEFT}
136
+ # - 3: {CORNER_BOTTOM_RIGHT}
137
+ #
138
+ # @example New preferred style using constants
139
+ # # From SketchUp 2025.0:
140
+ # point = Sketchup.active_model.active_view.corner(Sketchup::View::CORNER_BOTTOM_LEFT)
141
+ #
142
+ # @example Old style using hard coded indices
143
+ # # For SketchUp 2024.0 and older: (Works with newer versions too)
144
+ # point = Sketchup.active_model.active_view.corner(2)
145
+ #
146
+ # @note If the view uses a {Sketchup::Camera} with a fixed aspect ratio, then the
147
+ # corners are the corners of the viewing are of the camera which might be different
148
+ # than the actual corners of the view itself.
149
+ #
150
+ # @overload corner(index)
151
+ #
152
+ # @note Signature for versions prior to SketchUp 2025.0
153
+ # @version SketchUp 6.0
154
+ # @param [Integer] index
155
+ # A value between (or including) +0+ and +3+ identifying the
156
+ # corner whose coordinate you want to retrieve.
157
+ # @return [Array(Integer, Integer)] a 2D array +[x, y]+ representing the screen point in physical
158
+ # pixels.
159
+ #
160
+ # @overload corner(index)
161
+ #
162
+ # @version SketchUp 2025.0
163
+ # @param [Integer] index
164
+ # A value between (or including) +0+ and +3+ identifying the
165
+ # corner whose coordinate you want to retrieve.
166
+ # @return [Array(Float, Float)] a 2D array +[x, y]+ representing the screen point in logical
167
+ # pixels.
168
+ def corner(arg)
169
+ end
170
+
171
+ # The {#device_height} method is used to retrieve the height of the viewport for the
172
+ # view in physical pixels.
173
+ #
174
+ # @example
175
+ # model = Sketchup.active_model
176
+ # view = model.active_view
177
+ # height = view.device_height
178
+ #
179
+ # @return [Integer] the height of the viewport in physical pixels.
180
+ #
181
+ # @version SketchUp 2025.0
182
+ def device_height
183
+ end
184
+
185
+ # The {#device_width} method is used to retrieve the width of the viewport for the
186
+ # view in physical pixels.
187
+ #
188
+ # @example
189
+ # width = view.device_width
190
+ #
191
+ # @return [Integer] the width of the viewport in physical pixels.
192
+ #
193
+ # @version SketchUp 2025.0
194
+ def device_width
195
+ end
196
+
197
+ # The {#draw} method is used to do basic drawing. This method can only be
198
+ # called from within the {Tool#draw} method of a tool that you implement in
199
+ # Ruby.
200
+ #
201
+ # The following constants are all OpenGL terms and have been externalized to
202
+ # Ruby. Here is a summary of their meanings:
203
+ #
204
+ # [GL_POINTS]
205
+ # Treats each vertex as a single point. Vertex n defines point n. N
206
+ # points are drawn.
207
+ #
208
+ # [GL_LINES]
209
+ # Treats each pair of vertices as
210
+ # an independent line segment. Vertices 2n-1 and 2n define line n. N/2 lines
211
+ # are drawn.
212
+ #
213
+ # [GL_LINE_STRIP]
214
+ # Draws a connected group of line
215
+ # segments from the first vertex to the last. Vertices n and n+1 define
216
+ # line n. N-1 lines are drawn.
217
+ #
218
+ # [GL_LINE_LOOP]
219
+ # Draws a connected group of line segments from the first vertex to the last,
220
+ # then back to the first. Vertices n and n+1 define line n. The last line,
221
+ # however, is defined by vertices N and 1. N lines are drawn.
222
+ #
223
+ # [GL_TRIANGLES]
224
+ # Treats each triplet of vertices as an independent
225
+ # triangle. Vertices 3n-2, 3n-1, and 3n define triangle n. N/3 triangles are
226
+ # drawn.
227
+ #
228
+ # [GL_TRIANGLE_STRIP]
229
+ # Draws a connected group of triangles. One triangle is defined for each
230
+ # vertex presented after the first two vertices. For odd n, vertices n, n+1,
231
+ # and n+2 define triangle n. For even n, vertices n+1, n, and n+2 define
232
+ # triangle n. N-2 triangles are drawn.
233
+ #
234
+ # [GL_TRIANGLE_FAN]
235
+ # Draws a connected group of triangles.
236
+ # One triangle is defined for each vertex presented after the first two
237
+ # vertices. Vertices 1, n+1, and n+2 define triangle n. N-2 triangles are
238
+ # drawn.
239
+ #
240
+ # [GL_QUADS]
241
+ # Treats each group of four vertices as an
242
+ # independent quadrilateral. Vertices 4n-3, 4n-2, 4n-1, and 4n define
243
+ # quadrilateral n. N/4 quadrilaterals are drawn.
244
+ #
245
+ # [GL_QUAD_STRIP]
246
+ # Draws a connected group of quadrilaterals. One quadrilateral is
247
+ # defined for each pair of vertices presented after the first pair.
248
+ # Vertices 2n-1, 2n, 2n+2, and 2n+1 define quadrilateral n. N/2-1
249
+ # quadrilaterals are drawn. Note that the order in which vertices are used to
250
+ # construct a quadrilateral from strip data is different from that used with
251
+ # independent data.
252
+ #
253
+ # [GL_POLYGON]
254
+ # Draws a single, convex polygon. Vertices 1
255
+ # through N define this polygon.
256
+ #
257
+ # @example
258
+ # points = [
259
+ # Geom::Point3d.new(0, 0, 0),
260
+ # Geom::Point3d.new(9, 0, 0),
261
+ # Geom::Point3d.new(9, 9, 0),
262
+ # Geom::Point3d.new(0, 9, 0)
263
+ # ]
264
+ # view.draw(GL_LINE_LOOP, points)
265
+ #
266
+ # @note If you draw outside the model bounds you need to implement
267
+ # {Tool#getExtents} which returns a bounding box large enough to include the
268
+ # points you draw. Otherwise your drawing will be clipped.
269
+ #
270
+ # @overload draw(openglenum, points)
271
+ #
272
+ # @param [Integer] openglenum
273
+ # The item you are going to draw, one of the constants
274
+ # from the comments, such as +GL_LINES+.
275
+ # @param [Array<Geom::Point3d>] points
276
+ #
277
+ # @overload draw(openglenum, *points)
278
+ #
279
+ # @param [Integer] openglenum
280
+ # The item you are going to draw, one of the constants
281
+ # from the comments, such as +GL_LINES+.
282
+ # @param [Array<Geom::Point3d>] points
283
+ #
284
+ # @overload draw(openglenum, points, **options)
285
+ #
286
+ # @version SketchUp 2020.0
287
+ # @param [Integer] openglenum
288
+ # The item you are going to draw, one of the constants
289
+ # from the comments, such as +GL_LINES+.
290
+ # @param [Array<Geom::Point3d>] points
291
+ # @param [Hash] options
292
+ # @option options [Array<Geom::Vector3d>] :normals
293
+ # Without normals the polygons will be rendered with flat shading. No
294
+ # light will affect it. By providing an array of vertex normals lighting
295
+ # is turned on and will use the model's current light. Note that the number
296
+ # of normals must match the number of points provided.
297
+ # @option options [Integer] :texture
298
+ # A texture id provided by {#load_texture}.
299
+ # @option options [Array<Geom::Vector3d>] :uvs
300
+ # Set of UV (Not UVQ) coordinates matching the number of points provided.
301
+ # This must be used along with the +:texture+ option.
302
+ #
303
+ # @overload draw(openglenum, *points, **options)
304
+ #
305
+ # @version SketchUp 2020.0
306
+ # @param [Integer] openglenum
307
+ # The item you are going to draw, one of the constants
308
+ # from the comments, such as +GL_LINES+.
309
+ # @param [Array<Geom::Point3d>] points
310
+ # @param [Hash] options
311
+ # @option options [Array<Geom::Vector3d>] :normals ([])
312
+ # Without normals the polygons will be rendered with flat shading. No
313
+ # light will affect it. By providing an array of vertex normals lighting
314
+ # is turned on and will use the model's current light. Note that the number
315
+ # of normals must match the number of points provided.
316
+ # @option options [Integer] :texture
317
+ # A texture id provided by {#load_texture}.
318
+ # @option options [Array<Geom::Vector3d>] :uvs
319
+ # Set of UV (Not UVQ) coordinates matching the number of points provided.
320
+ # This must be used along with the +:texture+ option.
321
+ #
322
+ # @return [Sketchup::View]
323
+ #
324
+ # @see Tool#getExtents
325
+ #
326
+ # @version SketchUp 6.0
327
+ def draw(*args)
328
+ end
329
+
330
+ # The {#draw2d} method is used to draw in screen space (using 2D screen
331
+ # coordinates) instead of 3D space.
332
+ #
333
+ # The second parameter is an {Array} of {Geom::Point3d} objects (or several
334
+ # individual {Geom::Point3d} objects). These {Geom::Point3d} objects are in
335
+ # screen space, not 3D space.
336
+ #
337
+ # The X value corresponds to the number of pixels from the left edge of the
338
+ # drawing area. The Y value corresponds to the number of pixels down from
339
+ # the top of the drawing area. The Z value is not used.
340
+ #
341
+ # @example
342
+ # points = [
343
+ # Geom::Point3d.new(0, 0, 0),
344
+ # Geom::Point3d.new(8, 0, 0),
345
+ # Geom::Point3d.new(8, 4, 0),
346
+ # Geom::Point3d.new(0, 4, 0),
347
+ # ]
348
+ # view.draw2d(GL_LINE_STRIP, points)
349
+ #
350
+ # @note Prior to SketchUp 2025.0 this method accepted the +points+ as physical
351
+ # screen coordinates. As of SketchUp 2025.0 the +points+ are expected to be
352
+ # in logical screen coordinates. Older versions need to apply the scaling
353
+ # factor from {UI.scale_factor} to the points before passing them to this
354
+ # method.
355
+ #
356
+ # @overload draw2d(openglenum, points)
357
+ #
358
+ # @param [Integer] openglenum
359
+ # The item you are going to draw, one of the constants
360
+ # from the comments, such as +GL_LINES+.
361
+ # @param [Array<Geom::Point3d>] points
362
+ #
363
+ # @overload draw2d(openglenum, *points)
364
+ #
365
+ # @param [Integer] openglenum
366
+ # The item you are going to draw, one of the constants
367
+ # from the comments, such as +GL_LINES+.
368
+ # @param [Array<Geom::Point3d>] points
369
+ #
370
+ # @overload draw2d(openglenum, points, **options)
371
+ #
372
+ # @version SketchUp 2020.0
373
+ # @param [Integer] openglenum
374
+ # The item you are going to draw, one of the constants
375
+ # from the comments, such as +GL_LINES+.
376
+ # @param [Array<Geom::Point3d>] points
377
+ # @param [Hash] options
378
+ # @option options [Integer] :texture
379
+ # A texture id provided by {#load_texture}.
380
+ # @option options [Array<Geom::Vector3d>] :uvs
381
+ # Set of UV (Not UVQ) coordinates matching the number of points provided.
382
+ # This must be used along with the +:texture+ option.
383
+ #
384
+ # @overload draw2d(openglenum, *points, **options)
385
+ #
386
+ # @version SketchUp 2020.0
387
+ # @param [Integer] openglenum
388
+ # The item you are going to draw, one of the constants
389
+ # from the comments, such as +GL_LINES+.
390
+ # @param [Array<Geom::Point3d>] points
391
+ # @param [Hash] options
392
+ # @option options [Integer] :texture
393
+ # A texture id provided by {#load_texture}.
394
+ # @option options [Array<Geom::Vector3d>] :uvs
395
+ # Set of UV (Not UVQ) coordinates matching the number of points provided.
396
+ # This must be used along with the +:texture+ option.
397
+ #
398
+ # @return [Sketchup::View]
399
+ #
400
+ # @see #draw
401
+ #
402
+ # @see UI.scale_factor
403
+ #
404
+ # @version SketchUp 6.0
405
+ def draw2d(*args)
406
+ end
407
+
408
+ # The draw_lines method is used to draw disconnected lines.
409
+ #
410
+ # You must have an even number of points. This method is usually invoked
411
+ # within the draw method of a tool.
412
+ #
413
+ # @example
414
+ # point4 = Geom::Point3d.new 0,0,0
415
+ # point5 = Geom::Point3d.new 100,100,100
416
+ # # returns a view
417
+ # status = view.drawing_color="red"
418
+ # status = view.draw_lines point4, point5
419
+ #
420
+ # @overload draw_lines(points, ...)
421
+ #
422
+ # @param [Array<Geom::Point3d>] points
423
+ # An even number of Point3d objects.
424
+ # @return [Sketchup::View]
425
+ #
426
+ # @overload draw_lines(points)
427
+ #
428
+ # @param [Array<Geom::Point3d>] points An array of Point3d objects.
429
+ # @return [Sketchup::View]
430
+ #
431
+ # @version SketchUp 6.0
432
+ def draw_line(*args)
433
+ end
434
+
435
+ # The draw_lines method is used to draw disconnected lines.
436
+ #
437
+ # You must have an even number of points. This method is usually invoked
438
+ # within the draw method of a tool.
439
+ #
440
+ # @example
441
+ # point4 = Geom::Point3d.new 0,0,0
442
+ # point5 = Geom::Point3d.new 100,100,100
443
+ # # returns a view
444
+ # status = view.drawing_color="red"
445
+ # status = view.draw_lines point4, point5
446
+ #
447
+ # @overload draw_lines(points, ...)
448
+ #
449
+ # @param [Array<Geom::Point3d>] points
450
+ # An even number of Point3d objects.
451
+ # @return [Sketchup::View]
452
+ #
453
+ # @overload draw_lines(points)
454
+ #
455
+ # @param [Array<Geom::Point3d>] points An array of Point3d objects.
456
+ # @return [Sketchup::View]
457
+ #
458
+ # @version SketchUp 6.0
459
+ def draw_lines(*args)
460
+ end
461
+
462
+ # This method is used to draw points in model space.
463
+ #
464
+ # @example
465
+ # point = Geom::Point3d.new(0, 0, 0)
466
+ # view.draw_points(point, 10, 1, "red")
467
+ #
468
+ # @note Prior to SketchUp 2025.0 this method accepted the +size+ as physical
469
+ # pixels. As of SketchUp 2025.0 the +points+ are expected to be in logical pixels.
470
+ # Older versions need to apply the scaling factor from {UI.scale_factor} to the
471
+ # size before passing them to this method.
472
+ #
473
+ # @param [Array<Geom::Point3d>] points
474
+ # Model coordinates.
475
+ #
476
+ # @param [Integer] size
477
+ # Size of the point in pixels.
478
+ #
479
+ # @param [Integer] style
480
+ # - +1+ = open square
481
+ # - +2+ = filled square
482
+ # - +3+ = plus shape "+"
483
+ # - +4+ = cross shape "X"
484
+ # - +5+ = star shape "*"
485
+ # - +6+ = open triangle
486
+ # - +7+ = filled triangle
487
+ #
488
+ # @param [Sketchup::Color] color
489
+ #
490
+ # @return [Sketchup::View] a View object
491
+ #
492
+ # @version SketchUp 6.0
493
+ def draw_points(points, size = 6, style = 3, color = 'black')
494
+ end
495
+
496
+ # The draw_polyline method is used to draw a series of connected line segments
497
+ # from pt1 to pt2 to pt3, and so on.
498
+ #
499
+ # This method is usually invoked within the draw method of a tool.
500
+ #
501
+ # @example
502
+ # point12 = Geom::Point3d.new 0,0,0
503
+ # point13 = Geom::Point3d.new 10,10,10
504
+ # point14 = Geom::Point3d.new 20,20,20
505
+ # point15 = Geom::Point3d.new 30,30,30
506
+ # status = view.draw_polyline point12, point13, point14, point15
507
+ #
508
+ # @overload draw_polyline(points, ...)
509
+ #
510
+ # @param [Array<Geom::Point3d>] points An even number of Point3d objects.
511
+ # @return [Sketchup::View]
512
+ #
513
+ # @overload draw_polyline(points)
514
+ #
515
+ # @param [Array<Geom::Point3d>] points An array of Point3d objects.
516
+ # @return [Sketchup::View]
517
+ #
518
+ # @version SketchUp 6.0
519
+ def draw_polyline(*args)
520
+ end
521
+
522
+ # This method is used to draw text on the screen and is usually invoked within
523
+ # the draw method of a tool.
524
+ #
525
+ # The {TextVerticalAlignCenter} option will align the text to the center of the
526
+ # height of the first line, not the whole boundingbox of the text. To align
527
+ # around the full bounds of the text, use {#text_bounds} to compute the
528
+ # desired alignment.
529
+ #
530
+ # The vertical alignment can vary between fonts and platforms. It's recommended
531
+ # to test different fonts and find one that fits well across both platforms
532
+ # for your purposes.
533
+ #
534
+ # <b>Example of different vertical alignment and text bounds:</b>
535
+ #
536
+ # rdoc-image:../images/view-draw-text-with-bounds.png
537
+ #
538
+ # @bug Prior to SU2022.0, on macOS, the vertical text alignment for some fonts
539
+ # could appear to be offset from their expected positions. As of SU2022.0 the
540
+ # vertical alignment should be more accurate and consistent.
541
+ #
542
+ # @example
543
+ # class ExampleTool
544
+ # def draw(view)
545
+ # # This works in all SketchUp versions and draws the text using the
546
+ # # default font, size and color (i.e. the model edge color).
547
+ # point = Geom::Point3d.new(200, 100, 0)
548
+ # view.draw_text(point, "This is a test")
549
+ #
550
+ # # This works in SketchUp 2016 and up.
551
+ # options = {
552
+ # :font => "Arial",
553
+ # :size => 20,
554
+ # :bold => true,
555
+ # :align => TextAlignRight
556
+ # }
557
+ # point = Geom::Point3d.new(200, 200, 0)
558
+ # view.draw_text(point, "This is another\ntest", options)
559
+ #
560
+ # # You can also use Ruby 2.0's named arguments:
561
+ # point = Geom::Point3d.new(200, 200, 0)
562
+ # view.draw_text(point, "Hello world!", color: "Red")
563
+ # end
564
+ # end
565
+ #
566
+ # @example Cross Platform Font Size in SketchUp 2025.0 and newer
567
+ # class ExampleTool
568
+ # def draw(view)
569
+ # draw_text(view, [100, 200, 0], "Hello Pixel World", pixel_size: 20)
570
+ # draw_text(view, [100, 250, 0], "Hello Point World", point_size: 20)
571
+ # end
572
+ # end
573
+ #
574
+ # @example Cross Platform Font Size in SketchUp 2024.0 and older
575
+ # class ExampleTool
576
+ # IS_WIN = Sketchup.platform == :platform_win
577
+ #
578
+ # def draw(view)
579
+ # draw_text(view, [100, 200, 0], "Hello World", size: 20)
580
+ # end
581
+ #
582
+ # private
583
+ #
584
+ # # This will ensure text is drawn with consistent size across platforms,
585
+ # # using pixels as size units.
586
+ # def draw_text(view, position, text, **options)
587
+ # native_options = options.dup
588
+ # if IS_WIN && options.key?(:size)
589
+ # native_options[:size] = pixels_to_points(options[:size])
590
+ # end
591
+ # view.draw_text(position, text, **native_options)
592
+ # end
593
+ #
594
+ # def pixels_to_points(pixels)
595
+ # ((pixels.to_f / 96.0) * 72.0).round
596
+ # end
597
+ # end
598
+ #
599
+ # @note Under Windows the font name must be less than 32 characters - due to
600
+ # system limitations.
601
+ #
602
+ # @note As of SU2017 this will automatically scale the font-size by the same
603
+ # factor as {UI.scale_factor}.
604
+ #
605
+ # @note The font size is platform dependent. On Windows the method expects
606
+ # points, where on Mac it's pixels. See "Cross Platform Font Size" example
607
+ # for details. As of SketchUp 2025.0 you can use the +:pixel_size+ or
608
+ # +:point_size+ options to specify the size in pixels or points respectively.
609
+ #
610
+ # @overload draw_text(point, text)
611
+ #
612
+ # @param [Geom::Point3d] point A Point3d object representing a 2D coordinate
613
+ # in view space.
614
+ # @param [String] text The text string to draw.
615
+ #
616
+ # @overload draw_text(point, text, options = {})
617
+ #
618
+ # @version SketchUp 2016
619
+ # @param [Geom::Point3d] point A Point3d object representing a 2D coordinate
620
+ # in view space.
621
+ # @param [String] text The text string to draw.
622
+ # @param [Hash] options The text can be customized by providing a hash or
623
+ # named arguments of options.
624
+ # @option options [String] :font The name of the font to use. If it does not
625
+ # exist on the system, a default font will be used instead.
626
+ # @option options [Integer] :size <b>Legacy</b>: The size of the font in
627
+ # system-dependent units. On Windows this is in points, on Mac it's in
628
+ # pixels.
629
+ # @option options [Integer] :pixel_size <b>Added SketchUp 2025.0</b>: The
630
+ # size of the font in pixels.
631
+ # @option options [Integer] :point_size <b>Added SketchUp 2025.0</b>: The
632
+ # size of the font in points.
633
+ # @option options [Boolean] :bold Controls the Bold property of the font.
634
+ # @option options [Boolean] :italic Controls the Italic property of the font.
635
+ # @option options [Sketchup::Color] :color The color to draw the text with.
636
+ # @option options [Integer] :align The text alignment, one of the following
637
+ # constants: {TextAlignLeft}, {TextAlignCenter} or {TextAlignRight}.
638
+ # @option options [Integer] :vertical_align <b>Added SketchUp 2020.0.</b>
639
+ # The vertical text alignment, one of the following constants:
640
+ # {TextVerticalAlignBoundsTop}, {TextVerticalAlignBaseline},
641
+ # {TextVerticalAlignCapHeight} or {TextVerticalAlignCenter}. Note that
642
+ # some fonts on Mac might not align as expected due to the system
643
+ # reporting incorrect font metrics.
644
+ #
645
+ # @raise [ArgumentError] if combining usage of +:size+, +:pixel_size+ or
646
+ # +:point_size+ options.
647
+ #
648
+ # @return [Sketchup::View]
649
+ #
650
+ # @see #text_bounds
651
+ #
652
+ # @version SketchUp 6.0
653
+ def draw_text(*args)
654
+ end
655
+
656
+ # The drawing_color method is used to set the color that is used for drawing
657
+ # to the view.
658
+ #
659
+ # This method is usually invoked within the draw method of a tool.
660
+ #
661
+ # @example
662
+ # view = view.drawing_color = color
663
+ #
664
+ # @param [Sketchup::Color, String] color
665
+ # A Color object.
666
+ #
667
+ # @return [Sketchup::View]
668
+ #
669
+ # @version SketchUp 6.0
670
+ def drawing_color=(color)
671
+ end
672
+
673
+ # The dynamic= method allows you to degrade visual quality while improving
674
+ # performance when a model is large and view refresh time is slow. For
675
+ # example, if you were using a Ruby script to animate the camera through
676
+ # a large scene, you may want to set dynamic to true during that time.
677
+ #
678
+ # See also camera.rb which is part of the film and stage ruby
679
+ # scripts.
680
+ #
681
+ # @deprecated This method is no longer doing anything.
682
+ #
683
+ # @example
684
+ # view.dynamic = true
685
+ #
686
+ # @param [Boolean] value
687
+ #
688
+ # @return [Boolean]
689
+ #
690
+ # @version SketchUp 6.0
691
+ def dynamic=(value)
692
+ end
693
+
694
+ # The field_of_view method is used get the view's field of view setting, in
695
+ # degrees.
696
+ #
697
+ # @example
698
+ # fov = Sketchup.active_model.active_view.field_of_view
699
+ #
700
+ # @return [Float] the field of view
701
+ #
702
+ # @version SketchUp 6.0
703
+ def field_of_view
704
+ end
705
+
706
+ # The field_of_view= method is used set the view's field of view setting,
707
+ # in degrees.
708
+ #
709
+ # @example
710
+ # my_view = Sketchup.active_model.active_view
711
+ # my_view.field_of_view = 45
712
+ # my_view.invalidate
713
+ #
714
+ # @param [Numeric] fov
715
+ # the field of view
716
+ #
717
+ # @return [Numeric]
718
+ #
719
+ # @version SketchUp 6.0
720
+ def field_of_view=(fov)
721
+ end
722
+
723
+ # The {#graphics_engine} method is used query the type of the graphics engine that's currently
724
+ # used by this view.
725
+ #
726
+ # @example
727
+ # engine = Sketchup.active_model.active_view.graphics_engine
728
+ # if engine == :graphics_engine_classic
729
+ # puts 'Classic graphics engine'
730
+ # elsif engine == :graphics_engine_2024
731
+ # puts 'New graphics engine'
732
+ # end
733
+ #
734
+ # @return [Symbol] Type of the graphics engine.
735
+ # +:graphics_engine_classic+ or +:graphics_engine_2024+
736
+ #
737
+ # @version SketchUp 2024.0
738
+ def graphics_engine
739
+ end
740
+
741
+ # The guess_target method is used to guess at what the user is looking at when
742
+ # you have a perspective view.
743
+ #
744
+ # @example
745
+ # target = view.guess_target
746
+ #
747
+ # @overload guess_target
748
+ #
749
+ #
750
+ # @overload guess_target(screen_point)
751
+ #
752
+ # @param [Geom::Point3d] screen_point
753
+ #
754
+ # @return [Geom::Point3d] a Point3d object representing the point in the
755
+ # model that the user is likely interested in.
756
+ #
757
+ # @version SketchUp 6.0
758
+ def guess_target(*args)
759
+ end
760
+
761
+ # The inference_locked? method is used to determine if inference locking is on
762
+ # for the view.
763
+ #
764
+ # @example
765
+ # model = Sketchup.active_model
766
+ # view = model.active_view
767
+ # status = view.inference_locked
768
+ #
769
+ # @return [Boolean]
770
+ #
771
+ # @version SketchUp 6.0
772
+ def inference_locked?
773
+ end
774
+
775
+ # The {#inputpoint} method is used to retrieve an {Sketchup::InputPoint}.
776
+ #
777
+ # This will normally be used inside one of the mouse event handling methods in
778
+ # a tool. Usually, it is preferable to create the {Sketchup::InputPoint} first
779
+ # and then use the pick method on it.
780
+ #
781
+ # @example
782
+ # class ExampleTool
783
+ # def onMouseMove(flags, x, y, view)
784
+ # inputpoint = view.inputpoint(x, y)
785
+ # instance_path = ip.instance_path
786
+ # end
787
+ # end
788
+ #
789
+ # @example Inference from another input point
790
+ # class ExampleTool
791
+ #
792
+ # def onLButtonUp(flags, x, y, view)
793
+ # @picked_input = view.inputpoint(x, y)
794
+ # end
795
+ #
796
+ # def onMouseMove(flags, x, y, view)
797
+ # # Note: It is preferrable to initialize input points using
798
+ # # Sketchup::InputPoint.new in `initialize` and reuse them doing the
799
+ # # picking using the `pick` method.
800
+ # if @inputpoint
801
+ # @inputpoint = view.inputpoint(x, y, @picked_input)
802
+ # else
803
+ # @inputpoint = view.inputpoint(x, y)
804
+ # end
805
+ # end
806
+ #
807
+ # def draw(view)
808
+ # if @inputpoint
809
+ # @inputpoint.draw(view) if @inputpoint.display?
810
+ # else
811
+ # @picked_input.draw(view) if @picked_input.display?
812
+ # end
813
+ # end
814
+ # end
815
+ #
816
+ # @overload inputpoint(x, y)
817
+ #
818
+ # @note Signature for versions prior to SketchUp 2025.0
819
+ # @version SketchUp 6.0
820
+ # @param [Integer] x Screen coordinate in physical pixels.
821
+ # @param [Integer] y Screen coordinate in physical pixels.
822
+ #
823
+ # @overload inputpoint(x, y, inputpoint1)
824
+ #
825
+ # @note Signature for versions prior to SketchUp 2025.0
826
+ # @version SketchUp 6.0
827
+ # @param [Integer] x Screen coordinate in physical pixels.
828
+ # @param [Integer] y Screen coordinate in physical pixels.
829
+ # @param [Sketchup::InputPoint] inputpoint1
830
+ #
831
+ # @overload inputpoint(x, y)
832
+ #
833
+ # @version SketchUp 2025.0
834
+ # @param [Float] x Screen coordinate in logical pixels.
835
+ # @param [Float] y Screen coordinate in logical pixels.
836
+ #
837
+ # @overload inputpoint(x, y, inputpoint1)
838
+ #
839
+ # @version SketchUp 2025.0
840
+ # @param [Float] x Screen coordinate in logical pixels.
841
+ # @param [Float] y Screen coordinate in logical pixels.
842
+ # @param [Sketchup::InputPoint] inputpoint1
843
+ #
844
+ # @return [Sketchup::InputPoint]
845
+ def inputpoint(*args)
846
+ end
847
+
848
+ # The invalidate method is used mark the view as in need of a redraw.
849
+ #
850
+ # @example
851
+ # model = Sketchup.active_model
852
+ # view = model.active_view
853
+ # invalidated_view = view.invalidate
854
+ #
855
+ # @note This is the preferred method to update the viewport. Use this before
856
+ # trying to use {#refresh}.
857
+ #
858
+ # @return [Sketchup::View] the invalidated View object
859
+ #
860
+ # @version SketchUp 6.0
861
+ def invalidate
862
+ end
863
+
864
+ # The last_refresh_time method is used to retrieve the time for the last full
865
+ # view refresh.
866
+ #
867
+ # @example
868
+ # time = view.last_refresh_time
869
+ #
870
+ # @overload last_refresh_time
871
+ #
872
+ #
873
+ # @overload last_refresh_time(full)
874
+ #
875
+ # @param [Boolean] full
876
+ #
877
+ # @return [Float] time in milliseconds
878
+ #
879
+ # @version SketchUp 6.0
880
+ def last_refresh_time(*args)
881
+ end
882
+
883
+ # The line_stipple= method is used to set the line pattern to use for drawing.
884
+ # The stipple pattern is given as a string.
885
+ # Valid strings are:
886
+ # "." (Dotted Line),
887
+ # "-" (Short Dashes Line),
888
+ # "_" (Long Dashes Line),
889
+ # "-.-" (Dash Dot Dash Line),
890
+ # "" (Solid Line).
891
+ #
892
+ # This method is usually invoked within the draw method of a tool.
893
+ #
894
+ # @example
895
+ # point8 = Geom::Point3d.new 0,0,0
896
+ # point9 = Geom::Point3d.new 100,100,100
897
+ # view.line_stipple = "-.-"
898
+ # view = view.draw_lines point8, point9
899
+ #
900
+ # @param [String] pattern
901
+ # A string stipple pattern, such as "-.-"
902
+ #
903
+ # @return [Sketchup::View] the View object
904
+ #
905
+ # @version SketchUp 6.0
906
+ def line_stipple=(pattern)
907
+ end
908
+
909
+ # The line_width= method is used to set the line width to use for drawing. The
910
+ # value is a Double indicating the desired width in pixels.
911
+ #
912
+ # This method is usually invoked within the draw method of a tool.
913
+ #
914
+ # @example
915
+ # view.line_width = width
916
+ #
917
+ # @note As of SU2017 this will automatically scale the line width by the same
918
+ # factor as {UI.scale_factor}.
919
+ #
920
+ # @note As of Sketchup 2026.0 positive values will be clamped to a minimum of 1.0.
921
+ #
922
+ # @param [Numeric] width
923
+ # The width in pixels.
924
+ #
925
+ # @raise [ArgumentError] if the width is negative.
926
+ #
927
+ # @return [Numeric]
928
+ #
929
+ # @version SketchUp 6.0
930
+ def line_width=(width)
931
+ end
932
+
933
+ # Loads a texture to be drawn with {#draw} or {#draw2d}.
934
+ #
935
+ # @example
936
+ # module Example
937
+ # class MyTool
938
+ # def activate
939
+ # view = Sketchup.active_model.active_view
940
+ # image_rep = view.model.materials.current.texture.image_rep
941
+ # @texture_id = view.load_texture(image_rep)
942
+ # end
943
+ #
944
+ # def deactivate(view)
945
+ # view.release_texture(@texture_id)
946
+ # end
947
+ #
948
+ # def draw(view)
949
+ # points = [ [0, 0, 0], [9, 0, 0], [9, 9, 0], [0, 9, 0] ]
950
+ # uvs = [ [0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0] ]
951
+ # view.draw(GL_QUADS, points, texture: @texture_id, uvs: uvs)
952
+ # end
953
+ # end
954
+ # end
955
+ # Sketchup.active_model.select_tool(Example::MyTool.new)
956
+ #
957
+ # @note Avoid loading and releasing textures within the {Sketchup::Tool#draw}
958
+ # event as that is not efficient.
959
+ #
960
+ # @note SketchUp 2020.0-2022.0: To conserve resources on the user's machine,
961
+ # textures can be loaded only when there is a Ruby tool on the tool stack.
962
+ # Make sure to release the texture when it's no longer needed. Any textures
963
+ # not already released when the last Ruby tool on the tool stack is removed
964
+ # will be automatically released by SketchUp. As of SketchUp 2023.0 this
965
+ # automatic cleanup was removed to allow Overlays to draw textures.
966
+ #
967
+ # @param [Sketchup::ImageRep] image_rep
968
+ #
969
+ # @raise [ArgumentError] if the provided {Sketchup::ImageRep} is not valid.
970
+ #
971
+ # @raise [RuntimeError] if a Ruby tool was not on the tool stack.
972
+ # (Applies to SketchUp 2020.0-2022.0).
973
+ #
974
+ # @return [Integer] A resource ID referring to the image loaded.
975
+ #
976
+ # @see #release_texture
977
+ #
978
+ # @see #draw
979
+ #
980
+ # @version SketchUp 2020.0
981
+ def load_texture(image_rep)
982
+ end
983
+
984
+ # The {#lock_inference} method is used to lock or unlock an inference.
985
+ #
986
+ # This method will typically be called from inside a tool class when the user
987
+ # presses the shift key or arrow keys.
988
+ #
989
+ # With no arguments it unlocks all inferences. With one argument it locks
990
+ # inference based on that passed {Sketchup::InputPoint}'s entities, e.g. along
991
+ # a {Sketchup::Edge}'s line or a {Sketchup::Face}'s plane. With two arguments,
992
+ # it locks inference along an axis.
993
+ #
994
+ # @example
995
+ # view = view.lock_inference
996
+ # view = view.lock_inference(inputpoint)
997
+ # view = view.lock_inference(inputpoint1, inputpoint2)
998
+ #
999
+ # @overload lock_inference
1000
+ #
1001
+ #
1002
+ # @overload lock_inference(inputpoint)
1003
+ #
1004
+ # @param [Sketchup::InputPoint] inputpoint
1005
+ #
1006
+ # @overload lock_inference(inputpoint, inputpoint2)
1007
+ #
1008
+ # @param [Sketchup::InputPoint] inputpoint
1009
+ # @param [Sketchup::InputPoint] inputpoint2
1010
+ # @example
1011
+ # # Lock inference to X axis.
1012
+ # # The points define a line in space, and the inference is locked to this line.
1013
+ # view.lock_inference(
1014
+ # Sketchup::InputPoint.new(ORIGIN),
1015
+ # Sketchup::InputPoint.new(Geom::Point3d.new(1, 0, 0))
1016
+ # )
1017
+ #
1018
+ # @return [Sketchup::View] a View object
1019
+ #
1020
+ # @version SketchUp 6.0
1021
+ def lock_inference(*args)
1022
+ end
1023
+
1024
+ # The model method is used to retrieve the model for the current view.
1025
+ #
1026
+ # @example
1027
+ # model = view.model
1028
+ #
1029
+ # @return [Sketchup::Model] the model for this view
1030
+ #
1031
+ # @version SketchUp 6.0
1032
+ def model
1033
+ end
1034
+
1035
+ # The {#pick_helper} method is used to retrieve a pick helper for the view.
1036
+ #
1037
+ # @example
1038
+ # model = Sketchup.active_model
1039
+ # view = model.active_view
1040
+ # ph = view.pick_helper
1041
+ #
1042
+ # @overload pick_helper
1043
+ #
1044
+ # @return [Sketchup::PickHelper]
1045
+ #
1046
+ # @overload pick_helper(x, y, aperture = 0)
1047
+ #
1048
+ # @note Signature for versions prior to SketchUp 2025.0
1049
+ # @version SketchUp 6.0
1050
+ # @param [Integer] x Screen coordinate in physical pixels.
1051
+ # @param [Integer] y Screen coordinate in physical pixels.
1052
+ # @param [Integer] aperture The size of the aperture in physical pixels.
1053
+ # @return [Sketchup::PickHelper]
1054
+ #
1055
+ # @overload pick_helper(x, y, aperture = 0.0)
1056
+ #
1057
+ # @version SketchUp 2025.0
1058
+ # @param [Float] x Screen coordinate in logical pixels.
1059
+ # @param [Float] y Screen coordinate in logical pixels.
1060
+ # @param [Float] aperture The size of the aperture in logical pixels.
1061
+ # @return [Sketchup::PickHelper]
1062
+ #
1063
+ # @see Sketchup::PickHelper
1064
+ #
1065
+ # @version SketchUp 6.0
1066
+ def pick_helper(*args)
1067
+ end
1068
+
1069
+ # The {#pickray} method is used to retrieve a ray passing through a given screen
1070
+ # position in the viewing direction.
1071
+ #
1072
+ # @example
1073
+ # ray = view.pickray(x, y)
1074
+ # result = model.raytest(ray)
1075
+ #
1076
+ # @overload pickray(screen_point)
1077
+ #
1078
+ # @note Signature for versions prior to SketchUp 2025.0
1079
+ # @version SketchUp 6.0
1080
+ # @param [Array(Integer, Integer)] screen_point
1081
+ # Screen coordinates in physical pixels.
1082
+ # @return [Array(Geom::Point3d, Geom::Vector3d)] a ray
1083
+ #
1084
+ # @overload pickray(x, y)
1085
+ #
1086
+ # @note Signature for versions prior to SketchUp 2025.0
1087
+ # @version SketchUp 6.0
1088
+ # @param [Integer] x Screen coordinate in physical pixels.
1089
+ # @param [Integer] y Screen coordinate in physical pixels.
1090
+ # @return [Array(Geom::Point3d, Geom::Vector3d)] a ray
1091
+ #
1092
+ # @overload pickray(screen_point)
1093
+ #
1094
+ # @version SketchUp 2025.0
1095
+ # @param [Array(Float, Float)] screen_point
1096
+ # Screen coordinates in logical pixels.
1097
+ # @return [Array(Geom::Point3d, Geom::Vector3d)] a ray
1098
+ #
1099
+ # @overload pickray(x, y)
1100
+ #
1101
+ # @version SketchUp 2025.0
1102
+ # @param [Float] x Screen coordinate in logical pixels.
1103
+ # @param [Float] y Screen coordinate in logical pixels.
1104
+ # @return [Array(Geom::Point3d, Geom::Vector3d)] a ray
1105
+ #
1106
+ # @see Sketchup::Model#raytest
1107
+ #
1108
+ # @version SketchUp 6.0
1109
+ def pickray(*args)
1110
+ end
1111
+
1112
+ # The {#pixels_to_model} method is used to compute a model size from a pixel size
1113
+ # at a given point.
1114
+ #
1115
+ # This method is useful for deciding how big to draw something based on a
1116
+ # desired size in pixels.
1117
+ #
1118
+ # @example
1119
+ # size = view.pixels_to_model(pixels, point)
1120
+ #
1121
+ # @note As of SU2017 this will automatically scale the pixel-size by the same
1122
+ # factor as {UI.scale_factor}.
1123
+ #
1124
+ # @param [Numeric] pixels
1125
+ # Logical pixels since SketchUp 2017.
1126
+ #
1127
+ # @param [Geom::Point3d] point
1128
+ # A model point where the size will be calculated from.
1129
+ #
1130
+ # @return [Float] the model size
1131
+ #
1132
+ # @version SketchUp 6.0
1133
+ def pixels_to_model(pixels, point)
1134
+ end
1135
+
1136
+ # The refresh method is used to immediately force a redraw of the view.
1137
+ #
1138
+ # @example
1139
+ # model = Sketchup.active_model
1140
+ # view = model.active_view
1141
+ # refreshed_view = view.refresh
1142
+ #
1143
+ # @note This method might impact performance and if used incorrectly cause
1144
+ # instability or crashes. Don't use this unless you have verified that
1145
+ # you cannot use {#invalidate} instead.
1146
+ #
1147
+ # @return [Sketchup::View] the refreshed View object
1148
+ #
1149
+ # @version SketchUp 7.1
1150
+ def refresh
1151
+ end
1152
+
1153
+ # Releases a texture loaded via {#load_texture}, freeing up it's memory.
1154
+ # It's good practice to do so whenever there is no longer any need for the
1155
+ # resource.
1156
+ #
1157
+ # For example, when your tool deactivates you probably want to release your
1158
+ # resources as you don't know if your tool will be used again.
1159
+ #
1160
+ # @example
1161
+ # module Example
1162
+ # class MyTool
1163
+ # def activate
1164
+ # view = Sketchup.active_model.active_view
1165
+ # image_rep = view.model.materials.current.texture.image_rep
1166
+ # @texture_id = view.load_texture(image_rep)
1167
+ # end
1168
+ #
1169
+ # def deactivate(view)
1170
+ # view.release_texture(@texture_id)
1171
+ # end
1172
+ #
1173
+ # def draw(view)
1174
+ # points = [ [0, 0, 0], [9, 0, 0], [9, 9, 0], [0, 9, 0] ]
1175
+ # uvs = [ [0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0] ]
1176
+ # view.draw(GL_QUADS, points, texture: @texture_id, uvs: uvs)
1177
+ # end
1178
+ # end
1179
+ # end
1180
+ # Sketchup.active_model.select_tool(Example::MyTool.new)
1181
+ #
1182
+ # @param [Integer] texture_id
1183
+ #
1184
+ # @return [Boolean] +true+ if texture was released. +false+ otherwise.
1185
+ #
1186
+ # @see #load_texture
1187
+ def release_texture(texture_id)
1188
+ end
1189
+
1190
+ # The remove_observer method is used to remove an observer from the current
1191
+ # object.
1192
+ #
1193
+ # @example
1194
+ # view = Sketchup.active_model.active_view
1195
+ # status = view.remove_observer observer
1196
+ #
1197
+ # @param [Object] observer
1198
+ # An observer.
1199
+ #
1200
+ # @return [Boolean] true if successful, false if unsuccessful.
1201
+ #
1202
+ # @version SketchUp 6.0
1203
+ def remove_observer(observer)
1204
+ end
1205
+
1206
+ # The {#screen_coords} method is used to retrieve the screen coordinates of the
1207
+ # given point on the screen.
1208
+ #
1209
+ # The +x+ and +y+ values returned correspond to the +x+ and +y+ screen coordinates.
1210
+ # Ignore the +z+ values. If the referenced point is not in the current
1211
+ # viewport, the +x+ and/or +y+ value may be negative.
1212
+ #
1213
+ # @example
1214
+ # view = Sketchup.active_model.active_view
1215
+ # point = view.screen_coords(ORIGIN)
1216
+ #
1217
+ # @note Prior to SketchUp 2025.0 this method returned the points as physical
1218
+ # screen coordinates. As of SketchUp 2025.0 the points are returned in
1219
+ # logical screen coordinates.
1220
+ #
1221
+ # @overload screen_coords(model_point)
1222
+ #
1223
+ # @note Signature for versions prior to SketchUp 2025.0
1224
+ # @version SketchUp 6.0
1225
+ # @param [Geom::Point3d] model_point Model coordinate.
1226
+ #
1227
+ # @overload screen_coords(model_point)
1228
+ #
1229
+ # @version SketchUp 2025.0
1230
+ # @param [Geom::Point3d] model_point Model coordinate.
1231
+ #
1232
+ # @return [Geom::Point3d] Screen coordinate in pixels (physical prior to SketchUp 2025.0, logical
1233
+ # from 2025.0).
1234
+ #
1235
+ # @version SketchUp 6.0
1236
+ def screen_coords(model_point)
1237
+ end
1238
+
1239
+ # Set the drawing color for the view based on the direction of a line that you
1240
+ # want to draw. These colors will match the axes colors in the SketchUp model
1241
+ # (typically blue for straight up and down, etc.)
1242
+ #
1243
+ # This method is usually invoked within the draw method of a tool.
1244
+ #
1245
+ # @example
1246
+ # view = view.set_color_from_line point1, point2
1247
+ #
1248
+ # @param [Geom::Point3d] point1
1249
+ # Point3d object representing first point in the line.
1250
+ #
1251
+ # @param [Geom::Point3d] point2
1252
+ # Point3d object representing the second point in the line.
1253
+ #
1254
+ # @return [Sketchup::View] a View object
1255
+ #
1256
+ # @version SketchUp 6.0
1257
+ def set_color_from_line(point1, point2)
1258
+ end
1259
+
1260
+ # The show_frame method is used to show a frame of an Animation object in the
1261
+ # current view.
1262
+ #
1263
+ # You can supply an optional delay in seconds to wait before showing the next
1264
+ # frame. This can be useful to control the speed at which the animation runs.
1265
+ #
1266
+ # @example
1267
+ # status = view.show_frame delay
1268
+ #
1269
+ # @param [Numeric] delay
1270
+ # An optional delay in seconds.
1271
+ #
1272
+ # @return [Sketchup::View]
1273
+ #
1274
+ # @version SketchUp 6.0
1275
+ def show_frame(delay)
1276
+ end
1277
+
1278
+ # This method is used to compute the bounds of the text when
1279
+ # using {#draw_text}. The bounds are not a tight fit around the top and bottom
1280
+ # as they include varying amount of line spacing depending on the font used.
1281
+ #
1282
+ # The {TextVerticalAlignCenter} option will align the text to the center of the
1283
+ # height of the first line, not the whole boundingbox of the text.
1284
+ #
1285
+ # <b>Example of different vertical alignment and text bounds:</b>
1286
+ #
1287
+ # rdoc-image:../images/view-draw-text-with-bounds.png
1288
+ #
1289
+ # @example
1290
+ # class ExampleTool
1291
+ # TEXT_OPTIONS = {
1292
+ # :font => "Arial",
1293
+ # :pixel_size => 20, # Use :size for SketchUp 2024.0 and older.
1294
+ # :bold => true,
1295
+ # :align => TextAlignRight,
1296
+ # :vertical_align => TextVerticalAlignBaseline
1297
+ # }
1298
+ #
1299
+ # # Since `draw` is called frequently it can be useful to pre-compute and
1300
+ # # cache values used by `draw`.
1301
+ # def activate
1302
+ # @text = "Hello SketchUp"
1303
+ # @position = Geom::Point3d.new(200, 200, 0)
1304
+ #
1305
+ # # Compute text bounds
1306
+ # view = Sketchup.active_model.active_view
1307
+ # bounds = view.text_bounds(@position, @text, TEXT_OPTIONS)
1308
+ #
1309
+ # # Compute polygon for the text bounds
1310
+ # x1, y1 = bounds.upper_left.to_a
1311
+ # x2, y2 = bounds.lower_right.to_a
1312
+ # @points = [
1313
+ # Geom::Point3d.new(x1, y1),
1314
+ # Geom::Point3d.new(x1, y2),
1315
+ # Geom::Point3d.new(x2, y2),
1316
+ # Geom::Point3d.new(x2, y1),
1317
+ # ]
1318
+ # end
1319
+ #
1320
+ # def draw(view)
1321
+ # # Draw text bounds
1322
+ # view.drawing_color = Sketchup::Color.new(255, 0, 0, 64)
1323
+ # view.draw2d(GL_QUADS, @points)
1324
+ #
1325
+ # # Draw text
1326
+ # view.draw_text(@position, @text, TEXT_OPTIONS)
1327
+ # end
1328
+ # end
1329
+ #
1330
+ # @note Under Windows the font name must be less than 32 characters - due to
1331
+ # system limitations.
1332
+ #
1333
+ # @option options [String] :font The name of the font to use. If it does not
1334
+ # exist on the system, a default font will be used instead.
1335
+ #
1336
+ # @option options [Integer] :size <b>Legacy</b>: The size of the font in
1337
+ # system-dependent units. On Windows this is in points, on Mac it's in
1338
+ # pixels.
1339
+ #
1340
+ # @option options [Integer] :pixel_size <b>Added SketchUp 2025.0</b>: The
1341
+ # size of the font in pixels.
1342
+ #
1343
+ # @option options [Integer] :point_size <b>Added SketchUp 2025.0</b>: The
1344
+ # size of the font in points.
1345
+ #
1346
+ # @option options [Boolean] :bold Controls the Bold property of the font.
1347
+ #
1348
+ # @option options [Boolean] :italic Controls the Italic property of the font.
1349
+ #
1350
+ # @option options [Integer] :align The text alignment, one of the following
1351
+ # constants: {TextAlignLeft}, {TextAlignCenter} or {TextAlignRight}.
1352
+ #
1353
+ # @option options [Integer] :vertical_align The vertical text alignment
1354
+ # one of the following constants:
1355
+ # {TextVerticalAlignBoundsTop}, {TextVerticalAlignBaseline},
1356
+ # {TextVerticalAlignCapHeight} or {TextVerticalAlignCenter}.
1357
+ #
1358
+ # @param [Geom::Point3d] point
1359
+ # A Point3d object representing a 2D coordinate
1360
+ # in view space.
1361
+ #
1362
+ # @param [String] text
1363
+ # The text string to draw.
1364
+ #
1365
+ # @param [Hash] options
1366
+ # The text can be customized by providing a hash or
1367
+ # named arguments of options.
1368
+ #
1369
+ # @raise [ArgumentError] if combining usage of +:size+, +:pixel_size+ or
1370
+ # +:point_size+ options.
1371
+ #
1372
+ # @return [Geom::Bounds2d]
1373
+ #
1374
+ # @see #draw_text
1375
+ #
1376
+ # @version SketchUp 2020.0
1377
+ def text_bounds(point, text, options = {})
1378
+ end
1379
+
1380
+ # Set a tooltip to display in the view. This is useful for displaying tooltips
1381
+ # in a tool that you write in Ruby.
1382
+ #
1383
+ # @example
1384
+ # tooltip = view.tooltip = string
1385
+ #
1386
+ # @param [String] string
1387
+ # The string tooltip.
1388
+ #
1389
+ # @return [String] the new tooltip string
1390
+ #
1391
+ # @version SketchUp 6.0
1392
+ def tooltip=(string)
1393
+ end
1394
+
1395
+ # The {#vpheight} method is used to retrieve the height of the viewport for the
1396
+ # view.
1397
+ #
1398
+ # @example
1399
+ # model = Sketchup.active_model
1400
+ # view = model.active_view
1401
+ # height = view.vpheight
1402
+ #
1403
+ # @note Prior to SketchUp 2025.0 this method returned the size as physical
1404
+ # screen coordinates. As of SketchUp 2025.0 the size are returned in
1405
+ # logical screen coordinates.
1406
+ #
1407
+ # @overload vpheight
1408
+ #
1409
+ # @note Signature for versions prior to SketchUp 2025.0
1410
+ # @version SketchUp 6.0
1411
+ # @return [Integer] the height of the viewport in physical pixels.
1412
+ #
1413
+ # @overload vpheight
1414
+ #
1415
+ # @version SketchUp 2025.0
1416
+ # @return [Float] the height of the viewport in logical pixels.
1417
+ #
1418
+ # @version SketchUp 6.0
1419
+ def vpheight
1420
+ end
1421
+
1422
+ # The {#vpwidth} method is used to retrieve the width of the viewport for the
1423
+ # view.
1424
+ #
1425
+ # @example
1426
+ # view = Sketchup.active_model.active_view
1427
+ # width = view.vpwidth
1428
+ #
1429
+ # @note Prior to SketchUp 2025.0 this method returned the size as physical
1430
+ # screen coordinates. As of SketchUp 2025.0 the size are returned in
1431
+ # logical screen coordinates.
1432
+ #
1433
+ # @overload vpwidth
1434
+ #
1435
+ # @note Signature for versions prior to SketchUp 2025.0
1436
+ # @version SketchUp 6.0
1437
+ # @return [Integer] the width of the viewport in physical pixels.
1438
+ #
1439
+ # @overload vpwidth
1440
+ #
1441
+ # @version SketchUp 2025.0
1442
+ # @return [Float] the width of the viewport in logical pixels.
1443
+ #
1444
+ # @version SketchUp 6.0
1445
+ def vpwidth
1446
+ end
1447
+
1448
+ # The {#write_image} method is used to write the current view to an image file.
1449
+ #
1450
+ # Supported file types are +.png+, +.jpg+, +.jpeg+, +gif+, +.bmp+, +.tif+.
1451
+ # For other file formats available from the GUI in +File > Export > 2D Graphics+,
1452
+ # .e.g +.pdf+, use {Sketchup::Model#export}.
1453
+ #
1454
+ # @overload write_image(filename, width = view.vpwidth, height = view.vpheight, antialias = false, compression = 1.0)
1455
+ #
1456
+ # @note Prefer the overload with option hash instead of this variant. This
1457
+ # overload is not updated with new options.
1458
+ #
1459
+ # @example
1460
+ # filename = File.join(Sketchup.temp_dir, 'example.png')
1461
+ # antialias = false
1462
+ # compression = 0.9
1463
+ # model = Sketchup.active_model
1464
+ # view = model.active_view
1465
+ # view.write_image(filename, 640, 480, antialias, compression)
1466
+ #
1467
+ # @param [String] filename
1468
+ # The filename for the saved image
1469
+ # @param [Integer] width
1470
+ # Width in pixels, defaults to the current viewport width {#vpwidth}.
1471
+ # @param [Integer] height
1472
+ # Height in pixels, defaults to the current viewport height {#vpheight}.
1473
+ # @param [Boolean] antialias
1474
+ # @param [Float] compression
1475
+ # Compression factor for JPEG images, between +0.0+ and +1.0+.
1476
+ #
1477
+ # @overload write_image(options)
1478
+ #
1479
+ # @example
1480
+ # options = {
1481
+ # :filename => File.join(Sketchup.temp_dir, 'example.png'),
1482
+ # :width => 640,
1483
+ # :height => 480,
1484
+ # :antialias => false,
1485
+ # :compression => 0.9,
1486
+ # :transparent => true
1487
+ # }
1488
+ # model = Sketchup.active_model
1489
+ # view = model.active_view
1490
+ # view.write_image(options)
1491
+ #
1492
+ # @version SketchUp 7
1493
+ # @param [Hash] options
1494
+ # @option options [String] filename The filename for the saved image.
1495
+ # @option options [Integer] width (#vpwidth) Width in pixels (max +16000+).
1496
+ # @option options [Integer] height (#vpheight) Height in pixels (max +16000+).
1497
+ # @option options [Float] scale_factor (1.0) Scaling factor for
1498
+ # elements that are viewport dependent, such as text heights, arrow heads,
1499
+ # line widths, stipple patterns, etc. (Added in SketchUp 2019.2)
1500
+ # @option options [Boolean] antialias (false)
1501
+ # @option options [Float] compression (1.0) Compression factor for JPEG,
1502
+ # images between +0.0+ and +1.0+.
1503
+ # @option options [Boolean] transparent (false) Added in SketchUp 8.
1504
+ #
1505
+ # @overload write_image(options)
1506
+ #
1507
+ # It is possible to dump the framebuffer to file by setting +:source+ to
1508
+ # +:framebuffer+. When saving the framebuffer only the following options are
1509
+ # valid.
1510
+ #
1511
+ # @example
1512
+ # options = {
1513
+ # :filename => File.join(Sketchup.temp_dir, 'example.png'),
1514
+ # :source => :framebuffer,
1515
+ # :compression => 0.9,
1516
+ # }
1517
+ # model = Sketchup.active_model
1518
+ # view = model.active_view
1519
+ # view.write_image(options)
1520
+ #
1521
+ # @version SketchUp 7
1522
+ # @param [Hash] options
1523
+ # @option options [String] filename The filename for the saved image.
1524
+ # @option options [Boolean] source (:image) Set to +:framebuffer+ to dump the
1525
+ # current framebuffer.
1526
+ # @option options [Float] compression (1.0) Compression factor for JPEG,
1527
+ # images between +0.0+ and +1.0+.
1528
+ #
1529
+ # @return [Boolean]
1530
+ #
1531
+ # @version SketchUp 6.0
1532
+ def write_image(*args)
1533
+ end
1534
+
1535
+ # The zoom method is used to zoom in or out by some zoom factor.
1536
+ #
1537
+ # @example
1538
+ # view = view.zoom factor
1539
+ # view = view.zoom selection
1540
+ # view = view.zoom entity
1541
+ # view = view.zoom array_of_entities
1542
+ #
1543
+ # @param [Numeric, Sketchup::Selection, Sketchup::Entity, Array<Sketchup::Entity>] zoom_or_ents
1544
+ # A Float zoom factor from 1.0 or larger or an Array or
1545
+ # collection of entities to "zoom extents" around.
1546
+ #
1547
+ # @return [Sketchup::View] the zoomed View object
1548
+ #
1549
+ # @version SketchUp 6.0
1550
+ def zoom(zoom_or_ents)
1551
+ end
1552
+
1553
+ # The zoom_extents method is used to zoom to the extents about the entire
1554
+ # model, as if the user has selected the zoom extents command from the menu.
1555
+ #
1556
+ # @example
1557
+ # view = Sketchup.active_model.active_view
1558
+ # new_view = view.zoom_extents
1559
+ #
1560
+ # @return [Sketchup::View] the zoomed View object
1561
+ #
1562
+ # @version SketchUp 6.0
1563
+ def zoom_extents
1564
+ end
1565
+
1566
+ end