sketchup-api-stubs 0.5.0 → 0.6.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/lib/sketchup-api-stubs/{autoload.rb → sketchup.rb} +5 -4
- data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +4 -4
- data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +23 -23
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +5 -5
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +3 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +0 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +8 -5
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +18 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +4 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +8 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +8 -8
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +3 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +21 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +1 -5
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +208 -189
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +55 -34
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +3 -0
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +11 -11
- data/lib/sketchup-api-stubs/stubs/array.rb +0 -2
- data/lib/sketchup-api-stubs/stubs/length.rb +69 -17
- data/lib/sketchup-api-stubs/stubs/sketchup.rb +36 -13
- data/lib/sketchup-api-stubs/stubs/ui.rb +3 -3
- metadata +13 -7
@@ -5,6 +5,14 @@
|
|
5
5
|
# get an OptionsProvider from the OptionsManager. The options are given as
|
6
6
|
# name/value pairs.
|
7
7
|
#
|
8
|
+
# List of keys added in different SketchUp versions:
|
9
|
+
#
|
10
|
+
# [+UnitsOptions+] * +AreaUnit+ (SketchUp 2019.1)
|
11
|
+
# * +VolumeUnit+ (SketchUp 2019.1)
|
12
|
+
#
|
13
|
+
# The +AreaUnit+ and +VolumeUnit+ options in +UnitsOptions+ only applies if
|
14
|
+
# the +UnitFormat+ is +Length::Decimal+.
|
15
|
+
#
|
8
16
|
# @version SketchUp 6.0
|
9
17
|
class Sketchup::OptionsProvider
|
10
18
|
|
@@ -173,8 +181,6 @@ class Sketchup::OptionsProvider
|
|
173
181
|
#
|
174
182
|
# @return [Boolean]
|
175
183
|
#
|
176
|
-
# @return [Boolean]
|
177
|
-
#
|
178
184
|
# @see #key?
|
179
185
|
#
|
180
186
|
# @version SketchUp 6.0
|
@@ -194,8 +200,6 @@ class Sketchup::OptionsProvider
|
|
194
200
|
#
|
195
201
|
# @return [Boolean]
|
196
202
|
#
|
197
|
-
# @return [Boolean]
|
198
|
-
#
|
199
203
|
# @see #has_key?
|
200
204
|
#
|
201
205
|
# @version SketchUp 6.0
|
@@ -386,7 +386,7 @@ class Sketchup::Page < Sketchup::Entity
|
|
386
386
|
# page = pages.add "My Page"
|
387
387
|
# status = page.use_axes?
|
388
388
|
#
|
389
|
-
# @return status - true if you are storing the this property with
|
389
|
+
# @return [Boolean] status - true if you are storing the this property with
|
390
390
|
# the page, false if you are not storing this property
|
391
391
|
# with the page.
|
392
392
|
#
|
@@ -422,7 +422,7 @@ class Sketchup::Page < Sketchup::Entity
|
|
422
422
|
# page = pages.add "My Page"
|
423
423
|
# status = page.use_camera?
|
424
424
|
#
|
425
|
-
# @return status - true if you are storing the this property with
|
425
|
+
# @return [Boolean] status - true if you are storing the this property with
|
426
426
|
# the page, false if you are not storing this property
|
427
427
|
# with the page.
|
428
428
|
#
|
@@ -458,7 +458,7 @@ class Sketchup::Page < Sketchup::Entity
|
|
458
458
|
# page = pages.add "My Page"
|
459
459
|
# status = page.use_hidden?
|
460
460
|
#
|
461
|
-
# @return status - true if you are storing the this property with
|
461
|
+
# @return [Boolean] status - true if you are storing the this property with
|
462
462
|
# the page, false if you are not storing this property
|
463
463
|
# with the page.
|
464
464
|
#
|
@@ -495,7 +495,7 @@ class Sketchup::Page < Sketchup::Entity
|
|
495
495
|
# page = pages.add "My Page"
|
496
496
|
# status = page.use_hidden_layers?
|
497
497
|
#
|
498
|
-
# @return status - true if you are storing the this property with
|
498
|
+
# @return [Boolean] status - true if you are storing the this property with
|
499
499
|
# the page, false if you are not storing this property
|
500
500
|
# with the page.
|
501
501
|
#
|
@@ -532,7 +532,7 @@ class Sketchup::Page < Sketchup::Entity
|
|
532
532
|
# page = pages.add "My Page"
|
533
533
|
# status = page.use_rendering_options?
|
534
534
|
#
|
535
|
-
# @return status - true if you are storing the this property with
|
535
|
+
# @return [Boolean] status - true if you are storing the this property with
|
536
536
|
# the page, false if you are not storing this property
|
537
537
|
# with the page.
|
538
538
|
#
|
@@ -569,7 +569,7 @@ class Sketchup::Page < Sketchup::Entity
|
|
569
569
|
# page = pages.add "My Page"
|
570
570
|
# status = page.use_section_planes?
|
571
571
|
#
|
572
|
-
# @return status - true if you are storing the this property with
|
572
|
+
# @return [Boolean] status - true if you are storing the this property with
|
573
573
|
# the page, false if you are not storing this property
|
574
574
|
# with the page.
|
575
575
|
#
|
@@ -605,7 +605,7 @@ class Sketchup::Page < Sketchup::Entity
|
|
605
605
|
# page = pages.add "My Page"
|
606
606
|
# status = page.use_shadow_info?
|
607
607
|
#
|
608
|
-
# @return status - true if you are storing the this property with
|
608
|
+
# @return [Boolean] status - true if you are storing the this property with
|
609
609
|
# the page, false if you are not storing this property
|
610
610
|
# with the page.
|
611
611
|
#
|
@@ -639,7 +639,7 @@ class Sketchup::Page < Sketchup::Entity
|
|
639
639
|
# page = pages.add "My Page"
|
640
640
|
# use_style = page.use_style?
|
641
641
|
#
|
642
|
-
# @return status - true if you are storing the this property with
|
642
|
+
# @return [Boolean] status - true if you are storing the this property with
|
643
643
|
# the page, false if you are not storing this property
|
644
644
|
# with the page.
|
645
645
|
#
|
@@ -27,7 +27,6 @@
|
|
27
27
|
# - +EdgeType+
|
28
28
|
# - +ExtendLines+
|
29
29
|
# - +FaceBackColor+
|
30
|
-
# - +FaceColorMode+
|
31
30
|
# - +FaceFrontColor+
|
32
31
|
# - +FogColor+
|
33
32
|
# - +FogEndDist+
|
@@ -58,6 +57,9 @@
|
|
58
57
|
# - +Texture+
|
59
58
|
# - +TransparencySort+ SketchUp 2017 treats Medium transparency as Faster.
|
60
59
|
#
|
60
|
+
# Removed in SketchUp 2019.1
|
61
|
+
# - +FaceColorMode+ This option was previously included but it was ineffective.
|
62
|
+
#
|
61
63
|
# Added in SketchUp 7:
|
62
64
|
# - +DisplayDims+
|
63
65
|
# - +DisplaySketchAxes+
|
@@ -143,8 +143,6 @@ class Sketchup::Selection
|
|
143
143
|
#
|
144
144
|
# @return [Boolean]
|
145
145
|
#
|
146
|
-
# @return [Boolean]
|
147
|
-
#
|
148
146
|
# @see #include?
|
149
147
|
#
|
150
148
|
# @version SketchUp 6.0
|
@@ -234,6 +232,27 @@ class Sketchup::Selection
|
|
234
232
|
def include?(entity)
|
235
233
|
end
|
236
234
|
|
235
|
+
# The #{invert} method is used to invert the selection.
|
236
|
+
#
|
237
|
+
# @example
|
238
|
+
# model = Sketchup.active_model
|
239
|
+
# entities = model.active_entities
|
240
|
+
# selection = model.selection
|
241
|
+
# # Create a cube
|
242
|
+
# face = entities.add_face([0, 0, 0], [9, 0, 0], [9, 9, 0], [0, 9, 0])
|
243
|
+
# face.pushpull(-9)
|
244
|
+
# # Add the first two faces to the selection
|
245
|
+
# faces = entities.grep(Sketchup::Face).take(2)
|
246
|
+
# selection.add(faces)
|
247
|
+
# # Invert selection
|
248
|
+
# selection.invert
|
249
|
+
#
|
250
|
+
# @return [nil]
|
251
|
+
#
|
252
|
+
# @version SketchUp 2019.2
|
253
|
+
def invert
|
254
|
+
end
|
255
|
+
|
237
256
|
# The is_curve? method is used to determine if the selection contains all
|
238
257
|
# edges that belong to a single curve.
|
239
258
|
#
|
@@ -69,8 +69,6 @@ class Sketchup::Set
|
|
69
69
|
#
|
70
70
|
# @return [Boolean]
|
71
71
|
#
|
72
|
-
# @return [Boolean]
|
73
|
-
#
|
74
72
|
# @see #include?
|
75
73
|
#
|
76
74
|
# @version SketchUp 6.0
|
@@ -118,7 +116,7 @@ class Sketchup::Set
|
|
118
116
|
# set.insert(3)
|
119
117
|
# puts set.empty?
|
120
118
|
#
|
121
|
-
# @return status - true if the set is empty, false if it is not
|
119
|
+
# @return [Boolean] status - true if the set is empty, false if it is not
|
122
120
|
# empty.
|
123
121
|
#
|
124
122
|
# @version SketchUp 6.0
|
@@ -139,8 +137,6 @@ class Sketchup::Set
|
|
139
137
|
#
|
140
138
|
# @return [Boolean]
|
141
139
|
#
|
142
|
-
# @return [Boolean]
|
143
|
-
#
|
144
140
|
# @see #contains?
|
145
141
|
#
|
146
142
|
# @version SketchUp 6.0
|
@@ -2,8 +2,8 @@
|
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
4
|
# Tool is the interface that you implement to create a SketchUp tool.
|
5
|
-
# See
|
6
|
-
#
|
5
|
+
# See https://github.com/SketchUp/sketchup-ruby-api-tutorials/tree/master/examples/02_custom_tool
|
6
|
+
# for an example of how to create a custom tool in Ruby.
|
7
7
|
#
|
8
8
|
# To create a new tool in Ruby, you must define a new class that implements
|
9
9
|
# the methods for the events that you want to respond to. You do not have
|
@@ -37,7 +37,7 @@ class Sketchup::Tool
|
|
37
37
|
|
38
38
|
# Instance Methods
|
39
39
|
|
40
|
-
# The activate method is called by SketchUp when the tool is selected.
|
40
|
+
# The #{activate} method is called by SketchUp when the tool is selected.
|
41
41
|
# It is a good place to put most of your initialization, such as instance
|
42
42
|
# variables to track the state of the tool.
|
43
43
|
#
|
@@ -46,13 +46,11 @@ class Sketchup::Tool
|
|
46
46
|
# puts 'Your tool has been activated.'
|
47
47
|
# end
|
48
48
|
#
|
49
|
-
# @return nil
|
50
|
-
#
|
51
49
|
# @version SketchUp 6.0
|
52
50
|
def activate
|
53
51
|
end
|
54
52
|
|
55
|
-
# The deactivate method is called when the tool is deactivated because a
|
53
|
+
# The #{deactivate} method is called when the tool is deactivated because a
|
56
54
|
# different tool was selected.
|
57
55
|
#
|
58
56
|
# @example
|
@@ -60,10 +58,7 @@ class Sketchup::Tool
|
|
60
58
|
# puts "Your tool has been deactivated in view: #{view}"
|
61
59
|
# end
|
62
60
|
#
|
63
|
-
# @param view
|
64
|
-
# A View object where the method was invoked.
|
65
|
-
#
|
66
|
-
# @return nil
|
61
|
+
# @param [Sketchup::View] view
|
67
62
|
#
|
68
63
|
# @version SketchUp 6.0
|
69
64
|
def deactivate(view)
|
@@ -99,8 +94,6 @@ class Sketchup::Tool
|
|
99
94
|
# @param [Sketchup::View] view
|
100
95
|
# A View object where the method was invoked.
|
101
96
|
#
|
102
|
-
# @return nil
|
103
|
-
#
|
104
97
|
# @see getExtents
|
105
98
|
#
|
106
99
|
# @see Sketchup::View#draw
|
@@ -109,8 +102,8 @@ class Sketchup::Tool
|
|
109
102
|
def draw(view)
|
110
103
|
end
|
111
104
|
|
112
|
-
# The enableVCB? method is used to tell SketchUp whether to allow the user
|
113
|
-
# enter text into the VCB (value control box, aka the "measurements" panel).
|
105
|
+
# The #{enableVCB?} method is used to tell SketchUp whether to allow the user
|
106
|
+
# to enter text into the VCB (value control box, aka the "measurements" panel).
|
114
107
|
# If you do not implement this method, then the vcb is disabled by default.
|
115
108
|
#
|
116
109
|
# @example
|
@@ -119,7 +112,7 @@ class Sketchup::Tool
|
|
119
112
|
# return true
|
120
113
|
# end
|
121
114
|
#
|
122
|
-
# @return
|
115
|
+
# @return [Boolean] Return +true+ if you want the VCB enabled
|
123
116
|
#
|
124
117
|
# @version SketchUp 6.0
|
125
118
|
def enableVCB?
|
@@ -132,9 +125,9 @@ class Sketchup::Tool
|
|
132
125
|
# the tool is drawing gets clipped to the extents of the rest of the
|
133
126
|
# model.
|
134
127
|
#
|
135
|
-
# This must return a BoundingBox. In a typical implementation, you
|
136
|
-
# will create a new BoundingBox, add points to set the extents of the
|
137
|
-
# that the tool will do and then return it.
|
128
|
+
# This must return a {Geom::BoundingBox}. In a typical implementation, you
|
129
|
+
# will create a new {Geom::BoundingBox}, add points to set the extents of the
|
130
|
+
# drawing that the tool will do and then return it.
|
138
131
|
#
|
139
132
|
# @example
|
140
133
|
# def getExtents
|
@@ -142,23 +135,18 @@ class Sketchup::Tool
|
|
142
135
|
# return bb
|
143
136
|
# end
|
144
137
|
#
|
145
|
-
# @return BoundingBox
|
138
|
+
# @return [Geom::BoundingBox]
|
146
139
|
#
|
147
140
|
# @version SketchUp 6.0
|
148
141
|
def getExtents
|
149
142
|
end
|
150
143
|
|
151
|
-
# The getInstructorContentDirectory method is used to tell SketchUp the
|
144
|
+
# The #{getInstructorContentDirectory} method is used to tell SketchUp the
|
152
145
|
# directory containing your Tool's instructor content. To use this, create
|
153
146
|
# a custom instructor directory, put an index.html file inside of it, and then
|
154
147
|
# return that path via this method. If the SketchUp user has the Instructor
|
155
148
|
# window open when they activate your tool, they will see your html file.
|
156
149
|
#
|
157
|
-
# NOTE: Prior to SketchUp 2014 this method would assume the path was relative
|
158
|
-
# to the SketchUp resource folder. From 2014 and onwards you can specify the
|
159
|
-
# absolute path to an HTML file or the absolute path to a directory containing
|
160
|
-
# an index.html file.
|
161
|
-
#
|
162
150
|
# @example
|
163
151
|
# def getInstructorContentDirectory
|
164
152
|
# extension_path = Sketchup.extensions['MyExtension].extension_path
|
@@ -166,14 +154,18 @@ class Sketchup::Tool
|
|
166
154
|
# return instructor_path
|
167
155
|
# end
|
168
156
|
#
|
169
|
-
# @
|
170
|
-
#
|
157
|
+
# @note Prior to SketchUp 2014 this method would assume the path was relative
|
158
|
+
# to the SketchUp resource folder. From 2014 and onwards you can specify the
|
159
|
+
# absolute path to an HTML file or the absolute path to a directory
|
160
|
+
# containing an index.html file.
|
161
|
+
#
|
162
|
+
# @return [String] the directory path where the Instructor content exists.
|
171
163
|
#
|
172
164
|
# @version SketchUp 6.0
|
173
165
|
def getInstructorContentDirectory
|
174
166
|
end
|
175
167
|
|
176
|
-
# The getMenu method is called by SketchUp to let the tool provide its own
|
168
|
+
# The #{getMenu} method is called by SketchUp to let the tool provide its own
|
177
169
|
# context menu. Most tools will not want to implement this method and,
|
178
170
|
# instead, use the normal context menu found on all entities.
|
179
171
|
#
|
@@ -263,13 +255,11 @@ class Sketchup::Tool
|
|
263
255
|
#
|
264
256
|
# @param [Sketchup::View] view
|
265
257
|
#
|
266
|
-
# @return [nil]
|
267
|
-
#
|
268
258
|
# @version SketchUp 6.0
|
269
259
|
def onCancel(reason, view)
|
270
260
|
end
|
271
261
|
|
272
|
-
# The onKeyDown method is called by SketchUp when the user presses a key on
|
262
|
+
# The #{onKeyDown} method is called by SketchUp when the user presses a key on
|
273
263
|
# the keyboard. If you want to get input from the VCB, you should implement
|
274
264
|
# onUserText rather than this method.
|
275
265
|
#
|
@@ -309,28 +299,29 @@ class Sketchup::Tool
|
|
309
299
|
# puts " view = #{view}"
|
310
300
|
# end
|
311
301
|
#
|
312
|
-
# @param key
|
302
|
+
# @param [Integer] key
|
313
303
|
# The key that was pressed.
|
314
304
|
#
|
315
|
-
# @param repeat
|
316
|
-
# A value of 1 for a single press of a key. A value
|
317
|
-
# if the user has pressed a key and is holding
|
305
|
+
# @param [Integer] repeat
|
306
|
+
# A value of 1 for a single press of a key. A value
|
307
|
+
# of 2 if the user has pressed a key and is holding
|
308
|
+
# it down.
|
318
309
|
#
|
319
|
-
# @param flags
|
320
|
-
# A bit mask that tells the state of the modifier
|
321
|
-
# the time of the
|
310
|
+
# @param [Integer] flags
|
311
|
+
# A bit mask that tells the state of the modifier
|
312
|
+
# keys at the time of the event.
|
322
313
|
#
|
323
|
-
# @param view
|
324
|
-
# A View object where the method was invoked.
|
314
|
+
# @param [Sketchup::View] view
|
325
315
|
#
|
326
|
-
# @return
|
316
|
+
# @return [Boolean] Return +true+ to prevent SketchUp from processing the
|
317
|
+
# event.
|
327
318
|
#
|
328
319
|
# @version SketchUp 6.0
|
329
320
|
def onKeyDown(key, repeat, flags, view)
|
330
321
|
end
|
331
322
|
|
332
|
-
# The onKeyUp method is called by SketchUp when the user releases a key on
|
333
|
-
# keyboard.
|
323
|
+
# The #{onKeyUp} method is called by SketchUp when the user releases a key on
|
324
|
+
# the keyboard.
|
334
325
|
#
|
335
326
|
# @example
|
336
327
|
# def onKeyUp(key, repeat, flags, view)
|
@@ -340,27 +331,28 @@ class Sketchup::Tool
|
|
340
331
|
# puts " view = #{view}"
|
341
332
|
# end
|
342
333
|
#
|
343
|
-
# @param key
|
334
|
+
# @param [Integer] key
|
344
335
|
# The key that was pressed.
|
345
336
|
#
|
346
|
-
# @param repeat
|
347
|
-
# A value of 1 for a single press of a key. A value
|
348
|
-
# if the user has pressed a key and is holding
|
337
|
+
# @param [Integer] repeat
|
338
|
+
# A value of 1 for a single press of a key. A value
|
339
|
+
# of 2 if the user has pressed a key and is holding
|
340
|
+
# it down.
|
349
341
|
#
|
350
|
-
# @param flags
|
351
|
-
# A bit mask that tells the state of the modifier
|
352
|
-
# the time of the
|
342
|
+
# @param [Integer] flags
|
343
|
+
# A bit mask that tells the state of the modifier
|
344
|
+
# keys at the time of the event.
|
353
345
|
#
|
354
|
-
# @param view
|
355
|
-
# A View object where the method was invoked.
|
346
|
+
# @param [Sketchup::View] view
|
356
347
|
#
|
357
|
-
# @return
|
348
|
+
# @return [Boolean] Return +true+ to prevent SketchUp from processing the
|
349
|
+
# event.
|
358
350
|
#
|
359
351
|
# @version SketchUp 6.0
|
360
352
|
def onKeyUp(key, repeat, flags, view)
|
361
353
|
end
|
362
354
|
|
363
|
-
# The onLButtonDoubleClick is called by SketchUp when the user double clicks
|
355
|
+
# The #{onLButtonDoubleClick} is called by SketchUp when the user double clicks
|
364
356
|
# with the left mouse button.
|
365
357
|
#
|
366
358
|
# @example
|
@@ -371,27 +363,24 @@ class Sketchup::Tool
|
|
371
363
|
# puts " view = #{view}"
|
372
364
|
# end
|
373
365
|
#
|
374
|
-
# @param flags
|
375
|
-
# A bit mask that tells the state of the modifier
|
376
|
-
# and other mouse buttons at the time.
|
366
|
+
# @param [Integer] flags
|
367
|
+
# A bit mask that tells the state of the modifier
|
368
|
+
# keys and other mouse buttons at the time.
|
377
369
|
#
|
378
|
-
# @param x
|
370
|
+
# @param [Integer] x
|
379
371
|
# The X coordinate on the screen where the event occurred.
|
380
372
|
#
|
381
|
-
# @param y
|
373
|
+
# @param [Integer] y
|
382
374
|
# The Y coordinate on the screen where the event occurred.
|
383
375
|
#
|
384
|
-
# @param view
|
385
|
-
# A View object where the method was invoked.
|
386
|
-
#
|
387
|
-
# @return nil
|
376
|
+
# @param [Sketchup::View] view
|
388
377
|
#
|
389
378
|
# @version SketchUp 6.0
|
390
379
|
def onLButtonDoubleClick(flags, x, y, view)
|
391
380
|
end
|
392
381
|
|
393
|
-
# The onLButtonDown method is called by SketchUp when the left mouse button
|
394
|
-
# pressed. Most tools will implement this method.
|
382
|
+
# The #{onLButtonDown} method is called by SketchUp when the left mouse button
|
383
|
+
# is pressed. Most tools will implement this method.
|
395
384
|
#
|
396
385
|
# @example
|
397
386
|
# def onLButtonDown(flags, x, y, view)
|
@@ -401,26 +390,23 @@ class Sketchup::Tool
|
|
401
390
|
# puts " view = #{view}"
|
402
391
|
# end
|
403
392
|
#
|
404
|
-
# @param flags
|
405
|
-
# A bit mask that tells the state of the modifier
|
406
|
-
# other mouse buttons at the time.
|
393
|
+
# @param [Integer] flags
|
394
|
+
# A bit mask that tells the state of the modifier
|
395
|
+
# keys and other mouse buttons at the time.
|
407
396
|
#
|
408
|
-
# @param x
|
397
|
+
# @param [Integer] x
|
409
398
|
# The X coordinate on the screen where the event occurred.
|
410
399
|
#
|
411
|
-
# @param y
|
400
|
+
# @param [Integer] y
|
412
401
|
# The Y coordinate on the screen where the event occurred.
|
413
402
|
#
|
414
|
-
# @param view
|
415
|
-
# A View object where the method was invoked.
|
416
|
-
#
|
417
|
-
# @return nil
|
403
|
+
# @param [Sketchup::View] view
|
418
404
|
#
|
419
405
|
# @version SketchUp 6.0
|
420
406
|
def onLButtonDown(flags, x, y, view)
|
421
407
|
end
|
422
408
|
|
423
|
-
# The onLButtonUp method is called by SketchUp when the left mouse button is
|
409
|
+
# The #{onLButtonUp} method is called by SketchUp when the left mouse button is
|
424
410
|
# released.
|
425
411
|
#
|
426
412
|
# @example
|
@@ -431,32 +417,24 @@ class Sketchup::Tool
|
|
431
417
|
# puts " view = #{view}"
|
432
418
|
# end
|
433
419
|
#
|
434
|
-
# @param flags
|
435
|
-
# A bit mask that tells the state of the modifier
|
436
|
-
# other mouse buttons at the time.
|
420
|
+
# @param [Integer] flags
|
421
|
+
# A bit mask that tells the state of the modifier
|
422
|
+
# keys and other mouse buttons at the time.
|
437
423
|
#
|
438
|
-
# @param x
|
424
|
+
# @param [Integer] x
|
439
425
|
# The X coordinate on the screen where the event occurred.
|
440
426
|
#
|
441
|
-
# @param y
|
427
|
+
# @param [Integer] y
|
442
428
|
# The Y coordinate on the screen where the event occurred.
|
443
429
|
#
|
444
|
-
# @param view
|
445
|
-
# A View object where the method was invoked.
|
446
|
-
#
|
447
|
-
# @return nil
|
430
|
+
# @param [Sketchup::View] view
|
448
431
|
#
|
449
432
|
# @version SketchUp 6.0
|
450
433
|
def onLButtonUp(flags, x, y, view)
|
451
434
|
end
|
452
435
|
|
453
|
-
#
|
454
|
-
#
|
455
|
-
# for now in the hopes of fixing the implementation, but you won't have any
|
456
|
-
# luck trying to use it in SU7 and earlier.
|
457
|
-
#
|
458
|
-
# The onMButtonDoubleClick method is called by SketchUp when the middle mouse
|
459
|
-
# button (on a three button mouse) is double-clicked.
|
436
|
+
# The #{onMButtonDoubleClick} method is called by SketchUp when the middle
|
437
|
+
# mouse button (on a three button mouse) is double-clicked.
|
460
438
|
#
|
461
439
|
# Only implement this method if you want SketchUp to react to a middle mouse
|
462
440
|
# button being double-clicked.
|
@@ -469,27 +447,29 @@ class Sketchup::Tool
|
|
469
447
|
# puts " view = #{view}"
|
470
448
|
# end
|
471
449
|
#
|
472
|
-
# @
|
473
|
-
#
|
474
|
-
#
|
450
|
+
# @note Though this method has been documented in the Ruby API for many years,
|
451
|
+
# it has never worked properly. We are leaving this documentation in place
|
452
|
+
# for now in the hopes of fixing the implementation, but you won't have any
|
453
|
+
# luck trying to use it in SU7 and earlier.
|
454
|
+
#
|
455
|
+
# @param [Integer] flags
|
456
|
+
# A bit mask that tells the state of the modifier
|
457
|
+
# keys and other mouse buttons at the time.
|
475
458
|
#
|
476
|
-
# @param x
|
459
|
+
# @param [Integer] x
|
477
460
|
# The X coordinate on the screen where the event occurred.
|
478
461
|
#
|
479
|
-
# @param y
|
462
|
+
# @param [Integer] y
|
480
463
|
# The Y coordinate on the screen where the event occurred.
|
481
464
|
#
|
482
|
-
# @param view
|
483
|
-
# A View object where the method was invoked.
|
484
|
-
#
|
485
|
-
# @return nil
|
465
|
+
# @param [Sketchup::View] view
|
486
466
|
#
|
487
467
|
# @version SketchUp 6.0
|
488
468
|
def onMButtonDoubleClick(flags, x, y, view)
|
489
469
|
end
|
490
470
|
|
491
|
-
# The onMButtonDown method is called by SketchUp when the middle mouse
|
492
|
-
# (on a three button mouse) is down.
|
471
|
+
# The #{onMButtonDown} method is called by SketchUp when the middle mouse
|
472
|
+
# button (on a three button mouse) is down.
|
493
473
|
#
|
494
474
|
# The Orbit tool is activated by default when the middle mouse button is down.
|
495
475
|
# Implement this method if you want a middle mouse button to do something
|
@@ -503,26 +483,23 @@ class Sketchup::Tool
|
|
503
483
|
# puts " view = #{view}"
|
504
484
|
# end
|
505
485
|
#
|
506
|
-
# @param flags
|
507
|
-
# A bit mask that tells the state of the modifier
|
508
|
-
# other mouse buttons at the time.
|
486
|
+
# @param [Integer] flags
|
487
|
+
# A bit mask that tells the state of the modifier
|
488
|
+
# keys and other mouse buttons at the time.
|
509
489
|
#
|
510
|
-
# @param x
|
490
|
+
# @param [Integer] x
|
511
491
|
# The X coordinate on the screen where the event occurred.
|
512
492
|
#
|
513
|
-
# @param y
|
493
|
+
# @param [Integer] y
|
514
494
|
# The Y coordinate on the screen where the event occurred.
|
515
495
|
#
|
516
|
-
# @param view
|
517
|
-
# A View object where the method was invoked.
|
518
|
-
#
|
519
|
-
# @return nil
|
496
|
+
# @param [Sketchup::View] view
|
520
497
|
#
|
521
498
|
# @version SketchUp 6.0
|
522
499
|
def onMButtonDown(flags, x, y, view)
|
523
500
|
end
|
524
501
|
|
525
|
-
# The onMButtonUp method is called by SketchUp when the middle mouse button
|
502
|
+
# The #{onMButtonUp} method is called by SketchUp when the middle mouse button
|
526
503
|
# (on a three button mouse) is released.
|
527
504
|
#
|
528
505
|
# SketchUp returns to the previous tool from the Orbit tool when the middle
|
@@ -538,60 +515,51 @@ class Sketchup::Tool
|
|
538
515
|
# puts " view = #{view}"
|
539
516
|
# end
|
540
517
|
#
|
541
|
-
# @param flags
|
542
|
-
# A bit mask that tells the state of the modifier
|
543
|
-
# other mouse buttons at the time.
|
518
|
+
# @param [Integer] flags
|
519
|
+
# A bit mask that tells the state of the modifier
|
520
|
+
# keys and other mouse buttons at the time.
|
544
521
|
#
|
545
|
-
# @param x
|
522
|
+
# @param [Integer] x
|
546
523
|
# The X coordinate on the screen where the event occurred.
|
547
524
|
#
|
548
|
-
# @param y
|
525
|
+
# @param [Integer] y
|
549
526
|
# The Y coordinate on the screen where the event occurred.
|
550
527
|
#
|
551
|
-
# @param view
|
552
|
-
# A View object where the method was invoked.
|
553
|
-
#
|
554
|
-
# @return nil
|
528
|
+
# @param [Sketchup::View] view
|
555
529
|
#
|
556
530
|
# @version SketchUp 6.0
|
557
531
|
def onMButtonUp(flags, x, y, view)
|
558
532
|
end
|
559
533
|
|
560
|
-
# The onMouseEnter method is called by SketchUp when the mouse enters the
|
561
|
-
#
|
534
|
+
# The #{onMouseEnter} method is called by SketchUp when the mouse enters the
|
535
|
+
# viewport.
|
562
536
|
#
|
563
537
|
# @example
|
564
538
|
# def onMouseEnter(view)
|
565
539
|
# puts "onMouseEnter: view = #{view}"
|
566
540
|
# end
|
567
541
|
#
|
568
|
-
# @param view
|
569
|
-
# A View object where the method was invoked.
|
570
|
-
#
|
571
|
-
# @return nil
|
542
|
+
# @param [Sketchup::View] view
|
572
543
|
#
|
573
544
|
# @version SketchUp 6.0
|
574
545
|
def onMouseEnter(view)
|
575
546
|
end
|
576
547
|
|
577
|
-
# The onMouseLeave method is called by SketchUp when the mouse leaves the
|
578
|
-
#
|
548
|
+
# The #{onMouseLeave} method is called by SketchUp when the mouse leaves the
|
549
|
+
# viewport.
|
579
550
|
#
|
580
551
|
# @example
|
581
552
|
# def onMouseLeave(view)
|
582
553
|
# puts "onMouseLeave: view = #{view}"
|
583
554
|
# end
|
584
555
|
#
|
585
|
-
# @param view
|
586
|
-
# A View object where the method was invoked.
|
587
|
-
#
|
588
|
-
# @return nil
|
556
|
+
# @param [Sketchup::View] view
|
589
557
|
#
|
590
558
|
# @version SketchUp 6.0
|
591
559
|
def onMouseLeave(view)
|
592
560
|
end
|
593
561
|
|
594
|
-
# The onMouseMove method is called by SketchUp whenever the mouse is moved.
|
562
|
+
# The #{onMouseMove} method is called by SketchUp whenever the mouse is moved.
|
595
563
|
# You will often want to implement this method.
|
596
564
|
#
|
597
565
|
# Try to make this method as efficient as possible because this method is
|
@@ -605,26 +573,94 @@ class Sketchup::Tool
|
|
605
573
|
# puts " view = #{view}"
|
606
574
|
# end
|
607
575
|
#
|
608
|
-
# @param flags
|
609
|
-
# A bit mask that tells the state of the modifier
|
610
|
-
# other mouse buttons at the time.
|
576
|
+
# @param [Integer] flags
|
577
|
+
# A bit mask that tells the state of the modifier
|
578
|
+
# keys and other mouse buttons at the time.
|
611
579
|
#
|
612
|
-
# @param x
|
580
|
+
# @param [Integer] x
|
613
581
|
# The X coordinate on the screen where the event occurred.
|
614
582
|
#
|
615
|
-
# @param y
|
583
|
+
# @param [Integer] y
|
616
584
|
# The Y coordinate on the screen where the event occurred.
|
617
585
|
#
|
618
|
-
# @param view
|
619
|
-
# A View object where the method was invoked.
|
620
|
-
#
|
621
|
-
# @return nil
|
586
|
+
# @param [Sketchup::View] view
|
622
587
|
#
|
623
588
|
# @version SketchUp 6.0
|
624
589
|
def onMouseMove(flags, x, y, view)
|
625
590
|
end
|
626
591
|
|
627
|
-
# The
|
592
|
+
# The #{onMouseWheel} method is called by SketchUp when the mouse scroll wheel
|
593
|
+
# is used.
|
594
|
+
#
|
595
|
+
# @example
|
596
|
+
# class ExampleTool
|
597
|
+
#
|
598
|
+
# def initialize
|
599
|
+
# @property_value = 0
|
600
|
+
# @rect = [
|
601
|
+
# Geom::Point3d.new(100, 150, 0),
|
602
|
+
# Geom::Point3d.new(300, 150, 0),
|
603
|
+
# Geom::Point3d.new(300, 250, 0),
|
604
|
+
# Geom::Point3d.new(100, 250, 0),
|
605
|
+
# ]
|
606
|
+
# end
|
607
|
+
#
|
608
|
+
# def onMouseMove(flags, x, y, view)
|
609
|
+
# view.invalidate
|
610
|
+
# end
|
611
|
+
#
|
612
|
+
# def onMouseWheel(flags, delta, x, y, view)
|
613
|
+
# # If the cursor is not within the bounds of the rectangle, return false
|
614
|
+
# # to let SketchUp do its default action (zoom).
|
615
|
+
# point = Geom::Point3d.new(x, y)
|
616
|
+
# return false unless Geom.point_in_polygon_2D(point, @rect, true)
|
617
|
+
#
|
618
|
+
# # If cursor is within the bounds of the rectangle, update the value
|
619
|
+
# # and prevent the default zoom.
|
620
|
+
# @property_value += delta
|
621
|
+
# view.invalidate
|
622
|
+
# true
|
623
|
+
# end
|
624
|
+
#
|
625
|
+
# def draw(view)
|
626
|
+
# view.line_width = 2
|
627
|
+
# view.line_stipple = ''
|
628
|
+
# view.drawing_color = 'red'
|
629
|
+
# view.draw2d(GL_QUADS, @rect)
|
630
|
+
#
|
631
|
+
# point = Geom::Point3d.new(120, 170)
|
632
|
+
# view.draw_text(point, "Value: #{@property_value}",
|
633
|
+
# size: 20, bold: true, color: 'black')
|
634
|
+
# end
|
635
|
+
#
|
636
|
+
# end
|
637
|
+
#
|
638
|
+
# Sketchup.active_model.select_tool(ExampleTool.new)
|
639
|
+
#
|
640
|
+
# @param [Integer] flags
|
641
|
+
# A bit mask that tells the state of the modifier
|
642
|
+
# keys and other mouse buttons at the time.
|
643
|
+
#
|
644
|
+
# @param [Integer] delta
|
645
|
+
# Either +1+ or +-1+ depending on which direction the
|
646
|
+
# mouse wheel scrolled.
|
647
|
+
#
|
648
|
+
# @param [Float] x
|
649
|
+
# The X coordinate on the screen where the event occurred.
|
650
|
+
#
|
651
|
+
# @param [Float] y
|
652
|
+
# The Y coordinate on the screen where the event occurred.
|
653
|
+
#
|
654
|
+
# @param [Sketchup::View] view
|
655
|
+
#
|
656
|
+
# @return [Boolean] Return +true+ to prevent SketchUp from performing default
|
657
|
+
# zoom action.
|
658
|
+
#
|
659
|
+
# @version SketchUp 2019.2
|
660
|
+
def onMouseWheel(flags, delta, x, y, view)
|
661
|
+
end
|
662
|
+
|
663
|
+
# The #{onRButtonDoubleClick} is called by SketchUp when the user double clicks
|
628
664
|
# with the right mouse button.
|
629
665
|
#
|
630
666
|
# @example
|
@@ -635,26 +671,23 @@ class Sketchup::Tool
|
|
635
671
|
# puts " view = #{view}"
|
636
672
|
# end
|
637
673
|
#
|
638
|
-
# @param flags
|
639
|
-
# A bit mask that tells the state of the modifier
|
640
|
-
# other mouse buttons at the time.
|
674
|
+
# @param [Integer] flags
|
675
|
+
# A bit mask that tells the state of the modifier
|
676
|
+
# keys and other mouse buttons at the time.
|
641
677
|
#
|
642
|
-
# @param x
|
678
|
+
# @param [Integer] x
|
643
679
|
# The X coordinate on the screen where the event occurred.
|
644
680
|
#
|
645
|
-
# @param y
|
681
|
+
# @param [Integer] y
|
646
682
|
# The Y coordinate on the screen where the event occurred.
|
647
683
|
#
|
648
|
-
# @param view
|
649
|
-
# A View object where the method was invoked.
|
650
|
-
#
|
651
|
-
# @return nil
|
684
|
+
# @param [Sketchup::View] view
|
652
685
|
#
|
653
686
|
# @version SketchUp 6.0
|
654
687
|
def onRButtonDoubleClick(flags, x, y, view)
|
655
688
|
end
|
656
689
|
|
657
|
-
# The onRButtonDown method is called by SketchUp when the user presses
|
690
|
+
# The #{onRButtonDown} method is called by SketchUp when the user presses
|
658
691
|
# the right mouse button. Implement this method, along with the tool.getMenu
|
659
692
|
# method, when you want your tool to do something other than display the
|
660
693
|
# default context menu when the right mouse button is clicked.
|
@@ -667,26 +700,23 @@ class Sketchup::Tool
|
|
667
700
|
# puts " view = #{view}"
|
668
701
|
# end
|
669
702
|
#
|
670
|
-
# @param flags
|
671
|
-
# A bit mask that tells the state of the modifier
|
672
|
-
# other mouse buttons at the time.
|
703
|
+
# @param [Integer] flags
|
704
|
+
# A bit mask that tells the state of the modifier
|
705
|
+
# keys and other mouse buttons at the time.
|
673
706
|
#
|
674
|
-
# @param x
|
707
|
+
# @param [Integer] x
|
675
708
|
# The X coordinate on the screen where the event occurred.
|
676
709
|
#
|
677
|
-
# @param y
|
710
|
+
# @param [Integer] y
|
678
711
|
# The Y coordinate on the screen where the event occurred.
|
679
712
|
#
|
680
|
-
# @param view
|
681
|
-
# A View object where the method was invoked.
|
682
|
-
#
|
683
|
-
# @return nil
|
713
|
+
# @param [Sketchup::View] view
|
684
714
|
#
|
685
715
|
# @version SketchUp 6.0
|
686
716
|
def onRButtonDown(flags, x, y, view)
|
687
717
|
end
|
688
718
|
|
689
|
-
# The onRButtonUp method is called by SketchUp when the user releases the
|
719
|
+
# The #{onRButtonUp} method is called by SketchUp when the user releases the
|
690
720
|
# right mouse button.
|
691
721
|
#
|
692
722
|
# @example
|
@@ -697,20 +727,17 @@ class Sketchup::Tool
|
|
697
727
|
# puts " view = #{view}"
|
698
728
|
# end
|
699
729
|
#
|
700
|
-
# @param flags
|
701
|
-
# A bit mask that tells the state of the modifier
|
702
|
-
# other mouse buttons at the time.
|
730
|
+
# @param [Integer] flags
|
731
|
+
# A bit mask that tells the state of the modifier
|
732
|
+
# keys and other mouse buttons at the time.
|
703
733
|
#
|
704
|
-
# @param x
|
734
|
+
# @param [Integer] x
|
705
735
|
# The X coordinate on the screen where the event occurred.
|
706
736
|
#
|
707
|
-
# @param y
|
737
|
+
# @param [Integer] y
|
708
738
|
# The Y coordinate on the screen where the event occurred.
|
709
739
|
#
|
710
|
-
# @param view
|
711
|
-
# A View object where the method was invoked.
|
712
|
-
#
|
713
|
-
# @return nil
|
740
|
+
# @param [Sketchup::View] view
|
714
741
|
#
|
715
742
|
# @version SketchUp 6.0
|
716
743
|
def onRButtonUp(flags, x, y, view)
|
@@ -733,17 +760,17 @@ class Sketchup::Tool
|
|
733
760
|
def onReturn(view)
|
734
761
|
end
|
735
762
|
|
736
|
-
# The onSetCursor method is called by SketchUp when the tool wants to set
|
737
|
-
# cursor.
|
763
|
+
# The #{onSetCursor} method is called by SketchUp when the tool wants to set
|
764
|
+
# the cursor.
|
738
765
|
#
|
739
766
|
# @example
|
740
767
|
# def onSetCursor
|
741
768
|
# puts "onSetCursor: view = #{view}"
|
742
769
|
# # You would set your cursor here. See UI.set_cursor method.
|
743
|
-
# UI.set_cursor(@cursor_id)
|
770
|
+
# UI.set_cursor(@cursor_id) # UI.set_cursor return true
|
744
771
|
# end
|
745
772
|
#
|
746
|
-
# @return
|
773
|
+
# @return [Boolean] Return +true+ to prevent SketchUp using the default cursor.
|
747
774
|
#
|
748
775
|
# @version SketchUp 6.0
|
749
776
|
def onSetCursor
|
@@ -765,13 +792,11 @@ class Sketchup::Tool
|
|
765
792
|
# @param [Sketchup::View] view
|
766
793
|
# A view object where the method was invoked.
|
767
794
|
#
|
768
|
-
# @return [nil]
|
769
|
-
#
|
770
795
|
# @version SketchUp 6.0
|
771
796
|
def onUserText(text, view)
|
772
797
|
end
|
773
798
|
|
774
|
-
# The resume method is called by SketchUp when the tool becomes active again
|
799
|
+
# The #{resume} method is called by SketchUp when the tool becomes active again
|
775
800
|
# after being suspended.
|
776
801
|
#
|
777
802
|
# @example
|
@@ -779,16 +804,13 @@ class Sketchup::Tool
|
|
779
804
|
# puts "resume: view = #{view}"
|
780
805
|
# end
|
781
806
|
#
|
782
|
-
# @param view
|
783
|
-
# A View object where the method was invoked.
|
784
|
-
#
|
785
|
-
# @return nil
|
807
|
+
# @param [Sketchup::View] view
|
786
808
|
#
|
787
809
|
# @version SketchUp 6.0
|
788
810
|
def resume(view)
|
789
811
|
end
|
790
812
|
|
791
|
-
# The suspend method is called by SketchUp when the tool temporarily becomes
|
813
|
+
# The #{suspend} method is called by SketchUp when the tool temporarily becomes
|
792
814
|
# inactive because another tool has been activated. This typically happens
|
793
815
|
# when a viewing tool is activated, such as when orbit is active due to the
|
794
816
|
# middle mouse button.
|
@@ -798,10 +820,7 @@ class Sketchup::Tool
|
|
798
820
|
# puts "suspend: view = #{view}"
|
799
821
|
# end
|
800
822
|
#
|
801
|
-
# @param view
|
802
|
-
# A View object where the method was invoked.
|
803
|
-
#
|
804
|
-
# @return nil
|
823
|
+
# @param [Sketchup::View] view
|
805
824
|
#
|
806
825
|
# @version SketchUp 6.0
|
807
826
|
def suspend(view)
|