sketchup-api-stubs 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/SketchUp/Geom/BoundingBox.rb +17 -20
- data/SketchUp/Geom/Bounds2d.rb +172 -0
- data/SketchUp/Geom/LatLong.rb +31 -16
- data/SketchUp/Geom/OrientedBounds2d.rb +102 -0
- data/SketchUp/Geom/Point2d.rb +365 -0
- data/SketchUp/Geom/Point3d.rb +121 -110
- data/SketchUp/Geom/PolygonMesh.rb +30 -21
- data/SketchUp/Geom/Transformation.rb +8 -4
- data/SketchUp/Geom/Transformation2d.rb +125 -0
- data/SketchUp/Geom/UTM.rb +43 -37
- data/SketchUp/Geom/Vector2d.rb +497 -0
- data/SketchUp/Geom/Vector3d.rb +143 -131
- data/SketchUp/Layout.rb +25 -0
- data/SketchUp/Layout/AngularDimension.rb +569 -0
- data/SketchUp/Layout/AutoTextDefinition.rb +417 -0
- data/SketchUp/Layout/AutoTextDefinitions.rb +186 -0
- data/SketchUp/Layout/ConnectionPoint.rb +70 -0
- data/SketchUp/Layout/Document.rb +458 -0
- data/SketchUp/Layout/Ellipse.rb +29 -0
- data/SketchUp/Layout/Entities.rb +155 -0
- data/SketchUp/Layout/Entity.rb +363 -0
- data/SketchUp/Layout/FormattedText.rb +349 -0
- data/SketchUp/Layout/Grid.rb +131 -0
- data/SketchUp/Layout/Group.rb +261 -0
- data/SketchUp/Layout/Image.rb +86 -0
- data/SketchUp/Layout/Label.rb +371 -0
- data/SketchUp/Layout/Layer.rb +222 -0
- data/SketchUp/Layout/LayerInstance.rb +128 -0
- data/SketchUp/Layout/Layers.rb +232 -0
- data/SketchUp/Layout/LinearDimension.rb +563 -0
- data/SketchUp/Layout/LockedEntityError.rb +10 -0
- data/SketchUp/Layout/LockedLayerError.rb +11 -0
- data/SketchUp/Layout/Page.rb +187 -0
- data/SketchUp/Layout/PageInfo.rb +393 -0
- data/SketchUp/Layout/Pages.rb +216 -0
- data/SketchUp/Layout/Path.rb +326 -0
- data/SketchUp/Layout/Rectangle.rb +174 -0
- data/SketchUp/Layout/SketchUpModel.rb +522 -0
- data/SketchUp/Layout/Style.rb +1520 -0
- data/SketchUp/Layout/Table.rb +290 -0
- data/SketchUp/Layout/TableCell.rb +149 -0
- data/SketchUp/Layout/TableColumn.rb +139 -0
- data/SketchUp/Layout/TableRow.rb +135 -0
- data/SketchUp/Sketchup/Animation.rb +7 -4
- data/SketchUp/Sketchup/ArcCurve.rb +10 -10
- data/SketchUp/Sketchup/AttributeDictionaries.rb +13 -4
- data/SketchUp/Sketchup/AttributeDictionary.rb +12 -12
- data/SketchUp/Sketchup/Color.rb +68 -78
- data/SketchUp/Sketchup/ComponentDefinition.rb +60 -60
- data/SketchUp/Sketchup/ComponentInstance.rb +57 -55
- data/SketchUp/Sketchup/DefinitionList.rb +34 -17
- data/SketchUp/Sketchup/Drawingelement.rb +19 -21
- data/SketchUp/Sketchup/Edge.rb +22 -24
- data/SketchUp/Sketchup/Entities.rb +173 -162
- data/SketchUp/Sketchup/Entity.rb +71 -55
- data/SketchUp/Sketchup/Face.rb +45 -44
- data/SketchUp/Sketchup/Group.rb +47 -49
- data/SketchUp/Sketchup/Image.rb +16 -0
- data/SketchUp/Sketchup/ImageRep.rb +226 -0
- data/SketchUp/Sketchup/InstancePath.rb +13 -13
- data/SketchUp/Sketchup/Layer.rb +15 -17
- data/SketchUp/Sketchup/Material.rb +40 -30
- data/SketchUp/Sketchup/Materials.rb +40 -22
- data/SketchUp/Sketchup/Menu.rb +5 -5
- data/SketchUp/Sketchup/Model.rb +230 -228
- data/SketchUp/Sketchup/Page.rb +32 -0
- data/SketchUp/Sketchup/Pages.rb +3 -4
- data/SketchUp/Sketchup/RenderingOptions.rb +21 -16
- data/SketchUp/Sketchup/SectionPlane.rb +64 -0
- data/SketchUp/Sketchup/Selection.rb +20 -28
- data/SketchUp/Sketchup/ShadowInfo.rb +14 -14
- data/SketchUp/Sketchup/Text.rb +24 -26
- data/SketchUp/Sketchup/Texture.rb +28 -12
- data/SketchUp/Sketchup/Vertex.rb +14 -11
- data/SketchUp/Sketchup/View.rb +126 -116
- data/SketchUp/UI/Command.rb +17 -17
- data/SketchUp/UI/HtmlDialog.rb +8 -5
- data/SketchUp/UI/Notification.rb +1 -1
- data/SketchUp/UI/Toolbar.rb +13 -14
- data/SketchUp/UI/WebDialog.rb +55 -59
- data/SketchUp/_top_level.rb +139 -27
- data/SketchUp/{Array.rb → array.rb} +167 -30
- data/SketchUp/{Geom.rb → geom.rb} +9 -7
- data/SketchUp/{LanguageHandler.rb → languagehandler.rb} +15 -15
- data/SketchUp/{Length.rb → length.rb} +15 -15
- data/SketchUp/{Numeric.rb → numeric.rb} +19 -19
- data/SketchUp/sketchup.rb +167 -156
- data/SketchUp/{SketchupExtension.rb → sketchupextension.rb} +27 -27
- data/SketchUp/{String.rb → string.rb} +1 -1
- data/SketchUp/ui.rb +113 -87
- metadata +46 -9
data/SketchUp/_top_level.rb
CHANGED
@@ -5,15 +5,12 @@
|
|
5
5
|
|
6
6
|
# Constants
|
7
7
|
|
8
|
-
ALeaderModel = nil # Stub value.
|
9
|
-
ALeaderNone = nil # Stub value.
|
10
|
-
ALeaderView = nil # Stub value.
|
11
|
-
|
12
8
|
ALT_MODIFIER_KEY = nil # Stub value.
|
13
9
|
ALT_MODIFIER_MASK = nil # Stub value.
|
14
10
|
|
15
|
-
|
16
|
-
|
11
|
+
ALeaderModel = nil # Stub value.
|
12
|
+
ALeaderNone = nil # Stub value.
|
13
|
+
ALeaderView = nil # Stub value.
|
17
14
|
|
18
15
|
CMD_ARC = nil # Stub value.
|
19
16
|
CMD_CAMERA_UNDO = nil # Stub value.
|
@@ -86,6 +83,9 @@
|
|
86
83
|
COPY_MODIFIER_KEY = nil # Stub value.
|
87
84
|
COPY_MODIFIER_MASK = nil # Stub value.
|
88
85
|
|
86
|
+
CONSTRAIN_MODIFIER_KEY = nil # Stub value.
|
87
|
+
CONSTRAIN_MODIFIER_MASK = nil # Stub value.
|
88
|
+
|
89
89
|
DimensionArrowClosed = nil # Stub value.
|
90
90
|
DimensionArrowDot = nil # Stub value.
|
91
91
|
DimensionArrowNone = nil # Stub value.
|
@@ -107,6 +107,10 @@
|
|
107
107
|
GL_TRIANGLE_FAN = nil # Stub value.
|
108
108
|
GL_TRIANGLE_STRIP = nil # Stub value.
|
109
109
|
|
110
|
+
IDENTITY = nil # Stub value.
|
111
|
+
|
112
|
+
IDENTITY_2D = nil # Stub value.
|
113
|
+
|
110
114
|
IDABORT = nil # Stub value.
|
111
115
|
IDCANCEL = nil # Stub value.
|
112
116
|
IDIGNORE = nil # Stub value.
|
@@ -115,14 +119,18 @@
|
|
115
119
|
IDRETRY = nil # Stub value.
|
116
120
|
IDYES = nil # Stub value.
|
117
121
|
|
118
|
-
IDENTITY = nil # Stub value.
|
119
|
-
|
120
122
|
LAYER_HIDDEN_BY_DEFAULT = nil # Stub value.
|
121
123
|
LAYER_IS_HIDDEN_ON_NEW_PAGES = nil # Stub value.
|
122
124
|
LAYER_IS_VISIBLE_ON_NEW_PAGES = nil # Stub value.
|
123
125
|
LAYER_USES_DEFAULT_VISIBILITY_ON_NEW_PAGES = nil # Stub value.
|
124
126
|
LAYER_VISIBLE_BY_DEFAULT = nil # Stub value.
|
125
127
|
|
128
|
+
MF_CHECKED = nil # Stub value.
|
129
|
+
MF_DISABLED = nil # Stub value.
|
130
|
+
MF_ENABLED = nil # Stub value.
|
131
|
+
MF_GRAYED = nil # Stub value.
|
132
|
+
MF_UNCHECKED = nil # Stub value.
|
133
|
+
|
126
134
|
MB_ABORTRETRYIGNORE = nil # Stub value.
|
127
135
|
MB_MULTILINE = nil # Stub value.
|
128
136
|
MB_OK = nil # Stub value.
|
@@ -131,13 +139,8 @@
|
|
131
139
|
MB_YESNO = nil # Stub value.
|
132
140
|
MB_YESNOCANCEL = nil # Stub value.
|
133
141
|
|
134
|
-
MF_CHECKED = nil # Stub value.
|
135
|
-
MF_DISABLED = nil # Stub value.
|
136
|
-
MF_ENABLED = nil # Stub value.
|
137
|
-
MF_GRAYED = nil # Stub value.
|
138
|
-
MF_UNCHECKED = nil # Stub value.
|
139
|
-
|
140
142
|
ORIGIN = nil # Stub value.
|
143
|
+
ORIGIN_2D = nil # Stub value.
|
141
144
|
|
142
145
|
PAGE_NO_CAMERA = nil # Stub value.
|
143
146
|
PAGE_USE_ALL = nil # Stub value.
|
@@ -149,10 +152,6 @@
|
|
149
152
|
PAGE_USE_SHADOWINFO = nil # Stub value.
|
150
153
|
PAGE_USE_SKETCHCS = nil # Stub value.
|
151
154
|
|
152
|
-
SB_PROMPT = nil # Stub value.
|
153
|
-
SB_VCB_LABEL = nil # Stub value.
|
154
|
-
SB_VCB_VALUE = nil # Stub value.
|
155
|
-
|
156
155
|
SnapTo_Arbitrary = nil # Stub value.
|
157
156
|
SnapTo_Horizontal = nil # Stub value.
|
158
157
|
SnapTo_Sloped = nil # Stub value.
|
@@ -160,14 +159,24 @@
|
|
160
159
|
|
161
160
|
SKETCHUP_CONSOLE = nil # Stub value.
|
162
161
|
|
163
|
-
|
164
|
-
|
165
|
-
|
162
|
+
SB_PROMPT = nil # Stub value.
|
163
|
+
SB_VCB_LABEL = nil # Stub value.
|
164
|
+
SB_VCB_VALUE = nil # Stub value.
|
166
165
|
|
167
166
|
TextAlignCenter = nil # Stub value.
|
168
167
|
TextAlignLeft = nil # Stub value.
|
169
168
|
TextAlignRight = nil # Stub value.
|
170
169
|
|
170
|
+
TB_HIDDEN = nil # Stub value.
|
171
|
+
TB_NEVER_SHOWN = nil # Stub value.
|
172
|
+
TB_VISIBLE = nil # Stub value.
|
173
|
+
|
174
|
+
VK_ALT = nil # Stub value.
|
175
|
+
VK_COMMAND = nil # Stub value.
|
176
|
+
VK_CONTROL = nil # Stub value.
|
177
|
+
VK_MENU = nil # Stub value.
|
178
|
+
VK_SHIFT = nil # Stub value.
|
179
|
+
|
171
180
|
VK_DELETE = nil # Stub value.
|
172
181
|
VK_DOWN = nil # Stub value.
|
173
182
|
VK_END = nil # Stub value.
|
@@ -180,14 +189,117 @@
|
|
180
189
|
VK_SPACE = nil # Stub value.
|
181
190
|
VK_UP = nil # Stub value.
|
182
191
|
|
183
|
-
VK_ALT = nil # Stub value.
|
184
|
-
VK_COMMAND = nil # Stub value.
|
185
|
-
VK_CONTROL = nil # Stub value.
|
186
|
-
VK_MENU = nil # Stub value.
|
187
|
-
VK_SHIFT = nil # Stub value.
|
188
|
-
|
189
192
|
X_AXIS = nil # Stub value.
|
190
193
|
Y_AXIS = nil # Stub value.
|
191
194
|
Z_AXIS = nil # Stub value.
|
192
195
|
|
196
|
+
X_AXIS_2D = nil # Stub value.
|
197
|
+
|
198
|
+
Y_AXIS_2D = nil # Stub value.
|
199
|
+
|
200
|
+
# Instance Methods
|
201
|
+
|
202
|
+
# This function will add a separator to a given menu the first
|
203
|
+
# time it is called. It is useful for adding a separator before
|
204
|
+
# the first plugin that is added to a given menu.
|
205
|
+
#
|
206
|
+
# @deprecated Avoid adding separators to top level menus. If you require
|
207
|
+
# grouping use a sub-menu instead.
|
208
|
+
#
|
209
|
+
# @param [String] menu_name
|
210
|
+
#
|
211
|
+
# @version SketchUp 6.0
|
212
|
+
def add_separator_to_menu(menu_name)
|
213
|
+
end
|
214
|
+
|
215
|
+
# Call this function at the end of a file that you are loading to
|
216
|
+
# let the system know that you have loaded it.
|
217
|
+
#
|
218
|
+
# @example
|
219
|
+
# module Example
|
220
|
+
# unless file_loaded?(__FILE__)
|
221
|
+
# menu = UI.menu('Plugins')
|
222
|
+
# menu.add_item('Example') { self.hello }
|
223
|
+
# file_loaded(__FILE__)
|
224
|
+
# end
|
225
|
+
#
|
226
|
+
# def self.hello
|
227
|
+
# puts 'Hello World'
|
228
|
+
# end
|
229
|
+
#
|
230
|
+
# end
|
231
|
+
#
|
232
|
+
# @param [String] filename
|
233
|
+
#
|
234
|
+
# @see #file_loaded?
|
235
|
+
#
|
236
|
+
# @version SketchUp 6.0
|
237
|
+
def file_loaded(filename)
|
238
|
+
end
|
239
|
+
|
240
|
+
# Use in combination with {#file_loaded} to create load guards for code you
|
241
|
+
# don't want to reload. Especially useful to protect your UI setup from creating
|
242
|
+
# duplicate menus and toolbars.
|
243
|
+
#
|
244
|
+
# @example
|
245
|
+
# module Example
|
246
|
+
# unless file_loaded?(__FILE__)
|
247
|
+
# menu = UI.menu('Plugins')
|
248
|
+
# menu.add_item('Example') { self.hello }
|
249
|
+
# file_loaded(__FILE__)
|
250
|
+
# end
|
251
|
+
#
|
252
|
+
# def self.hello
|
253
|
+
# puts 'Hello World'
|
254
|
+
# end
|
255
|
+
#
|
256
|
+
# end
|
257
|
+
#
|
258
|
+
# @param [String] filename
|
259
|
+
#
|
260
|
+
# @return [Boolean]
|
261
|
+
#
|
262
|
+
# @see #file_loaded
|
263
|
+
#
|
264
|
+
# @version SketchUp 6.0
|
265
|
+
def file_loaded?(filename)
|
266
|
+
end
|
267
|
+
|
268
|
+
# This is a wrapper for {UI.inputbox}. You call it exactly the same
|
269
|
+
# as {UI.inputbox}. {UI.inputbox} will raise an exception if it can't
|
270
|
+
# convert the string entered for one of the values into the right type.
|
271
|
+
# This method will trap the exception and display an error dialog and
|
272
|
+
# then prompt for the values again.
|
273
|
+
#
|
274
|
+
# @see UI.inputbox
|
275
|
+
#
|
276
|
+
# @version SketchUp 6.0
|
277
|
+
def inputbox(*args)
|
278
|
+
end
|
279
|
+
|
280
|
+
# By default, SketchUp automatically loads (using require) all files with
|
281
|
+
# the .rb extension in the plugins directory. This function can be used
|
282
|
+
# to automatically load all .rb files from a different directory also. to
|
283
|
+
# use this add a call like the following to a file in the plugins directory
|
284
|
+
# <code>require_all "MyRubyScripts"</code>
|
285
|
+
#
|
286
|
+
# @deprecated This adds the path given to +$LOAD_PATH+ which can affect
|
287
|
+
# other extensions.
|
288
|
+
#
|
289
|
+
# @param [String] dirname
|
290
|
+
#
|
291
|
+
# @version SketchUp 6.0
|
292
|
+
def require_all(dirname)
|
293
|
+
end
|
294
|
+
|
295
|
+
# This global method is called by the Ruby Console menu item. We call this
|
296
|
+
# instead of directly calling <code>Sketchup.send_action("showRubyPanel:")</code>
|
297
|
+
# so that other Ruby Console implementations can hijack this method.
|
298
|
+
#
|
299
|
+
# @deprecated Use +SKETCHUP_CONSOLE.show+ instead.
|
300
|
+
#
|
301
|
+
# @version SketchUp 6.0
|
302
|
+
def show_ruby_panel
|
303
|
+
end
|
304
|
+
|
193
305
|
|
@@ -35,15 +35,32 @@ class Array
|
|
35
35
|
|
36
36
|
# The {#cross} method is used to compute the cross product between two vectors.
|
37
37
|
#
|
38
|
-
# @example
|
38
|
+
# @example With 2d array
|
39
|
+
# vector1 = Geom::Vector2d.new(0, 1)
|
40
|
+
# array = [1, 0]
|
41
|
+
# vector2 = array.cross(vector1)
|
42
|
+
#
|
43
|
+
# vector1 = Geom::Vector3d.new(0, 1, 0)
|
44
|
+
# array = [1, 0]
|
45
|
+
# vector2 = array.cross(vector1) # This will force array to be [1, 0, 0]
|
46
|
+
#
|
47
|
+
# @example With 3d array
|
39
48
|
# vector1 = Geom::Vector3d.new(0, 1, 0)
|
40
49
|
# array = [1, 0, 0]
|
41
50
|
# # This will return a new Vector3d
|
42
51
|
# vector2 = array.cross(vector1)
|
43
52
|
#
|
44
|
-
# @
|
53
|
+
# @overload cross(vector)
|
45
54
|
#
|
46
|
-
#
|
55
|
+
# @param [Geom::Vector3d] vector
|
56
|
+
# @return [Geom::Vector3d]
|
57
|
+
#
|
58
|
+
# @overload cross(vector)
|
59
|
+
#
|
60
|
+
# @param [Geom::Vector2d] vector
|
61
|
+
# @return [Geom::Vector2d]
|
62
|
+
#
|
63
|
+
# @raise ArgumentError if the argument is the wrong vector type
|
47
64
|
#
|
48
65
|
# @version SketchUp 6.0
|
49
66
|
def cross(vector)
|
@@ -51,15 +68,31 @@ class Array
|
|
51
68
|
|
52
69
|
# The {#distance} method is used to compute the distance between two points.
|
53
70
|
#
|
54
|
-
# @example
|
71
|
+
# @example With 2d array
|
72
|
+
# point = Geom::Point2d.new(10, 10)
|
73
|
+
# array = [1, 2]
|
74
|
+
# distance = array.distance(point)
|
75
|
+
#
|
76
|
+
# point = Geom::Point3d.new(10, 10, 10)
|
77
|
+
# distance = array.distance(point)
|
78
|
+
#
|
79
|
+
# @example With 3d array
|
55
80
|
# point = Geom::Point3d.new(10, 10, 10)
|
56
81
|
# array = [1, 1, 1]
|
57
82
|
# # This will return a Length
|
58
83
|
# distance = array.distance(point)
|
59
84
|
#
|
60
|
-
# @
|
85
|
+
# @overload distance(point)
|
86
|
+
#
|
87
|
+
# @param [Geom::Point3d] point
|
88
|
+
# @return [Length]
|
89
|
+
#
|
90
|
+
# @overload distance(point)
|
91
|
+
#
|
92
|
+
# @param [Geom::Point2d] point
|
93
|
+
# @return [Length]
|
61
94
|
#
|
62
|
-
# @
|
95
|
+
# @raise ArgumentError if the argument is the wrong point type
|
63
96
|
#
|
64
97
|
# @version SketchUp 6.0
|
65
98
|
def distance(point)
|
@@ -155,15 +188,29 @@ class Array
|
|
155
188
|
|
156
189
|
# The {#dot} method is used to compute the dot product between two vectors.
|
157
190
|
#
|
158
|
-
# @example
|
191
|
+
# @example With 2d array
|
192
|
+
# vector = Geom::Vector2d.new(12, 12)
|
193
|
+
# array = [12, 0]
|
194
|
+
# # This will return a float
|
195
|
+
# dot_product = array.dot(vector)
|
196
|
+
#
|
197
|
+
# @example With 3d array
|
159
198
|
# vector = Geom::Vector3d.new(12, 12, 0)
|
160
199
|
# array = [12, 0, 0]
|
161
200
|
# # This will return a Float, in this case 144.0
|
162
201
|
# dot_product = array.dot(vector)
|
163
202
|
#
|
164
|
-
# @
|
203
|
+
# @overload dot(vector)
|
204
|
+
#
|
205
|
+
# @param [Geom::Vector3d] vector
|
206
|
+
# @return [Float]
|
207
|
+
#
|
208
|
+
# @overload dot(vector)
|
209
|
+
#
|
210
|
+
# @param [Geom::Vector2d] vector
|
211
|
+
# @return [Float]
|
165
212
|
#
|
166
|
-
# @
|
213
|
+
# @raise ArgumentError if the argument is the wrong vector type
|
167
214
|
#
|
168
215
|
# @version SketchUp 6.0
|
169
216
|
def dot(vector)
|
@@ -173,7 +220,11 @@ class Array
|
|
173
220
|
# length to 1). It returns a new array rather than changing the original in
|
174
221
|
# place.
|
175
222
|
#
|
176
|
-
# @example
|
223
|
+
# @example With 2d array
|
224
|
+
# array = [1, 2]
|
225
|
+
# normal_vector = array.normalize
|
226
|
+
#
|
227
|
+
# @example With 3d array
|
177
228
|
# array = [1, 2, 3]
|
178
229
|
# # This will return a new Vector3d
|
179
230
|
# normal_vector = array.normalize
|
@@ -181,7 +232,13 @@ class Array
|
|
181
232
|
# @note The arguments and return value will be converted to a floating point
|
182
233
|
# value. (Unlike in the {Geom::Vector3d#normalize!} method.)
|
183
234
|
#
|
184
|
-
# @
|
235
|
+
# @overload normalize
|
236
|
+
#
|
237
|
+
# @return [Array(Float, Float, Float)] an array object representing a vector
|
238
|
+
#
|
239
|
+
# @overload normalize
|
240
|
+
#
|
241
|
+
# @return [Array(Float, Float)] an array object representing a vector
|
185
242
|
#
|
186
243
|
# @version SketchUp 6.0
|
187
244
|
def normalize
|
@@ -190,12 +247,22 @@ class Array
|
|
190
247
|
# The {#normalize!} method is used to normalize a vector in place (setting its
|
191
248
|
# length to 1).
|
192
249
|
#
|
193
|
-
# @example
|
250
|
+
# @example With 2d array
|
251
|
+
# array = [1, 2]
|
252
|
+
# array.normalize!
|
253
|
+
#
|
254
|
+
# @example With 3d array
|
194
255
|
# array = [1, 2, 3]
|
195
256
|
# # This will modify 'array' in place
|
196
257
|
# array.normalize!
|
197
258
|
#
|
198
|
-
# @
|
259
|
+
# @overload normalize!
|
260
|
+
#
|
261
|
+
# @return [Array(Float, Float, Float)] an array object representing a vector
|
262
|
+
#
|
263
|
+
# @overload normalize!
|
264
|
+
#
|
265
|
+
# @return [Array(Float, Float)] an array object representing a vector
|
199
266
|
#
|
200
267
|
# @version SketchUp 6.0
|
201
268
|
def normalize!
|
@@ -204,22 +271,49 @@ class Array
|
|
204
271
|
# The {#offset} method is used to offset a point by a vector. it returns a new
|
205
272
|
# array rather than modifying the original in place.
|
206
273
|
#
|
207
|
-
# @example
|
274
|
+
# @example With 3d array
|
208
275
|
# array = [10, 10, 10]
|
209
276
|
# vector = Geom::Vector3d.new(0, 0, 1)
|
210
|
-
# # This will
|
211
|
-
#
|
277
|
+
# # This will modify 'array' in place
|
278
|
+
# length_array = array.offset(vector)
|
212
279
|
#
|
213
|
-
# @
|
280
|
+
# @example With 2d array
|
281
|
+
# array = [10, 10]
|
282
|
+
# vector = Geom::Vector2d.new(0, 1)
|
283
|
+
# length_array = array.offset(vector)
|
284
|
+
#
|
285
|
+
# # Using Vector3d with a 2d array
|
286
|
+
# array = [10, 10]
|
287
|
+
# vector = Geom::Vector3d.new(0, 0, 1)
|
288
|
+
# length_array = array.offset(vector)
|
289
|
+
#
|
290
|
+
# @overload offset(vector, length)
|
214
291
|
#
|
215
292
|
# @param [Geom::Vector3d] vector A Vector3d object used to offset the point.
|
216
|
-
# @
|
293
|
+
# @param [Length] length An overriding distance for how far to offset.
|
294
|
+
# @return [Array(Length, Length, Length)] The newly offset array representing
|
295
|
+
# a point or vector.
|
217
296
|
#
|
218
|
-
# @overload offset
|
297
|
+
# @overload offset(vector)
|
298
|
+
#
|
299
|
+
# @param [Geom::Vector2d] vector A Vector2d object used to offset the point.
|
300
|
+
# @return [Array(Length, Length)] The newly offset array representing a point
|
301
|
+
# or vector.
|
302
|
+
#
|
303
|
+
# @overload offset(vector)
|
219
304
|
#
|
220
305
|
# @param [Geom::Vector3d] vector A Vector3d object used to offset the point.
|
306
|
+
# @return [Array(Length, Length, Length)] The newly offset array representing
|
307
|
+
# a point or vector.
|
308
|
+
#
|
309
|
+
# @overload offset(vector, length)
|
310
|
+
#
|
311
|
+
# @param [Geom::Vector2d] vector A Vector2d object used to offset the point.
|
221
312
|
# @param [Length] length An overriding distance for how far to offset.
|
222
|
-
# @return [Array(Length, Length
|
313
|
+
# @return [Array(Length, Length)] The newly offset array representing a point
|
314
|
+
# or vector.
|
315
|
+
#
|
316
|
+
# @raise ArgumentError if the argument is the wrong vector type
|
223
317
|
#
|
224
318
|
# @version SketchUp 6.0
|
225
319
|
def offset(*args)
|
@@ -228,7 +322,17 @@ class Array
|
|
228
322
|
# The {#offset!} method is used to offset a point by a vector. The array is
|
229
323
|
# modified in place.
|
230
324
|
#
|
231
|
-
# @example
|
325
|
+
# @example With 2d array
|
326
|
+
# array = [10, 10]
|
327
|
+
# vector = Geom::Vector2d.new(0, 1)
|
328
|
+
# array.offset!(vector)
|
329
|
+
#
|
330
|
+
# # Using Vector3d with a 2d array
|
331
|
+
# array = [10, 10]
|
332
|
+
# vector = Geom::Vector3d.new(0, 0, 1)
|
333
|
+
# array.offset!(vector)
|
334
|
+
#
|
335
|
+
# @example With 3d array
|
232
336
|
# array = [10, 10, 10]
|
233
337
|
# vector = Geom::Vector3d.new(0, 0, 1)
|
234
338
|
# # This will modify 'array' in place
|
@@ -247,6 +351,21 @@ class Array
|
|
247
351
|
# @return [Array(Length, Length, Length)] The newly offset array representing
|
248
352
|
# a point or vector.
|
249
353
|
#
|
354
|
+
# @overload offset!(vector)
|
355
|
+
#
|
356
|
+
# @param [Geom::Vector2d] vector A Vector2d object used to offset the point.
|
357
|
+
# @return [Array(Length, Length)] The newly offset array representing a point
|
358
|
+
# or vector.
|
359
|
+
#
|
360
|
+
# @overload offset!(vector, length)
|
361
|
+
#
|
362
|
+
# @param [Geom::Vector2d] vector A Vector2d object used to offset the point.
|
363
|
+
# @param [Length] length An overriding distance for how far to offset.
|
364
|
+
# @return [Array(Length, Length)] The newly offset array representing a point
|
365
|
+
# or vector.
|
366
|
+
#
|
367
|
+
# @raise ArgumentError if the argument is the wrong vector type
|
368
|
+
#
|
250
369
|
# @version SketchUp 6.0
|
251
370
|
def offset!(*args)
|
252
371
|
end
|
@@ -471,15 +590,33 @@ class Array
|
|
471
590
|
# The {#vector_to} method is used to create an array as a vector from one point
|
472
591
|
# to a second point.
|
473
592
|
#
|
474
|
-
# @example
|
593
|
+
# @example With 2d array
|
594
|
+
# point = Geom::Point2d.new(10, 20)
|
595
|
+
# array = [1, 2]
|
596
|
+
# # This will return a new Vector2d
|
597
|
+
# vector = array.vector_to(point)
|
598
|
+
#
|
599
|
+
# point = Geom::Point3d.new(10, 20)
|
600
|
+
# # This will return a new Vector3d
|
601
|
+
# vector = array.vector_to(point)
|
602
|
+
#
|
603
|
+
# @example With 3d array
|
475
604
|
# point = Geom::Point3d.new(10, 20, 30)
|
476
605
|
# array = [1, 2, 3]
|
477
606
|
# # This will return a new Vector3d
|
478
607
|
# vector = array.vector_to(point)
|
479
608
|
#
|
480
|
-
# @
|
609
|
+
# @overload vector_to(point)
|
610
|
+
#
|
611
|
+
# @param [Geom::Point3d] point
|
612
|
+
# @return [Geom::Vector3d]
|
613
|
+
#
|
614
|
+
# @overload vector_to(point)
|
615
|
+
#
|
616
|
+
# @param [Geom::Point2d] point
|
617
|
+
# @return [Geom::Vector2d]
|
481
618
|
#
|
482
|
-
# @
|
619
|
+
# @raise ArgumentError if the argument is the wrong point type
|
483
620
|
#
|
484
621
|
# @version SketchUp 6.0
|
485
622
|
def vector_to(point)
|
@@ -511,10 +648,10 @@ class Array
|
|
511
648
|
# # This will initialize the x value as a Fixnum
|
512
649
|
# array.x = 5
|
513
650
|
#
|
514
|
-
# @param x
|
651
|
+
# @param [Object] x
|
515
652
|
# The new x position.
|
516
653
|
#
|
517
|
-
# @return The new x coordinate if successful
|
654
|
+
# @return [Object] The new x coordinate if successful
|
518
655
|
#
|
519
656
|
# @version SketchUp 6.0
|
520
657
|
def x=(x)
|
@@ -546,10 +683,10 @@ class Array
|
|
546
683
|
# # This will initialize the y value as a Fixnum
|
547
684
|
# array.y = 5
|
548
685
|
#
|
549
|
-
# @param y
|
686
|
+
# @param [Object] y
|
550
687
|
# The new y position.
|
551
688
|
#
|
552
|
-
# @return The new y coordinate if successful
|
689
|
+
# @return [Object] The new y coordinate if successful
|
553
690
|
#
|
554
691
|
# @version SketchUp 6.0
|
555
692
|
def y=(y)
|
@@ -581,10 +718,10 @@ class Array
|
|
581
718
|
# # This will initialize the z value as a Fixnum
|
582
719
|
# array.z = 5
|
583
720
|
#
|
584
|
-
# @param z
|
721
|
+
# @param [Object] z
|
585
722
|
# The new z position.
|
586
723
|
#
|
587
|
-
# @return The new z coordinate if successful
|
724
|
+
# @return [Object] The new z coordinate if successful
|
588
725
|
#
|
589
726
|
# @version SketchUp 6.0
|
590
727
|
def z=(z)
|