sketchup-api-stubs 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/SketchUp/Geom/BoundingBox.rb +335 -0
- data/SketchUp/Geom/LatLong.rb +123 -0
- data/SketchUp/Geom/Point3d.rb +643 -0
- data/SketchUp/Geom/PolygonMesh.rb +478 -0
- data/SketchUp/Geom/Transformation.rb +476 -0
- data/SketchUp/Geom/UTM.rb +135 -0
- data/SketchUp/Geom/Vector3d.rb +684 -0
- data/SketchUp/Sketchup/Animation.rb +137 -0
- data/SketchUp/Sketchup/AppObserver.rb +157 -0
- data/SketchUp/Sketchup/ArcCurve.rb +209 -0
- data/SketchUp/Sketchup/AttributeDictionaries.rb +146 -0
- data/SketchUp/Sketchup/AttributeDictionary.rb +280 -0
- data/SketchUp/Sketchup/Axes.rb +149 -0
- data/SketchUp/Sketchup/Behavior.rb +338 -0
- data/SketchUp/Sketchup/Camera.rb +594 -0
- data/SketchUp/Sketchup/ClassificationSchema.rb +63 -0
- data/SketchUp/Sketchup/Classifications.rb +118 -0
- data/SketchUp/Sketchup/Color.rb +291 -0
- data/SketchUp/Sketchup/ComponentDefinition.rb +562 -0
- data/SketchUp/Sketchup/ComponentInstance.rb +597 -0
- data/SketchUp/Sketchup/Console.rb +78 -0
- data/SketchUp/Sketchup/ConstructionLine.rb +257 -0
- data/SketchUp/Sketchup/ConstructionPoint.rb +32 -0
- data/SketchUp/Sketchup/Curve.rb +196 -0
- data/SketchUp/Sketchup/DefinitionList.rb +312 -0
- data/SketchUp/Sketchup/DefinitionObserver.rb +73 -0
- data/SketchUp/Sketchup/DefinitionsObserver.rb +102 -0
- data/SketchUp/Sketchup/Dimension.rb +167 -0
- data/SketchUp/Sketchup/DimensionLinear.rb +232 -0
- data/SketchUp/Sketchup/DimensionObserver.rb +38 -0
- data/SketchUp/Sketchup/DimensionRadial.rb +87 -0
- data/SketchUp/Sketchup/Drawingelement.rb +400 -0
- data/SketchUp/Sketchup/Edge.rb +517 -0
- data/SketchUp/Sketchup/EdgeUse.rb +213 -0
- data/SketchUp/Sketchup/Entities.rb +1011 -0
- data/SketchUp/Sketchup/EntitiesObserver.rb +125 -0
- data/SketchUp/Sketchup/Entity.rb +522 -0
- data/SketchUp/Sketchup/EntityObserver.rb +59 -0
- data/SketchUp/Sketchup/ExtensionsManager.rb +129 -0
- data/SketchUp/Sketchup/Face.rb +737 -0
- data/SketchUp/Sketchup/FrameChangeObserver.rb +104 -0
- data/SketchUp/Sketchup/Group.rb +705 -0
- data/SketchUp/Sketchup/Http.rb +27 -0
- data/SketchUp/Sketchup/Http/Request.rb +285 -0
- data/SketchUp/Sketchup/Http/Response.rb +62 -0
- data/SketchUp/Sketchup/Image.rb +393 -0
- data/SketchUp/Sketchup/Importer.rb +192 -0
- data/SketchUp/Sketchup/InputPoint.rb +393 -0
- data/SketchUp/Sketchup/InstanceObserver.rb +82 -0
- data/SketchUp/Sketchup/InstancePath.rb +297 -0
- data/SketchUp/Sketchup/Layer.rb +240 -0
- data/SketchUp/Sketchup/Layers.rb +235 -0
- data/SketchUp/Sketchup/LayersObserver.rb +136 -0
- data/SketchUp/Sketchup/Licensing.rb +47 -0
- data/SketchUp/Sketchup/Licensing/ExtensionLicense.rb +88 -0
- data/SketchUp/Sketchup/Loop.rb +141 -0
- data/SketchUp/Sketchup/Material.rb +384 -0
- data/SketchUp/Sketchup/Materials.rb +283 -0
- data/SketchUp/Sketchup/MaterialsObserver.rb +141 -0
- data/SketchUp/Sketchup/Menu.rb +97 -0
- data/SketchUp/Sketchup/Model.rb +1459 -0
- data/SketchUp/Sketchup/ModelObserver.rb +356 -0
- data/SketchUp/Sketchup/OptionsManager.rb +135 -0
- data/SketchUp/Sketchup/OptionsProvider.rb +277 -0
- data/SketchUp/Sketchup/OptionsProviderObserver.rb +58 -0
- data/SketchUp/Sketchup/Page.rb +636 -0
- data/SketchUp/Sketchup/Pages.rb +349 -0
- data/SketchUp/Sketchup/PagesObserver.rb +76 -0
- data/SketchUp/Sketchup/PickHelper.rb +457 -0
- data/SketchUp/Sketchup/RegionalSettings.rb +43 -0
- data/SketchUp/Sketchup/RenderingOptions.rb +337 -0
- data/SketchUp/Sketchup/RenderingOptionsObserver.rb +44 -0
- data/SketchUp/Sketchup/SectionPlane.rb +88 -0
- data/SketchUp/Sketchup/Selection.rb +470 -0
- data/SketchUp/Sketchup/SelectionObserver.rb +115 -0
- data/SketchUp/Sketchup/Set.rb +253 -0
- data/SketchUp/Sketchup/ShadowInfo.rb +257 -0
- data/SketchUp/Sketchup/ShadowInfoObserver.rb +57 -0
- data/SketchUp/Sketchup/Style.rb +77 -0
- data/SketchUp/Sketchup/Styles.rb +204 -0
- data/SketchUp/Sketchup/Text.rb +241 -0
- data/SketchUp/Sketchup/Texture.rb +211 -0
- data/SketchUp/Sketchup/TextureWriter.rb +237 -0
- data/SketchUp/Sketchup/Tool.rb +808 -0
- data/SketchUp/Sketchup/Tools.rb +120 -0
- data/SketchUp/Sketchup/ToolsObserver.rb +154 -0
- data/SketchUp/Sketchup/UVHelper.rb +61 -0
- data/SketchUp/Sketchup/Vertex.rb +143 -0
- data/SketchUp/Sketchup/View.rb +965 -0
- data/SketchUp/Sketchup/ViewObserver.rb +40 -0
- data/SketchUp/UI/Command.rb +307 -0
- data/SketchUp/UI/HtmlDialog.rb +346 -0
- data/SketchUp/UI/Notification.rb +229 -0
- data/SketchUp/UI/Toolbar.rb +243 -0
- data/SketchUp/UI/WebDialog.rb +623 -0
- data/SketchUp/_top_level.rb +193 -0
- data/SketchUp/array.rb +593 -0
- data/SketchUp/geom.rb +231 -0
- data/SketchUp/languagehandler.rb +92 -0
- data/SketchUp/length.rb +210 -0
- data/SketchUp/numeric.rb +249 -0
- data/SketchUp/sketchup.rb +1290 -0
- data/SketchUp/sketchupextension.rb +355 -0
- data/SketchUp/string.rb +24 -0
- data/SketchUp/ui.rb +637 -0
- metadata +176 -0
@@ -0,0 +1,965 @@
|
|
1
|
+
# Copyright:: Copyright 2017 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 observer
|
26
|
+
# An observer.
|
27
|
+
#
|
28
|
+
# @return 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 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
|
+
# if (anim)
|
43
|
+
# UI.messagebox anim
|
44
|
+
# else
|
45
|
+
# UI.messagebox "Failure"
|
46
|
+
# end
|
47
|
+
#
|
48
|
+
# @param animation
|
49
|
+
# An Animation object.
|
50
|
+
#
|
51
|
+
# @return animation - the newly set Animation object
|
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 time - the time in milliseconds
|
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 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
|
+
# camera2 = Sketchup.Camera.new
|
89
|
+
# model = Sketchup.active_model
|
90
|
+
# view = model.active_view
|
91
|
+
# status = view.camera=camera2
|
92
|
+
#
|
93
|
+
# @overload camera=(camera)
|
94
|
+
#
|
95
|
+
# @param [Sketchup::Camera] camera The new Camera object.
|
96
|
+
# @return nil
|
97
|
+
#
|
98
|
+
# @overload camera=(camera_and_transition)
|
99
|
+
#
|
100
|
+
# @param [Array(Sketchup::Camera, Float)] camera_and_transition
|
101
|
+
# The second item in the array represent the transition time from the
|
102
|
+
# existing camera to the
|
103
|
+
# @return nil
|
104
|
+
#
|
105
|
+
# @version SketchUp 6.0
|
106
|
+
def camera=(arg)
|
107
|
+
end
|
108
|
+
|
109
|
+
# The center method is used to retrieve the coordinates of the center of the
|
110
|
+
# view in pixels. It is returned as an array of 2 values for x and y.
|
111
|
+
#
|
112
|
+
# @example
|
113
|
+
# model = Sketchup.active_model
|
114
|
+
# view = model.active_view
|
115
|
+
# c = view.center
|
116
|
+
#
|
117
|
+
# @return center - the center of the view
|
118
|
+
#
|
119
|
+
# @version SketchUp 6.0
|
120
|
+
def center
|
121
|
+
end
|
122
|
+
|
123
|
+
# The corner method is used to retrieve the coordinates of one of the corners
|
124
|
+
# of the view. The argument is an index between 0 and 3 that identifies which
|
125
|
+
# corner you want. This method returns an array with two integers which are
|
126
|
+
# the coordinates of the corner of the view in the view space. If the view
|
127
|
+
# uses a Camera with a fixed aspect ratio, then the corners are the corners of
|
128
|
+
# the viewing are of the camera which might be different than the actual
|
129
|
+
# corners of the view itself.
|
130
|
+
#
|
131
|
+
# The index numbers are as follows:
|
132
|
+
# - 0: top left,
|
133
|
+
# - 1: top right,
|
134
|
+
# - 2: bottom left,
|
135
|
+
# - 3: bottom right.
|
136
|
+
#
|
137
|
+
# @example
|
138
|
+
# point = view.corner index
|
139
|
+
#
|
140
|
+
# @param index
|
141
|
+
# A value between (or including) 0 and 3 identifying the
|
142
|
+
# corner whose coordinate you want to retrieve.
|
143
|
+
#
|
144
|
+
# @return point - a 2d array [w,h] representing the screen point
|
145
|
+
#
|
146
|
+
# @version SketchUp 6.0
|
147
|
+
def corner(index)
|
148
|
+
end
|
149
|
+
|
150
|
+
# The {#draw} method is used to do basic drawing. This method can only be
|
151
|
+
# called from within the {Tool#draw} method of a tool that you implement in
|
152
|
+
# Ruby.
|
153
|
+
#
|
154
|
+
# The following constants are all OpenGL terms and have been externalized to
|
155
|
+
# Ruby. Here is a summary of their meanings:
|
156
|
+
#
|
157
|
+
# [GL_POINTS]
|
158
|
+
# Treats each vertex as a single point. Vertex n defines point n. N
|
159
|
+
# points are drawn.
|
160
|
+
#
|
161
|
+
# [GL_LINES]
|
162
|
+
# Treats each pair of vertices as
|
163
|
+
# an independent line segment. Vertices 2n-1 and 2n define line n. N/2 lines
|
164
|
+
# are drawn.
|
165
|
+
#
|
166
|
+
# [GL_LINE_STRIP]
|
167
|
+
# Draws a connected group of line
|
168
|
+
# segments from the first vertex to the last. Vertices n and n+1 define
|
169
|
+
# line n. N-1 lines are drawn.
|
170
|
+
#
|
171
|
+
# [GL_LINE_LOOP]
|
172
|
+
# Draws a connected group of line segments from the first vertex to the last,
|
173
|
+
# then back to the first. Vertices n and n+1 define line n. The last line,
|
174
|
+
# however, is defined by vertices N and 1. N lines are drawn.
|
175
|
+
#
|
176
|
+
# [GL_TRIANGLES]
|
177
|
+
# Treats each triplet of vertices as an independent
|
178
|
+
# triangle. Vertices 3n-2, 3n-1, and 3n define triangle n. N/3 triangles are
|
179
|
+
# drawn.
|
180
|
+
#
|
181
|
+
# [GL_TRIANGLE_STRIP]
|
182
|
+
# Draws a connected group of triangles. One triangle is defined for each
|
183
|
+
# vertex presented after the first two vertices. For odd n, vertices n, n+1,
|
184
|
+
# and n+2 define triangle n. For even n, vertices n+1, n, and n+2 define
|
185
|
+
# triangle n. N-2 triangles are drawn.
|
186
|
+
#
|
187
|
+
# [GL_TRIANGLE_FAN]
|
188
|
+
# Draws a connected group of triangles.
|
189
|
+
# One triangle is defined for each vertex presented after the first two
|
190
|
+
# vertices. Vertices 1, n+1, and n+2 define triangle n. N-2 triangles are
|
191
|
+
# drawn.
|
192
|
+
#
|
193
|
+
# [GL_QUADS]
|
194
|
+
# Treats each group of four vertices as an
|
195
|
+
# independent quadrilateral. Vertices 4n-3, 4n-2, 4n-1, and 4n define
|
196
|
+
# quadrilateral n. N/4 quadrilaterals are drawn.
|
197
|
+
#
|
198
|
+
# [GL_QUAD_STRIP]
|
199
|
+
# Draws a connected group of quadrilaterals. One quadrilateral is
|
200
|
+
# defined for each pair of vertices presented after the first pair.
|
201
|
+
# Vertices 2n-1, 2n, 2n+2, and 2n+1 define quadrilateral n. N/2-1
|
202
|
+
# quadrilaterals are drawn. Note that the order in which vertices are used to
|
203
|
+
# construct a quadrilateral from strip data is different from that used with
|
204
|
+
# independent data.
|
205
|
+
#
|
206
|
+
# [GL_POLYGON]
|
207
|
+
# Draws a single, convex polygon. Vertices 1
|
208
|
+
# through N define this polygon.
|
209
|
+
#
|
210
|
+
# @example
|
211
|
+
# points = [
|
212
|
+
# Geom::Point3d.new(0, 0, 0),
|
213
|
+
# Geom::Point3d.new(9, 0, 0),
|
214
|
+
# Geom::Point3d.new(9, 9, 0),
|
215
|
+
# Geom::Point3d.new(0, 9, 0)
|
216
|
+
# ]
|
217
|
+
# view.draw(GL_LINE_LOOP, points)
|
218
|
+
#
|
219
|
+
# @note If you draw outside the model bounds you need to implement
|
220
|
+
# {Tool#getExtents} which return a bounding box large enough to include the
|
221
|
+
# points you draw. Otherwise your drawing will be clipped.
|
222
|
+
#
|
223
|
+
# @param [Integer] mode
|
224
|
+
# The item you are going to draw, one of the constants
|
225
|
+
# from the comments, such as +GL_LINES+.
|
226
|
+
#
|
227
|
+
# @param [Array<Geom::Point3d>] points
|
228
|
+
#
|
229
|
+
# @return [Sketchup::View]
|
230
|
+
#
|
231
|
+
# @see Tool#getExtents
|
232
|
+
#
|
233
|
+
# @version SketchUp 6.0
|
234
|
+
def draw(mode, points)
|
235
|
+
end
|
236
|
+
|
237
|
+
# The {#draw2d} method is used to draw in screen space (using 2D screen
|
238
|
+
# coordinates) instead of 3D space.
|
239
|
+
#
|
240
|
+
# The second parameter is an {Array} of {Geom::Point3d} objects (or several
|
241
|
+
# individual {Geom::Point3d} objects). These {Geom::Point3d} objects are in
|
242
|
+
# screen space, not 3D space.
|
243
|
+
# The X value corresponds to the number of pixels from the left edge of the
|
244
|
+
# drawing area. The Y value corresponds to the number of pixels down from
|
245
|
+
# the top of the drawing area. The Z value is not used.
|
246
|
+
#
|
247
|
+
# @example
|
248
|
+
# points = [
|
249
|
+
# Geom::Point3d.new(0, 0, 0),
|
250
|
+
# Geom::Point3d.new(8, 0, 0),
|
251
|
+
# Geom::Point3d.new(8, 4, 0),
|
252
|
+
# Geom::Point3d.new(0, 4, 0)
|
253
|
+
# ]
|
254
|
+
# view.draw2d(GL_LINE_STRIP, points)
|
255
|
+
#
|
256
|
+
# @param [Array<Geom::Point3d>] points
|
257
|
+
#
|
258
|
+
# @param [Integer] openglenum
|
259
|
+
# An OpenGL enumerator (unsigned integer). See
|
260
|
+
# comments in the {#draw} method for a list of constants.
|
261
|
+
#
|
262
|
+
# @return [Sketchup::View] returns the View object.
|
263
|
+
#
|
264
|
+
# @see #draw
|
265
|
+
#
|
266
|
+
# @see UI.scale_factor
|
267
|
+
#
|
268
|
+
# @version SketchUp 6.0
|
269
|
+
def draw2d(openglenum, points)
|
270
|
+
end
|
271
|
+
|
272
|
+
# The draw_lines method is used to draw disconnected lines.
|
273
|
+
#
|
274
|
+
# You must have an even number of points. This method is usually invoked
|
275
|
+
# within the draw method of a tool.
|
276
|
+
#
|
277
|
+
# @example
|
278
|
+
# point4 = Geom::Point3d.new 0,0,0
|
279
|
+
# point5 = Geom::Point3d.new 100,100,100
|
280
|
+
# # returns a view
|
281
|
+
# status = view.drawing_color="red"
|
282
|
+
# status = view.draw_lines point4, point5
|
283
|
+
#
|
284
|
+
# @overload draw_lines(point_list, ...)
|
285
|
+
#
|
286
|
+
# @param point_list An even number of Point3d objects.
|
287
|
+
# @return view - a View object
|
288
|
+
#
|
289
|
+
# @overload draw_lines(pts)
|
290
|
+
#
|
291
|
+
# @param pts An array of Point3d objects.
|
292
|
+
# @return view - a View object
|
293
|
+
#
|
294
|
+
# @version SketchUp 6.0
|
295
|
+
def draw_line(*args)
|
296
|
+
end
|
297
|
+
|
298
|
+
# The draw_lines method is used to draw disconnected lines.
|
299
|
+
#
|
300
|
+
# You must have an even number of points. This method is usually invoked
|
301
|
+
# within the draw method of a tool.
|
302
|
+
#
|
303
|
+
# @example
|
304
|
+
# point4 = Geom::Point3d.new 0,0,0
|
305
|
+
# point5 = Geom::Point3d.new 100,100,100
|
306
|
+
# # returns a view
|
307
|
+
# status = view.drawing_color="red"
|
308
|
+
# status = view.draw_lines point4, point5
|
309
|
+
#
|
310
|
+
# @overload draw_lines(point_list, ...)
|
311
|
+
#
|
312
|
+
# @param point_list An even number of Point3d objects.
|
313
|
+
# @return view - a View object
|
314
|
+
#
|
315
|
+
# @overload draw_lines(pts)
|
316
|
+
#
|
317
|
+
# @param pts An array of Point3d objects.
|
318
|
+
# @return view - a View object
|
319
|
+
#
|
320
|
+
# @version SketchUp 6.0
|
321
|
+
def draw_lines(*args)
|
322
|
+
end
|
323
|
+
|
324
|
+
# This method is used to draw points.
|
325
|
+
#
|
326
|
+
# This method is usually invoked within the draw method of a tool.
|
327
|
+
#
|
328
|
+
# @example
|
329
|
+
# point3 = Geom::Point3d.new 0,0,0
|
330
|
+
# # returns a view
|
331
|
+
# status = view.draw_points point3, 10, 1, "red"
|
332
|
+
#
|
333
|
+
# @param pts
|
334
|
+
# An array of Point3d objects.
|
335
|
+
#
|
336
|
+
# @param [optional] pointsize
|
337
|
+
# Size of the point in pixels.
|
338
|
+
#
|
339
|
+
# @param [optional] pointcolor
|
340
|
+
# Color of the point.
|
341
|
+
#
|
342
|
+
# @param [optional] pointstyle
|
343
|
+
# Style of the point. 1 = open square,
|
344
|
+
# 2 = filled square, 3 = "+", 4 = "X", 5 = "*",
|
345
|
+
# 6 = open triangle, 7 = filled triangle.
|
346
|
+
#
|
347
|
+
# @return view - a View object
|
348
|
+
#
|
349
|
+
# @version SketchUp 6.0
|
350
|
+
def draw_points(pts, pointsize, pointstyle, pointcolor)
|
351
|
+
end
|
352
|
+
|
353
|
+
# The draw_polyline method is used to draw a series of connected line segments
|
354
|
+
# from pt1 to pt2 to pt3, and so on.
|
355
|
+
#
|
356
|
+
# This method is usually invoked within the draw method of a tool.
|
357
|
+
#
|
358
|
+
# @example
|
359
|
+
# point12 = Geom::Point3d.new 0,0,0
|
360
|
+
# point13 = Geom::Point3d.new 10,10,10
|
361
|
+
# point14 = Geom::Point3d.new 20,20,20
|
362
|
+
# point15 = Geom::Point3d.new 30,30,30
|
363
|
+
# status = view.draw_polyline point12, point13, point14, point15
|
364
|
+
#
|
365
|
+
# @overload draw_polyline(point_list, ...)
|
366
|
+
#
|
367
|
+
# @param point_list An even number of Point3d objects.
|
368
|
+
# @return view - a View object
|
369
|
+
#
|
370
|
+
# @overload draw_polyline(pts)
|
371
|
+
#
|
372
|
+
# @param pts An array of Point3d objects.
|
373
|
+
# @return view - a View object
|
374
|
+
#
|
375
|
+
# @version SketchUp 6.0
|
376
|
+
def draw_polyline(*args)
|
377
|
+
end
|
378
|
+
|
379
|
+
# This method is used to draw text on the screen and is usually invoked within
|
380
|
+
# the draw method of a tool.
|
381
|
+
#
|
382
|
+
# @example
|
383
|
+
# view = Sketchup.active_model.active_view
|
384
|
+
#
|
385
|
+
# # This works in all SketchUp versions and draws the text using the
|
386
|
+
# # default font, color and size.
|
387
|
+
# point = Geom::Point3d.new(200, 100, 0)
|
388
|
+
# view.draw_text(point, "This is a test")
|
389
|
+
#
|
390
|
+
# # This works in SketchUp 2016 and up.
|
391
|
+
# options = {
|
392
|
+
# :font => "Arial",
|
393
|
+
# :size => 20,
|
394
|
+
# :bold => true,
|
395
|
+
# :align => TextAlignRight
|
396
|
+
# }
|
397
|
+
# point = Geom::Point3d.new(200, 200, 0)
|
398
|
+
# view.draw_text(point, "This is another\ntest", options)
|
399
|
+
#
|
400
|
+
# # You can also use Ruby 2.0's named arguments:
|
401
|
+
# point = Geom::Point3d.new(200, 200, 0)
|
402
|
+
# view.draw_text(point, "Hello world!", color: "Red")
|
403
|
+
#
|
404
|
+
# @note Under Windows the font name must be less than 32 characters - due to
|
405
|
+
# system limitations.
|
406
|
+
#
|
407
|
+
# @option options [Sketchup::Color] :color The color to draw the text with.
|
408
|
+
#
|
409
|
+
# @option options [Integer] :align The text alignment, one of the following
|
410
|
+
# constants +TextAlignLeft+, +TextAlignCenter+ or +TextAlignRight+.
|
411
|
+
#
|
412
|
+
# @option options [Boolean] :italic Controls the Italic property of the font.
|
413
|
+
#
|
414
|
+
# @option options [Boolean] :bold Controls the Bold property of the font.
|
415
|
+
#
|
416
|
+
# @option options [Integer] :size The size of the font in points
|
417
|
+
#
|
418
|
+
# @option options [String] :font The name of the font to use. If it does not
|
419
|
+
# exist on the system, a default font will be used instead.
|
420
|
+
#
|
421
|
+
# @param [Hash] options
|
422
|
+
# The text can be customized by providing a hash or
|
423
|
+
# named arguments of options. Available from SketchUp 2016.
|
424
|
+
#
|
425
|
+
# @param [String] text
|
426
|
+
# The text string to draw.
|
427
|
+
#
|
428
|
+
# @param [Geom::Point3d] point
|
429
|
+
# A Point3d object representing a 2D coordinate
|
430
|
+
# in view space.
|
431
|
+
#
|
432
|
+
# @return [Sketchup::View]
|
433
|
+
#
|
434
|
+
# @version SketchUp 6.0
|
435
|
+
def draw_text(point, text, options = {})
|
436
|
+
end
|
437
|
+
|
438
|
+
# The drawing_color method is used to set the color that is used for drawing
|
439
|
+
# to the view.
|
440
|
+
#
|
441
|
+
# This method is usually invoked within the draw method of a tool.
|
442
|
+
#
|
443
|
+
# @example
|
444
|
+
# view = view.drawing_color = color
|
445
|
+
#
|
446
|
+
# @param color
|
447
|
+
# A Color object.
|
448
|
+
#
|
449
|
+
# @return view - a View object
|
450
|
+
#
|
451
|
+
# @version SketchUp 6.0
|
452
|
+
def drawing_color=(color)
|
453
|
+
end
|
454
|
+
|
455
|
+
# The dynamic= method allows you to degrade visual quality while improving
|
456
|
+
# performance when a model is large and view refresh time is slow. For
|
457
|
+
# example, if you were using a Ruby script to animate the camera through
|
458
|
+
# a large scene, you may want to set dynamic to true during that time.
|
459
|
+
#
|
460
|
+
# See also camera.rb which is part of the film and stage ruby
|
461
|
+
# scripts.
|
462
|
+
#
|
463
|
+
# @example
|
464
|
+
# view.dynamic = true
|
465
|
+
#
|
466
|
+
# @param value
|
467
|
+
# true or false
|
468
|
+
#
|
469
|
+
# @return nil
|
470
|
+
#
|
471
|
+
# @version SketchUp 6.0
|
472
|
+
def dynamic=(value)
|
473
|
+
end
|
474
|
+
|
475
|
+
# The field_of_view method is used get the view's field of view setting, in
|
476
|
+
# degrees.
|
477
|
+
#
|
478
|
+
# @example
|
479
|
+
# fov = Sketchup.active_model.active_view.field_of_view
|
480
|
+
#
|
481
|
+
# @return fov - the field of view
|
482
|
+
#
|
483
|
+
# @version SketchUp 6.0
|
484
|
+
def field_of_view
|
485
|
+
end
|
486
|
+
|
487
|
+
# The field_of_view= method is used set the view's field of view setting,
|
488
|
+
# in degrees.
|
489
|
+
#
|
490
|
+
# @example
|
491
|
+
# my_view = Sketchup.active_model.active_view
|
492
|
+
# my_view.field_of_view = 45
|
493
|
+
# my_view.invalidate
|
494
|
+
#
|
495
|
+
# @param fov
|
496
|
+
# - the field of view
|
497
|
+
#
|
498
|
+
# @return status - true if successful
|
499
|
+
#
|
500
|
+
# @version SketchUp 6.0
|
501
|
+
def field_of_view=(fov)
|
502
|
+
end
|
503
|
+
|
504
|
+
# The guess_target method is used to guess at what the user is looking at when
|
505
|
+
# you have a perspective view.
|
506
|
+
#
|
507
|
+
# This method is useful when writing a viewing tool. See also camera.rb which
|
508
|
+
# is part of the film and stage ruby scripts.
|
509
|
+
#
|
510
|
+
# @example
|
511
|
+
# target = view.guess_target
|
512
|
+
#
|
513
|
+
# @return target - a Point3d object representing the point in the
|
514
|
+
# model that the user is likely interested in.
|
515
|
+
#
|
516
|
+
# @version SketchUp 6.0
|
517
|
+
def guess_target
|
518
|
+
end
|
519
|
+
|
520
|
+
# The inference_locked? method is used to determine if inference locking is on
|
521
|
+
# for the view.
|
522
|
+
#
|
523
|
+
# @example
|
524
|
+
# model = Sketchup.active_model
|
525
|
+
# view = model.active_view
|
526
|
+
# status = view.inference_locked
|
527
|
+
#
|
528
|
+
# @return status - true if locked, false if unlocked
|
529
|
+
#
|
530
|
+
# @return [Boolean]
|
531
|
+
#
|
532
|
+
# @version SketchUp 6.0
|
533
|
+
def inference_locked?
|
534
|
+
end
|
535
|
+
|
536
|
+
# The inputpoint method is used to retrieve an input point.
|
537
|
+
#
|
538
|
+
# This will normally be used inside one of the mouse event handling methods in
|
539
|
+
# a tool. Usually, it is preferable to create the InputPoint first and then
|
540
|
+
# use the pick method on it.
|
541
|
+
#
|
542
|
+
# @example
|
543
|
+
# inputpoint = view.inputpoint x, y, inputpoint1
|
544
|
+
#
|
545
|
+
# @param x
|
546
|
+
# A x value.
|
547
|
+
#
|
548
|
+
# @param y
|
549
|
+
# A y value.
|
550
|
+
#
|
551
|
+
# @param inputpoint1
|
552
|
+
# An InputPoint object.
|
553
|
+
#
|
554
|
+
# @return nil
|
555
|
+
#
|
556
|
+
# @version SketchUp 6.0
|
557
|
+
def inputpoint(x, y, inputpoint1)
|
558
|
+
end
|
559
|
+
|
560
|
+
# The invalidate method is used mark the view as in need of a redraw.
|
561
|
+
#
|
562
|
+
# @example
|
563
|
+
# model = Sketchup.active_model
|
564
|
+
# view = model.active_view
|
565
|
+
# invalidated_view = view.invalidate
|
566
|
+
#
|
567
|
+
# @note This is the preferred method to update the viewport. Use this before
|
568
|
+
# trying to use {#refresh}.
|
569
|
+
#
|
570
|
+
# @return invalidated_view - the invalidated View object
|
571
|
+
#
|
572
|
+
# @version SketchUp 6.0
|
573
|
+
def invalidate
|
574
|
+
end
|
575
|
+
|
576
|
+
# The last_refresh_time method is used to retrieve the time for the last full
|
577
|
+
# view refresh.
|
578
|
+
#
|
579
|
+
# @example
|
580
|
+
# time = view.last_refresh_time
|
581
|
+
#
|
582
|
+
# @return time - time in milliseconds
|
583
|
+
#
|
584
|
+
# @version SketchUp 6.0
|
585
|
+
def last_refresh_time
|
586
|
+
end
|
587
|
+
|
588
|
+
# The line_stipple= method is used to set the line pattern to use for drawing.
|
589
|
+
# The stipple pattern is given as a string.
|
590
|
+
# Valid strings are:
|
591
|
+
# "." (Dotted Line),
|
592
|
+
# "-" (Short Dashes Line),
|
593
|
+
# "_" (Long Dashes Line),
|
594
|
+
# "-.-" (Dash Dot Dash Line),
|
595
|
+
# "" (Solid Line).
|
596
|
+
#
|
597
|
+
# This method is usually invoked within the draw method of a tool.
|
598
|
+
#
|
599
|
+
# @example
|
600
|
+
# point8 = Geom::Point3d.new 0,0,0
|
601
|
+
# point9 = Geom::Point3d.new 100,100,100
|
602
|
+
# view.line_stipple = "-.-"
|
603
|
+
# view = view.draw_lines point8, point9
|
604
|
+
#
|
605
|
+
# @param pattern
|
606
|
+
# A string stipple pattern, such as "-.-"
|
607
|
+
#
|
608
|
+
# @return view - the View object
|
609
|
+
#
|
610
|
+
# @version SketchUp 6.0
|
611
|
+
def line_stipple=(pattern)
|
612
|
+
end
|
613
|
+
|
614
|
+
# The line_width= method is used to set the line width to use for drawing. The
|
615
|
+
# value is a Double indicating the desired width in pixels.
|
616
|
+
#
|
617
|
+
# This method is usually invoked within the draw method of a tool.
|
618
|
+
#
|
619
|
+
# @example
|
620
|
+
# view.line_width = width
|
621
|
+
#
|
622
|
+
# @param width
|
623
|
+
# The width in pixels.
|
624
|
+
#
|
625
|
+
# @return view - a View object
|
626
|
+
#
|
627
|
+
# @version SketchUp 6.0
|
628
|
+
def line_width=(width)
|
629
|
+
end
|
630
|
+
|
631
|
+
# The lock_inference method is used to lock or unlock an inference.
|
632
|
+
#
|
633
|
+
# This method will typically be called from inside a tool class when the user
|
634
|
+
# presses the shift key.
|
635
|
+
#
|
636
|
+
# With no arguments it unlocks all inferences. With one or two arguments, it
|
637
|
+
# locks the inference based on the given InputPoint(s).
|
638
|
+
#
|
639
|
+
# @example
|
640
|
+
# view = view.lock_inference
|
641
|
+
# view = view.lock_inference inputpoint
|
642
|
+
# view = view.lock_inference inputpoint1, inputpoint2
|
643
|
+
#
|
644
|
+
# @param [optional] inputpoint
|
645
|
+
# 1st InputPoint to inference to.
|
646
|
+
#
|
647
|
+
# @param [optional] inputpoint2
|
648
|
+
# 2nd InputPoint to inference to.
|
649
|
+
#
|
650
|
+
# @return view - a View object
|
651
|
+
#
|
652
|
+
# @version SketchUp 6.0
|
653
|
+
def lock_inference(inputpoint, inputpoint2)
|
654
|
+
end
|
655
|
+
|
656
|
+
# The model method is used to retrieve the model for the current view.
|
657
|
+
#
|
658
|
+
# @example
|
659
|
+
# model = view.model
|
660
|
+
#
|
661
|
+
# @return model - the model for this view
|
662
|
+
#
|
663
|
+
# @version SketchUp 6.0
|
664
|
+
def model
|
665
|
+
end
|
666
|
+
|
667
|
+
# The pick_helper method is used to retrieve a pick helper for the view. See
|
668
|
+
# the PickHelper class for information on pick helpers.
|
669
|
+
#
|
670
|
+
# This call returns an initialized PickHelper.
|
671
|
+
#
|
672
|
+
# @example
|
673
|
+
# model = Sketchup.active_model
|
674
|
+
# view = model.active_view
|
675
|
+
# ph = view.pick_helper
|
676
|
+
#
|
677
|
+
# @overload pick_helper
|
678
|
+
#
|
679
|
+
# @return pickhelper - a PickHelper object
|
680
|
+
#
|
681
|
+
# @overload pick_helper(x, y, aperture = 0)
|
682
|
+
#
|
683
|
+
# @param [Integer] x
|
684
|
+
# @param [Integer] y
|
685
|
+
# @param [Integer] aperture
|
686
|
+
# @return pickhelper - a PickHelper object
|
687
|
+
#
|
688
|
+
# @version SketchUp 6.0
|
689
|
+
def pick_helper(*args)
|
690
|
+
end
|
691
|
+
|
692
|
+
# The pickray method is used to retrieve a ray passing through a given screen
|
693
|
+
# position in the viewing direction.
|
694
|
+
#
|
695
|
+
# @example
|
696
|
+
# ray = view.pickray x, y
|
697
|
+
#
|
698
|
+
# @overload pickray(screen_point)
|
699
|
+
#
|
700
|
+
# @param [Array(Integer, Integer)] screen_point
|
701
|
+
# @return ray - a ray
|
702
|
+
#
|
703
|
+
# @overload pickray(x, y)
|
704
|
+
#
|
705
|
+
# @param [Integer] x
|
706
|
+
# @param [Integer] y
|
707
|
+
# @return ray - a ray
|
708
|
+
#
|
709
|
+
# @version SketchUp 6.0
|
710
|
+
def pickray(*args)
|
711
|
+
end
|
712
|
+
|
713
|
+
# The pixels_to_model method is used to compute a model size from a pixel size
|
714
|
+
# at a given point.
|
715
|
+
#
|
716
|
+
# This method is useful for deciding how big to draw something based on a
|
717
|
+
# desired size in pixels.
|
718
|
+
#
|
719
|
+
# @example
|
720
|
+
# size = view.pixels_to_model pixels, point
|
721
|
+
#
|
722
|
+
# @param pixels
|
723
|
+
# The pixel size.
|
724
|
+
#
|
725
|
+
# @param point
|
726
|
+
# A Point3d object where the size will be calculated from.
|
727
|
+
#
|
728
|
+
# @return size - the model size
|
729
|
+
#
|
730
|
+
# @version SketchUp 6.0
|
731
|
+
def pixels_to_model(pixels, point)
|
732
|
+
end
|
733
|
+
|
734
|
+
# The refresh method is used to immediately force a redraw of the view.
|
735
|
+
#
|
736
|
+
# @example
|
737
|
+
# model = Sketchup.active_model
|
738
|
+
# view = model.active_view
|
739
|
+
# refreshed_view = view.refresh
|
740
|
+
#
|
741
|
+
# @note This method might impact performance and if used incorrectly cause
|
742
|
+
# instability or crashes. Don't use this unless you have verified that
|
743
|
+
# you cannot use {#invalidate} instead.
|
744
|
+
#
|
745
|
+
# @return refreshed_view - the refreshed View object
|
746
|
+
#
|
747
|
+
# @version SketchUp 7.1
|
748
|
+
def refresh
|
749
|
+
end
|
750
|
+
|
751
|
+
# The remove_observer method is used to remove an observer from the current
|
752
|
+
# object.
|
753
|
+
#
|
754
|
+
# @example
|
755
|
+
# view = Sketchup.active_model.active_view
|
756
|
+
# status = view.remove_observer observer
|
757
|
+
#
|
758
|
+
# @param observer
|
759
|
+
# An observer.
|
760
|
+
#
|
761
|
+
# @return true if successful, false if unsuccessful.
|
762
|
+
#
|
763
|
+
# @version SketchUp 6.0
|
764
|
+
def remove_observer(observer)
|
765
|
+
end
|
766
|
+
|
767
|
+
# The screen_coords method is used to retrieve the screen coordinates of the
|
768
|
+
# given point on the screen.
|
769
|
+
#
|
770
|
+
# The x and y values returned correspond to the x and y screen coordinates.
|
771
|
+
# Ignore the z values. If the referenced point is not in the current
|
772
|
+
# viewport, the x and/or y value may be negative.
|
773
|
+
#
|
774
|
+
# @example
|
775
|
+
# point = view.screen_coords(ORIGIN)
|
776
|
+
#
|
777
|
+
# @param point3d
|
778
|
+
# A Point3d object.
|
779
|
+
#
|
780
|
+
# @return x, y - A Point3d containing the screen position
|
781
|
+
#
|
782
|
+
# @version SketchUp 6.0
|
783
|
+
def screen_coords(point3d)
|
784
|
+
end
|
785
|
+
|
786
|
+
# Set the drawing color for the view based on the direction of a line that you
|
787
|
+
# want to draw. These colors will match the axes colors in the SketchUp model
|
788
|
+
# (typically blue for straight up and down, etc.)
|
789
|
+
#
|
790
|
+
# This method is usually invoked within the draw method of a tool.
|
791
|
+
#
|
792
|
+
# @example
|
793
|
+
# view = view.set_color_from_line point1, point2
|
794
|
+
#
|
795
|
+
# @param point1
|
796
|
+
# Point3d object representing first point in the line.
|
797
|
+
#
|
798
|
+
# @param point2
|
799
|
+
# Point3d object representing second point in the line.
|
800
|
+
#
|
801
|
+
# @return view - a View object
|
802
|
+
#
|
803
|
+
# @version SketchUp 6.0
|
804
|
+
def set_color_from_line(point1, point2)
|
805
|
+
end
|
806
|
+
|
807
|
+
# The show_frame method is used to show a frame of an Animation object in the
|
808
|
+
# current view.
|
809
|
+
#
|
810
|
+
# You can supply an optional delay in seconds to wait before showing the next
|
811
|
+
# frame. This can be useful to control the speed at which the animation runs.
|
812
|
+
#
|
813
|
+
# @example
|
814
|
+
# status = view.show_frame <delay
|
815
|
+
#
|
816
|
+
# @param delay
|
817
|
+
# An optional delay in seconds.
|
818
|
+
#
|
819
|
+
# @return nil
|
820
|
+
#
|
821
|
+
# @version SketchUp 6.0
|
822
|
+
def show_frame(delay)
|
823
|
+
end
|
824
|
+
|
825
|
+
# Set a tooltip to display in the view. This is useful for displaying tooltips
|
826
|
+
# in a tool that you write in Ruby.
|
827
|
+
#
|
828
|
+
# @example
|
829
|
+
# tooltip = view.tooltip = string
|
830
|
+
#
|
831
|
+
# @param string
|
832
|
+
# The string tooltip.
|
833
|
+
#
|
834
|
+
# @return tooltip - the new tooltip string
|
835
|
+
#
|
836
|
+
# @version SketchUp 6.0
|
837
|
+
def tooltip=(string)
|
838
|
+
end
|
839
|
+
|
840
|
+
# The vpheight method is used to retrieve the height of the viewport for the
|
841
|
+
# view.
|
842
|
+
#
|
843
|
+
# @example
|
844
|
+
# model = Sketchup.active_model
|
845
|
+
# view = model.active_view
|
846
|
+
# height = view.vpheight
|
847
|
+
#
|
848
|
+
# @return height - the height of the viewport in pixels.
|
849
|
+
#
|
850
|
+
# @version SketchUp 6.0
|
851
|
+
def vpheight
|
852
|
+
end
|
853
|
+
|
854
|
+
# The vpwidth method is used to retrieve the width of the viewport for the
|
855
|
+
# view.
|
856
|
+
#
|
857
|
+
# @example
|
858
|
+
# width = view.vpwidth
|
859
|
+
#
|
860
|
+
# @return width - the width of the viewport in pixels.
|
861
|
+
#
|
862
|
+
# @version SketchUp 6.0
|
863
|
+
def vpwidth
|
864
|
+
end
|
865
|
+
|
866
|
+
# The write_image method is used to write the current view to an image file.
|
867
|
+
#
|
868
|
+
# All arguments except for the filename are optional.
|
869
|
+
#
|
870
|
+
# If antialias is specified, it should be either true or false.
|
871
|
+
#
|
872
|
+
# If a hash is passed as the first parameter, then the contents of that hash
|
873
|
+
# define how the image is exported.
|
874
|
+
# The keys are:
|
875
|
+
# - filename The filename for the saved image.
|
876
|
+
# - width (optional) Width in pixels (max 16000).
|
877
|
+
# - height (optional) Height in pixels (max 16000).
|
878
|
+
# - antialias (optional) true or false
|
879
|
+
# - compression (optional) Float compression factor for JPEG images,
|
880
|
+
# between 0.0 and 1.0
|
881
|
+
# - transparent true or false
|
882
|
+
#
|
883
|
+
# @example
|
884
|
+
# depth = 100
|
885
|
+
# width = 100
|
886
|
+
# model = Sketchup.active_model
|
887
|
+
# entities = model.active_entities
|
888
|
+
# pts = []
|
889
|
+
# pts[0] = [0, 0, 0]
|
890
|
+
# pts[1] = [width, 0, 0]
|
891
|
+
# pts[2] = [width, depth, 0]
|
892
|
+
# pts[3] = [0, depth, 0]
|
893
|
+
# # Add the face to the entities in the model
|
894
|
+
# face = entities.add_face pts
|
895
|
+
# UI.messagebox "Now Lets Write the Image"
|
896
|
+
# view = model.active_view
|
897
|
+
# # Puts in SketchUp install directory by default
|
898
|
+
# status = view.write_image "test.jpg"
|
899
|
+
# keys = {
|
900
|
+
# :filename => "c:/tmp/write_image.png",
|
901
|
+
# :width => 640,
|
902
|
+
# :height => 480,
|
903
|
+
# :antialias => false,
|
904
|
+
# :compression => 0.9,
|
905
|
+
# :transparent => true
|
906
|
+
# }
|
907
|
+
# model = Sketchup.active_model
|
908
|
+
# view = model.active_view
|
909
|
+
# view.write_image keys
|
910
|
+
#
|
911
|
+
# @param [optional] width
|
912
|
+
# Width in pixels.
|
913
|
+
#
|
914
|
+
# @param filename_or_hash
|
915
|
+
# The filename for the saved image or a hash
|
916
|
+
# containing a set of keys.
|
917
|
+
#
|
918
|
+
# @param [optional] height
|
919
|
+
# Height in pixels.
|
920
|
+
#
|
921
|
+
# @param [optional] compression
|
922
|
+
# Float compression factor for JPEG images,
|
923
|
+
# between 0.0 and 1.0
|
924
|
+
#
|
925
|
+
# @param [optional] antialias
|
926
|
+
# true or false
|
927
|
+
#
|
928
|
+
# @return nil
|
929
|
+
#
|
930
|
+
# @version SketchUp 6.0
|
931
|
+
def write_image(filename_or_hash, width, height, antialias, compression)
|
932
|
+
end
|
933
|
+
|
934
|
+
# The zoom method is used to zoom in or out by some zoom factor.
|
935
|
+
#
|
936
|
+
# @example
|
937
|
+
# view = view.zoom factor
|
938
|
+
# view = view.zoom selection
|
939
|
+
# view = view.zoom entity
|
940
|
+
# view = view.zoom array_of_entities
|
941
|
+
#
|
942
|
+
# @param zoom_or_ents
|
943
|
+
# A Float zoom factor from 1.0 or larger or an Array or
|
944
|
+
# collection of entities to "zoom extents" around.
|
945
|
+
#
|
946
|
+
# @return view - the zoomed View object
|
947
|
+
#
|
948
|
+
# @version SketchUp 6.0
|
949
|
+
def zoom(zoom_or_ents)
|
950
|
+
end
|
951
|
+
|
952
|
+
# The zoom_extents method is used to zoom to the extents about the entire
|
953
|
+
# model, as if the user has selected the zoom extents command from the menu.
|
954
|
+
#
|
955
|
+
# @example
|
956
|
+
# view = Sketchup.active_model.active_view
|
957
|
+
# new_view = view.zoom_extents
|
958
|
+
#
|
959
|
+
# @return new_view - the zoomed View object
|
960
|
+
#
|
961
|
+
# @version SketchUp 6.0
|
962
|
+
def zoom_extents
|
963
|
+
end
|
964
|
+
|
965
|
+
end
|