sketchup-api-stubs 0.7.8 → 0.7.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sketchup-api-stubs/sketchup.rb +151 -148
- data/lib/sketchup-api-stubs/stubs/Array.rb +741 -741
- data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +322 -322
- data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +172 -172
- data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +126 -126
- data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
- data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +400 -400
- data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +661 -661
- data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +509 -523
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +476 -478
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +263 -263
- data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +141 -141
- data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +522 -522
- data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +693 -693
- data/lib/sketchup-api-stubs/stubs/Geom.rb +351 -351
- data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +93 -93
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +595 -595
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +747 -698
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +183 -183
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +517 -516
- data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
- data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +148 -148
- data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +354 -354
- data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -311
- data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
- data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -91
- data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +370 -370
- data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +218 -218
- data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +128 -128
- data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +225 -225
- data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +567 -567
- data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +10 -10
- data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +11 -11
- data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +183 -183
- data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +387 -387
- data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +209 -209
- data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +344 -344
- data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +174 -174
- data/lib/sketchup-api-stubs/stubs/Layout/ReferenceEntity.rb +82 -0
- data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +692 -692
- data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1519 -1519
- data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
- data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
- data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
- data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
- data/lib/sketchup-api-stubs/stubs/Length.rb +278 -278
- data/lib/sketchup-api-stubs/stubs/Numeric.rb +249 -249
- data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +144 -144
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +169 -169
- data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +209 -209
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +150 -152
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +281 -286
- data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +302 -302
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +478 -478
- data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
- data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +121 -122
- data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +294 -294
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +659 -619
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +593 -593
- data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +257 -257
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
- data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +201 -201
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +449 -426
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +74 -74
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +104 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +165 -165
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +306 -306
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +42 -42
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
- data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +406 -396
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +397 -502
- data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1239 -1205
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +261 -272
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -127
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +545 -545
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -60
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +125 -126
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +937 -937
- data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +102 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +750 -750
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +282 -292
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +62 -62
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
- data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +468 -468
- data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +266 -266
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +189 -189
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +406 -407
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +84 -84
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +306 -306
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +326 -326
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +422 -422
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +427 -427
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +249 -249
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +48 -48
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +114 -112
- data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +414 -414
- data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +317 -318
- data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +93 -93
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1652 -1651
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +357 -357
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +130 -131
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +271 -284
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
- data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +490 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +116 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +797 -797
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +361 -363
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -77
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +478 -477
- data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +361 -364
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +45 -45
- data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +458 -459
- data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
- data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +212 -212
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +255 -260
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +59 -59
- data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -40
- data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +69 -69
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +217 -217
- data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +262 -262
- data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +217 -217
- data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +834 -837
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +156 -156
- data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +75 -75
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1311 -1317
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +45 -45
- data/lib/sketchup-api-stubs/stubs/Sketchup.rb +1377 -1360
- data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/String.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +389 -389
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +494 -496
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +269 -269
- data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +241 -240
- data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +635 -635
- data/lib/sketchup-api-stubs/stubs/UI.rb +683 -683
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +303 -311
- data/lib/sketchup-api-stubs.rb +1 -1
- metadata +10 -7
@@ -1,837 +1,834 @@
|
|
1
|
-
# Copyright:: Copyright
|
2
|
-
# License:: The MIT License (MIT)
|
3
|
-
|
4
|
-
# Tool is the interface that you implement to create a SketchUp tool.
|
5
|
-
# See
|
6
|
-
# {our code
|
7
|
-
# example}[https://github.com/SketchUp/sketchup-ruby-api-tutorials/tree/main/examples/02_custom_tool]
|
8
|
-
# for how to create a custom tool in Ruby.
|
9
|
-
#
|
10
|
-
# To create a new tool in Ruby, you must define a new class that implements
|
11
|
-
# the methods for the events that you want to respond to. You do not have
|
12
|
-
# to implement methods for every possible event that a Tool can respond to.
|
13
|
-
#
|
14
|
-
# Once you have defined a tool class, you select that tool by creating an
|
15
|
-
# instance of it and passing it to {Sketchup::Model#select_tool}. For
|
16
|
-
# example:
|
17
|
-
#
|
18
|
-
# class MyTool
|
19
|
-
# def activate
|
20
|
-
# puts 'Your tool has been activated.'
|
21
|
-
# end
|
22
|
-
# end
|
23
|
-
#
|
24
|
-
# my_tool = MyTool.new
|
25
|
-
# Sketchup.active_model.select_tool(my_tool)
|
26
|
-
#
|
27
|
-
# The following table contains several constants you can use when check for
|
28
|
-
# certain key presses inside the keyboard handling callbacks:
|
29
|
-
#
|
30
|
-
# - +CONSTRAIN_MODIFIER_KEY+ = Shift Key
|
31
|
-
# - +CONSTRAIN_MODIFIER_MASK+ = Shift Key
|
32
|
-
# - +COPY_MODIFIER_KEY+ = Alt/Option on Mac, Ctrl on PC
|
33
|
-
# - +COPY_MODIFIER_MASK+ = Alt/Option on Mac, Ctrl on PC
|
34
|
-
# - +ALT_MODIFIER_KEY+ = Command on Mac, Alt on PC
|
35
|
-
# - +ALT_MODIFIER_MASK+ = Command on Mac, Alt on PC
|
36
|
-
#
|
37
|
-
# @abstract Implement the methods described in this class to create a tool.
|
38
|
-
# You can not sub-class this class because it is not defined by the API.
|
39
|
-
#
|
40
|
-
# @version SketchUp 6.0
|
41
|
-
class Sketchup::Tool
|
42
|
-
|
43
|
-
# Instance Methods
|
44
|
-
|
45
|
-
# The {#activate} method is called by SketchUp when the tool is selected.
|
46
|
-
# It is a good place to put most of your initialization, such as instance
|
47
|
-
# variables to track the state of the tool.
|
48
|
-
#
|
49
|
-
# @example
|
50
|
-
# def activate
|
51
|
-
# puts 'Your tool has been activated.'
|
52
|
-
# end
|
53
|
-
#
|
54
|
-
# @version SketchUp 6.0
|
55
|
-
def activate
|
56
|
-
end
|
57
|
-
|
58
|
-
# The {#deactivate} method is called when the tool is deactivated because a
|
59
|
-
# different tool was selected.
|
60
|
-
#
|
61
|
-
# @example
|
62
|
-
# def deactivate(view)
|
63
|
-
# puts "Your tool has been deactivated in view: #{view}"
|
64
|
-
# end
|
65
|
-
#
|
66
|
-
# @param [Sketchup::View] view
|
67
|
-
#
|
68
|
-
# @version SketchUp 6.0
|
69
|
-
def deactivate(view)
|
70
|
-
end
|
71
|
-
|
72
|
-
# The {#draw} method is called by SketchUp whenever the view is refreshed to
|
73
|
-
# allow the tool to do its own drawing. If the tool has some temporary graphics
|
74
|
-
# that it wants displayed while it is active, it should implement this method
|
75
|
-
# and draw to the {Sketchup::View}.
|
76
|
-
#
|
77
|
-
# @example
|
78
|
-
# def draw(view)
|
79
|
-
# # Draw a square.
|
80
|
-
# points = [
|
81
|
-
# Geom::Point3d.new(0, 0, 0),
|
82
|
-
# Geom::Point3d.new(9, 0, 0),
|
83
|
-
# Geom::Point3d.new(9, 9, 0),
|
84
|
-
# Geom::Point3d.new(0, 9, 0)
|
85
|
-
# ]
|
86
|
-
# # Fill
|
87
|
-
# view.drawing_color = Sketchup::Color.new(255, 128, 128)
|
88
|
-
# view.draw(GL_QUADS, points)
|
89
|
-
# # Outline
|
90
|
-
# view.line_stipple = '' # Solid line
|
91
|
-
# view.drawing_color = Sketchup::Color.new(64, 0, 0)
|
92
|
-
# view.draw(GL_LINE_LOOP, points)
|
93
|
-
# end
|
94
|
-
#
|
95
|
-
# @note If you draw outside the model bounds you need to implement
|
96
|
-
# {Tool#getExtents} which return a bounding box large enough to include the
|
97
|
-
# points you draw. Otherwise your drawing will be clipped.
|
98
|
-
#
|
99
|
-
# @param [Sketchup::View] view
|
100
|
-
# A View object where the method was invoked.
|
101
|
-
#
|
102
|
-
# @see getExtents
|
103
|
-
#
|
104
|
-
# @see Sketchup::View#draw
|
105
|
-
#
|
106
|
-
# @version SketchUp 6.0
|
107
|
-
def draw(view)
|
108
|
-
end
|
109
|
-
|
110
|
-
# The {#enableVCB?} method is used to tell SketchUp whether to allow the user
|
111
|
-
# to enter text into the VCB (value control box, aka the "measurements" panel).
|
112
|
-
# If you do not implement this method, then the vcb is disabled by default.
|
113
|
-
#
|
114
|
-
# @example
|
115
|
-
# # For this tool, allow vcb text entry while the tool is active.
|
116
|
-
# def enableVCB?
|
117
|
-
# return true
|
118
|
-
# end
|
119
|
-
#
|
120
|
-
# @return [Boolean] Return +true+ if you want the VCB enabled
|
121
|
-
#
|
122
|
-
# @version SketchUp 6.0
|
123
|
-
def enableVCB?
|
124
|
-
end
|
125
|
-
|
126
|
-
# In order to accurately draw things, SketchUp needs to know the extents of
|
127
|
-
# what it is drawing. If the tool is doing its own drawing, it may need to
|
128
|
-
# implement this method to tell SketchUp the extents of what it will be
|
129
|
-
# drawing. If you don't implement this method, you may find that part of what
|
130
|
-
# the tool is drawing gets clipped to the extents of the rest of the
|
131
|
-
# model.
|
132
|
-
#
|
133
|
-
# This must return a {Geom::BoundingBox}. In a typical implementation, you
|
134
|
-
# will create a new {Geom::BoundingBox}, add points to set the extents of the
|
135
|
-
# drawing that the tool will do and then return it.
|
136
|
-
#
|
137
|
-
# @example
|
138
|
-
# def getExtents
|
139
|
-
# bb = Sketchup.active_model.bounds
|
140
|
-
# return bb
|
141
|
-
# end
|
142
|
-
#
|
143
|
-
# @return [Geom::BoundingBox]
|
144
|
-
#
|
145
|
-
# @version SketchUp 6.0
|
146
|
-
def getExtents
|
147
|
-
end
|
148
|
-
|
149
|
-
# The {#getInstructorContentDirectory} method is used to tell SketchUp the
|
150
|
-
# directory containing your Tool's instructor content. To use this, create
|
151
|
-
# a custom instructor directory, put an index.html file inside of it, and then
|
152
|
-
# return that path via this method. If the SketchUp user has the Instructor
|
153
|
-
# window open when they activate your tool, they will see your html file.
|
154
|
-
#
|
155
|
-
# @example
|
156
|
-
# def getInstructorContentDirectory
|
157
|
-
# extension_path = Sketchup.extensions['MyExtension].extension_path
|
158
|
-
# instructor_path = File.join(extension_path, 'MyExtension', 'instructor')
|
159
|
-
# return instructor_path
|
160
|
-
# end
|
161
|
-
#
|
162
|
-
# @note Prior to SketchUp 2014 this method would assume the path was relative
|
163
|
-
# to the SketchUp resource folder. From 2014 and onwards you can specify the
|
164
|
-
# absolute path to an HTML file or the absolute path to a directory
|
165
|
-
# containing an index.html file.
|
166
|
-
#
|
167
|
-
# @return [String] the directory path where the Instructor content exists.
|
168
|
-
#
|
169
|
-
# @version SketchUp 6.0
|
170
|
-
def getInstructorContentDirectory
|
171
|
-
end
|
172
|
-
|
173
|
-
# The {#getMenu} method is called by SketchUp to let the tool provide its own
|
174
|
-
# context menu. Most tools will not want to implement this method and,
|
175
|
-
# instead, use the normal context menu found on all entities.
|
176
|
-
#
|
177
|
-
# If you do implement this method, the argument is a Menu. You should use the
|
178
|
-
# add_item method to build the context menu.
|
179
|
-
#
|
180
|
-
# Your tool will use a standard context menu by default if you do not
|
181
|
-
# implement this method. Implement this method if you want a context-click to
|
182
|
-
# display something other than this default context menu.
|
183
|
-
#
|
184
|
-
# In SketchUp 2015 the flags, x, y and view parameters were added. They are
|
185
|
-
# needed if you need to pick the entities under the mouse position. The new
|
186
|
-
# parameters are optional, but if you need to use one you must include them
|
187
|
-
# all.
|
188
|
-
#
|
189
|
-
# @example
|
190
|
-
# if Sketchup.version.to_i < 15
|
191
|
-
# # Compatible with SketchUp 2014 and older:
|
192
|
-
# def getMenu(menu)
|
193
|
-
# menu.add_item('Say Hello') {
|
194
|
-
# UI.messagebox('Hello')
|
195
|
-
# }
|
196
|
-
# end
|
197
|
-
# else
|
198
|
-
# # Only works with SketchUp 2015 and newer:
|
199
|
-
# def getMenu(menu, flags, x, y, view)
|
200
|
-
# ph = view.pick_helper(x, y)
|
201
|
-
# entity = ph.best_picked
|
202
|
-
# if entity
|
203
|
-
# view.model.selection.clear
|
204
|
-
# view.model.selection.add(entity)
|
205
|
-
# menu.add_item("Erase #{entity.typename}") {
|
206
|
-
# entity.erase!
|
207
|
-
# }
|
208
|
-
# end
|
209
|
-
# end
|
210
|
-
# end
|
211
|
-
#
|
212
|
-
# @
|
213
|
-
#
|
214
|
-
#
|
215
|
-
#
|
216
|
-
#
|
217
|
-
#
|
218
|
-
#
|
219
|
-
#
|
220
|
-
#
|
221
|
-
#
|
222
|
-
#
|
223
|
-
#
|
224
|
-
#
|
225
|
-
#
|
226
|
-
#
|
227
|
-
#
|
228
|
-
#
|
229
|
-
#
|
230
|
-
#
|
231
|
-
#
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
#
|
239
|
-
#
|
240
|
-
#
|
241
|
-
#
|
242
|
-
#
|
243
|
-
#
|
244
|
-
#
|
245
|
-
#
|
246
|
-
#
|
247
|
-
#
|
248
|
-
#
|
249
|
-
#
|
250
|
-
#
|
251
|
-
#
|
252
|
-
#
|
253
|
-
#
|
254
|
-
#
|
255
|
-
#
|
256
|
-
#
|
257
|
-
#
|
258
|
-
# @
|
259
|
-
#
|
260
|
-
#
|
261
|
-
# @param [
|
262
|
-
#
|
263
|
-
#
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
#
|
271
|
-
#
|
272
|
-
#
|
273
|
-
#
|
274
|
-
#
|
275
|
-
#
|
276
|
-
#
|
277
|
-
#
|
278
|
-
#
|
279
|
-
#
|
280
|
-
#
|
281
|
-
#
|
282
|
-
# - +
|
283
|
-
# - +
|
284
|
-
# - +
|
285
|
-
# - +
|
286
|
-
# - +
|
287
|
-
# - +
|
288
|
-
# - +
|
289
|
-
# - +
|
290
|
-
# - +
|
291
|
-
# - +
|
292
|
-
# - +
|
293
|
-
# - +
|
294
|
-
# - +
|
295
|
-
#
|
296
|
-
#
|
297
|
-
#
|
298
|
-
#
|
299
|
-
#
|
300
|
-
#
|
301
|
-
#
|
302
|
-
#
|
303
|
-
#
|
304
|
-
# puts "
|
305
|
-
#
|
306
|
-
#
|
307
|
-
#
|
308
|
-
#
|
309
|
-
#
|
310
|
-
# @param [Integer]
|
311
|
-
#
|
312
|
-
#
|
313
|
-
#
|
314
|
-
#
|
315
|
-
#
|
316
|
-
#
|
317
|
-
#
|
318
|
-
#
|
319
|
-
#
|
320
|
-
#
|
321
|
-
#
|
322
|
-
#
|
323
|
-
#
|
324
|
-
# @
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
#
|
332
|
-
#
|
333
|
-
#
|
334
|
-
#
|
335
|
-
#
|
336
|
-
# puts "
|
337
|
-
#
|
338
|
-
#
|
339
|
-
#
|
340
|
-
#
|
341
|
-
#
|
342
|
-
# @param [Integer]
|
343
|
-
#
|
344
|
-
#
|
345
|
-
#
|
346
|
-
#
|
347
|
-
#
|
348
|
-
#
|
349
|
-
#
|
350
|
-
#
|
351
|
-
#
|
352
|
-
#
|
353
|
-
#
|
354
|
-
#
|
355
|
-
#
|
356
|
-
# @
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
#
|
364
|
-
#
|
365
|
-
#
|
366
|
-
#
|
367
|
-
#
|
368
|
-
# puts "
|
369
|
-
#
|
370
|
-
#
|
371
|
-
#
|
372
|
-
#
|
373
|
-
#
|
374
|
-
#
|
375
|
-
#
|
376
|
-
#
|
377
|
-
#
|
378
|
-
# @param [Integer]
|
379
|
-
# The
|
380
|
-
#
|
381
|
-
# @param [
|
382
|
-
#
|
383
|
-
#
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
#
|
391
|
-
#
|
392
|
-
#
|
393
|
-
#
|
394
|
-
#
|
395
|
-
# puts "
|
396
|
-
#
|
397
|
-
#
|
398
|
-
#
|
399
|
-
#
|
400
|
-
#
|
401
|
-
#
|
402
|
-
#
|
403
|
-
#
|
404
|
-
#
|
405
|
-
# @param [Integer]
|
406
|
-
# The
|
407
|
-
#
|
408
|
-
# @param [
|
409
|
-
#
|
410
|
-
#
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
#
|
418
|
-
#
|
419
|
-
#
|
420
|
-
#
|
421
|
-
#
|
422
|
-
# puts "
|
423
|
-
#
|
424
|
-
#
|
425
|
-
#
|
426
|
-
#
|
427
|
-
#
|
428
|
-
#
|
429
|
-
#
|
430
|
-
#
|
431
|
-
#
|
432
|
-
# @param [Integer]
|
433
|
-
# The
|
434
|
-
#
|
435
|
-
# @param [
|
436
|
-
#
|
437
|
-
#
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
#
|
445
|
-
#
|
446
|
-
#
|
447
|
-
#
|
448
|
-
#
|
449
|
-
#
|
450
|
-
#
|
451
|
-
#
|
452
|
-
# puts "
|
453
|
-
#
|
454
|
-
#
|
455
|
-
#
|
456
|
-
#
|
457
|
-
#
|
458
|
-
#
|
459
|
-
#
|
460
|
-
#
|
461
|
-
#
|
462
|
-
#
|
463
|
-
#
|
464
|
-
#
|
465
|
-
#
|
466
|
-
#
|
467
|
-
# @param [Integer]
|
468
|
-
# The
|
469
|
-
#
|
470
|
-
# @param [
|
471
|
-
#
|
472
|
-
#
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
# The
|
480
|
-
#
|
481
|
-
#
|
482
|
-
#
|
483
|
-
#
|
484
|
-
#
|
485
|
-
#
|
486
|
-
#
|
487
|
-
#
|
488
|
-
# puts "
|
489
|
-
#
|
490
|
-
#
|
491
|
-
#
|
492
|
-
#
|
493
|
-
#
|
494
|
-
#
|
495
|
-
#
|
496
|
-
#
|
497
|
-
#
|
498
|
-
# @param [Integer]
|
499
|
-
# The
|
500
|
-
#
|
501
|
-
# @param [
|
502
|
-
#
|
503
|
-
#
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
#
|
511
|
-
#
|
512
|
-
#
|
513
|
-
#
|
514
|
-
#
|
515
|
-
#
|
516
|
-
#
|
517
|
-
#
|
518
|
-
#
|
519
|
-
#
|
520
|
-
# puts "
|
521
|
-
#
|
522
|
-
#
|
523
|
-
#
|
524
|
-
#
|
525
|
-
#
|
526
|
-
#
|
527
|
-
#
|
528
|
-
#
|
529
|
-
#
|
530
|
-
# @param [Integer]
|
531
|
-
# The
|
532
|
-
#
|
533
|
-
# @param [
|
534
|
-
#
|
535
|
-
#
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
#
|
543
|
-
#
|
544
|
-
#
|
545
|
-
#
|
546
|
-
#
|
547
|
-
#
|
548
|
-
#
|
549
|
-
#
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
#
|
557
|
-
#
|
558
|
-
#
|
559
|
-
#
|
560
|
-
#
|
561
|
-
#
|
562
|
-
#
|
563
|
-
#
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
#
|
571
|
-
#
|
572
|
-
#
|
573
|
-
#
|
574
|
-
#
|
575
|
-
#
|
576
|
-
#
|
577
|
-
#
|
578
|
-
# puts "
|
579
|
-
#
|
580
|
-
#
|
581
|
-
#
|
582
|
-
#
|
583
|
-
#
|
584
|
-
#
|
585
|
-
#
|
586
|
-
#
|
587
|
-
#
|
588
|
-
# @param [Integer]
|
589
|
-
# The
|
590
|
-
#
|
591
|
-
# @param [
|
592
|
-
#
|
593
|
-
#
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
#
|
601
|
-
#
|
602
|
-
#
|
603
|
-
#
|
604
|
-
#
|
605
|
-
#
|
606
|
-
#
|
607
|
-
#
|
608
|
-
#
|
609
|
-
# Geom::Point3d.new(100,
|
610
|
-
#
|
611
|
-
#
|
612
|
-
#
|
613
|
-
#
|
614
|
-
#
|
615
|
-
#
|
616
|
-
#
|
617
|
-
#
|
618
|
-
#
|
619
|
-
#
|
620
|
-
#
|
621
|
-
#
|
622
|
-
#
|
623
|
-
#
|
624
|
-
#
|
625
|
-
#
|
626
|
-
#
|
627
|
-
#
|
628
|
-
#
|
629
|
-
#
|
630
|
-
#
|
631
|
-
#
|
632
|
-
#
|
633
|
-
#
|
634
|
-
# view.
|
635
|
-
#
|
636
|
-
#
|
637
|
-
# view.
|
638
|
-
#
|
639
|
-
#
|
640
|
-
#
|
641
|
-
#
|
642
|
-
#
|
643
|
-
#
|
644
|
-
#
|
645
|
-
#
|
646
|
-
#
|
647
|
-
#
|
648
|
-
#
|
649
|
-
#
|
650
|
-
#
|
651
|
-
#
|
652
|
-
#
|
653
|
-
#
|
654
|
-
#
|
655
|
-
#
|
656
|
-
# @param [Float]
|
657
|
-
# The
|
658
|
-
#
|
659
|
-
# @param [
|
660
|
-
#
|
661
|
-
#
|
662
|
-
#
|
663
|
-
#
|
664
|
-
# @
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
#
|
672
|
-
#
|
673
|
-
#
|
674
|
-
#
|
675
|
-
#
|
676
|
-
# puts "
|
677
|
-
#
|
678
|
-
#
|
679
|
-
#
|
680
|
-
#
|
681
|
-
#
|
682
|
-
#
|
683
|
-
#
|
684
|
-
#
|
685
|
-
#
|
686
|
-
# @param [Integer]
|
687
|
-
# The
|
688
|
-
#
|
689
|
-
# @param [
|
690
|
-
#
|
691
|
-
#
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
#
|
699
|
-
#
|
700
|
-
#
|
701
|
-
#
|
702
|
-
#
|
703
|
-
#
|
704
|
-
#
|
705
|
-
# puts "
|
706
|
-
#
|
707
|
-
#
|
708
|
-
#
|
709
|
-
#
|
710
|
-
#
|
711
|
-
#
|
712
|
-
#
|
713
|
-
#
|
714
|
-
#
|
715
|
-
# @param [Integer]
|
716
|
-
# The
|
717
|
-
#
|
718
|
-
# @param [
|
719
|
-
#
|
720
|
-
#
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
#
|
728
|
-
#
|
729
|
-
#
|
730
|
-
#
|
731
|
-
#
|
732
|
-
# puts "
|
733
|
-
#
|
734
|
-
#
|
735
|
-
#
|
736
|
-
#
|
737
|
-
#
|
738
|
-
#
|
739
|
-
#
|
740
|
-
#
|
741
|
-
#
|
742
|
-
# @param [Integer]
|
743
|
-
# The
|
744
|
-
#
|
745
|
-
# @param [
|
746
|
-
#
|
747
|
-
#
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
#
|
755
|
-
#
|
756
|
-
#
|
757
|
-
#
|
758
|
-
#
|
759
|
-
#
|
760
|
-
#
|
761
|
-
#
|
762
|
-
#
|
763
|
-
#
|
764
|
-
#
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
#
|
772
|
-
#
|
773
|
-
#
|
774
|
-
#
|
775
|
-
#
|
776
|
-
#
|
777
|
-
#
|
778
|
-
#
|
779
|
-
#
|
780
|
-
#
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
#
|
788
|
-
#
|
789
|
-
#
|
790
|
-
#
|
791
|
-
#
|
792
|
-
#
|
793
|
-
#
|
794
|
-
#
|
795
|
-
#
|
796
|
-
#
|
797
|
-
# @param [
|
798
|
-
#
|
799
|
-
#
|
800
|
-
# @
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
#
|
808
|
-
#
|
809
|
-
#
|
810
|
-
#
|
811
|
-
#
|
812
|
-
#
|
813
|
-
#
|
814
|
-
#
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
#
|
822
|
-
#
|
823
|
-
#
|
824
|
-
#
|
825
|
-
#
|
826
|
-
#
|
827
|
-
#
|
828
|
-
#
|
829
|
-
#
|
830
|
-
#
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
end
|
836
|
-
|
837
|
-
end
|
1
|
+
# Copyright:: Copyright 2023 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# Tool is the interface that you implement to create a SketchUp tool.
|
5
|
+
# See
|
6
|
+
# {our code
|
7
|
+
# example}[https://github.com/SketchUp/sketchup-ruby-api-tutorials/tree/main/examples/02_custom_tool]
|
8
|
+
# for how to create a custom tool in Ruby.
|
9
|
+
#
|
10
|
+
# To create a new tool in Ruby, you must define a new class that implements
|
11
|
+
# the methods for the events that you want to respond to. You do not have
|
12
|
+
# to implement methods for every possible event that a Tool can respond to.
|
13
|
+
#
|
14
|
+
# Once you have defined a tool class, you select that tool by creating an
|
15
|
+
# instance of it and passing it to {Sketchup::Model#select_tool}. For
|
16
|
+
# example:
|
17
|
+
#
|
18
|
+
# class MyTool
|
19
|
+
# def activate
|
20
|
+
# puts 'Your tool has been activated.'
|
21
|
+
# end
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# my_tool = MyTool.new
|
25
|
+
# Sketchup.active_model.select_tool(my_tool)
|
26
|
+
#
|
27
|
+
# The following table contains several constants you can use when check for
|
28
|
+
# certain key presses inside the keyboard handling callbacks:
|
29
|
+
#
|
30
|
+
# - +CONSTRAIN_MODIFIER_KEY+ = Shift Key
|
31
|
+
# - +CONSTRAIN_MODIFIER_MASK+ = Shift Key
|
32
|
+
# - +COPY_MODIFIER_KEY+ = Alt/Option on Mac, Ctrl on PC
|
33
|
+
# - +COPY_MODIFIER_MASK+ = Alt/Option on Mac, Ctrl on PC
|
34
|
+
# - +ALT_MODIFIER_KEY+ = Command on Mac, Alt on PC
|
35
|
+
# - +ALT_MODIFIER_MASK+ = Command on Mac, Alt on PC
|
36
|
+
#
|
37
|
+
# @abstract Implement the methods described in this class to create a tool.
|
38
|
+
# You can not sub-class this class because it is not defined by the API.
|
39
|
+
#
|
40
|
+
# @version SketchUp 6.0
|
41
|
+
class Sketchup::Tool
|
42
|
+
|
43
|
+
# Instance Methods
|
44
|
+
|
45
|
+
# The {#activate} method is called by SketchUp when the tool is selected.
|
46
|
+
# It is a good place to put most of your initialization, such as instance
|
47
|
+
# variables to track the state of the tool.
|
48
|
+
#
|
49
|
+
# @example
|
50
|
+
# def activate
|
51
|
+
# puts 'Your tool has been activated.'
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# @version SketchUp 6.0
|
55
|
+
def activate
|
56
|
+
end
|
57
|
+
|
58
|
+
# The {#deactivate} method is called when the tool is deactivated because a
|
59
|
+
# different tool was selected.
|
60
|
+
#
|
61
|
+
# @example
|
62
|
+
# def deactivate(view)
|
63
|
+
# puts "Your tool has been deactivated in view: #{view}"
|
64
|
+
# end
|
65
|
+
#
|
66
|
+
# @param [Sketchup::View] view
|
67
|
+
#
|
68
|
+
# @version SketchUp 6.0
|
69
|
+
def deactivate(view)
|
70
|
+
end
|
71
|
+
|
72
|
+
# The {#draw} method is called by SketchUp whenever the view is refreshed to
|
73
|
+
# allow the tool to do its own drawing. If the tool has some temporary graphics
|
74
|
+
# that it wants displayed while it is active, it should implement this method
|
75
|
+
# and draw to the {Sketchup::View}.
|
76
|
+
#
|
77
|
+
# @example
|
78
|
+
# def draw(view)
|
79
|
+
# # Draw a square.
|
80
|
+
# points = [
|
81
|
+
# Geom::Point3d.new(0, 0, 0),
|
82
|
+
# Geom::Point3d.new(9, 0, 0),
|
83
|
+
# Geom::Point3d.new(9, 9, 0),
|
84
|
+
# Geom::Point3d.new(0, 9, 0)
|
85
|
+
# ]
|
86
|
+
# # Fill
|
87
|
+
# view.drawing_color = Sketchup::Color.new(255, 128, 128)
|
88
|
+
# view.draw(GL_QUADS, points)
|
89
|
+
# # Outline
|
90
|
+
# view.line_stipple = '' # Solid line
|
91
|
+
# view.drawing_color = Sketchup::Color.new(64, 0, 0)
|
92
|
+
# view.draw(GL_LINE_LOOP, points)
|
93
|
+
# end
|
94
|
+
#
|
95
|
+
# @note If you draw outside the model bounds you need to implement
|
96
|
+
# {Tool#getExtents} which return a bounding box large enough to include the
|
97
|
+
# points you draw. Otherwise your drawing will be clipped.
|
98
|
+
#
|
99
|
+
# @param [Sketchup::View] view
|
100
|
+
# A View object where the method was invoked.
|
101
|
+
#
|
102
|
+
# @see getExtents
|
103
|
+
#
|
104
|
+
# @see Sketchup::View#draw
|
105
|
+
#
|
106
|
+
# @version SketchUp 6.0
|
107
|
+
def draw(view)
|
108
|
+
end
|
109
|
+
|
110
|
+
# The {#enableVCB?} method is used to tell SketchUp whether to allow the user
|
111
|
+
# to enter text into the VCB (value control box, aka the "measurements" panel).
|
112
|
+
# If you do not implement this method, then the vcb is disabled by default.
|
113
|
+
#
|
114
|
+
# @example
|
115
|
+
# # For this tool, allow vcb text entry while the tool is active.
|
116
|
+
# def enableVCB?
|
117
|
+
# return true
|
118
|
+
# end
|
119
|
+
#
|
120
|
+
# @return [Boolean] Return +true+ if you want the VCB enabled
|
121
|
+
#
|
122
|
+
# @version SketchUp 6.0
|
123
|
+
def enableVCB?
|
124
|
+
end
|
125
|
+
|
126
|
+
# In order to accurately draw things, SketchUp needs to know the extents of
|
127
|
+
# what it is drawing. If the tool is doing its own drawing, it may need to
|
128
|
+
# implement this method to tell SketchUp the extents of what it will be
|
129
|
+
# drawing. If you don't implement this method, you may find that part of what
|
130
|
+
# the tool is drawing gets clipped to the extents of the rest of the
|
131
|
+
# model.
|
132
|
+
#
|
133
|
+
# This must return a {Geom::BoundingBox}. In a typical implementation, you
|
134
|
+
# will create a new {Geom::BoundingBox}, add points to set the extents of the
|
135
|
+
# drawing that the tool will do and then return it.
|
136
|
+
#
|
137
|
+
# @example
|
138
|
+
# def getExtents
|
139
|
+
# bb = Sketchup.active_model.bounds
|
140
|
+
# return bb
|
141
|
+
# end
|
142
|
+
#
|
143
|
+
# @return [Geom::BoundingBox]
|
144
|
+
#
|
145
|
+
# @version SketchUp 6.0
|
146
|
+
def getExtents
|
147
|
+
end
|
148
|
+
|
149
|
+
# The {#getInstructorContentDirectory} method is used to tell SketchUp the
|
150
|
+
# directory containing your Tool's instructor content. To use this, create
|
151
|
+
# a custom instructor directory, put an index.html file inside of it, and then
|
152
|
+
# return that path via this method. If the SketchUp user has the Instructor
|
153
|
+
# window open when they activate your tool, they will see your html file.
|
154
|
+
#
|
155
|
+
# @example
|
156
|
+
# def getInstructorContentDirectory
|
157
|
+
# extension_path = Sketchup.extensions['MyExtension].extension_path
|
158
|
+
# instructor_path = File.join(extension_path, 'MyExtension', 'instructor')
|
159
|
+
# return instructor_path
|
160
|
+
# end
|
161
|
+
#
|
162
|
+
# @note Prior to SketchUp 2014 this method would assume the path was relative
|
163
|
+
# to the SketchUp resource folder. From 2014 and onwards you can specify the
|
164
|
+
# absolute path to an HTML file or the absolute path to a directory
|
165
|
+
# containing an index.html file.
|
166
|
+
#
|
167
|
+
# @return [String] the directory path where the Instructor content exists.
|
168
|
+
#
|
169
|
+
# @version SketchUp 6.0
|
170
|
+
def getInstructorContentDirectory
|
171
|
+
end
|
172
|
+
|
173
|
+
# The {#getMenu} method is called by SketchUp to let the tool provide its own
|
174
|
+
# context menu. Most tools will not want to implement this method and,
|
175
|
+
# instead, use the normal context menu found on all entities.
|
176
|
+
#
|
177
|
+
# If you do implement this method, the argument is a Menu. You should use the
|
178
|
+
# {Sketchup::Menu#add_item} method to build the context menu.
|
179
|
+
#
|
180
|
+
# Your tool will use a standard context menu by default if you do not
|
181
|
+
# implement this method. Implement this method if you want a context-click to
|
182
|
+
# display something other than this default context menu.
|
183
|
+
#
|
184
|
+
# In SketchUp 2015 the flags, x, y and view parameters were added. They are
|
185
|
+
# needed if you need to pick the entities under the mouse position. The new
|
186
|
+
# parameters are optional, but if you need to use one you must include them
|
187
|
+
# all.
|
188
|
+
#
|
189
|
+
# @example
|
190
|
+
# if Sketchup.version.to_i < 15
|
191
|
+
# # Compatible with SketchUp 2014 and older:
|
192
|
+
# def getMenu(menu)
|
193
|
+
# menu.add_item('Say Hello') {
|
194
|
+
# UI.messagebox('Hello')
|
195
|
+
# }
|
196
|
+
# end
|
197
|
+
# else
|
198
|
+
# # Only works with SketchUp 2015 and newer:
|
199
|
+
# def getMenu(menu, flags, x, y, view)
|
200
|
+
# ph = view.pick_helper(x, y)
|
201
|
+
# entity = ph.best_picked
|
202
|
+
# if entity
|
203
|
+
# view.model.selection.clear
|
204
|
+
# view.model.selection.add(entity)
|
205
|
+
# menu.add_item("Erase #{entity.typename}") {
|
206
|
+
# entity.erase!
|
207
|
+
# }
|
208
|
+
# end
|
209
|
+
# end
|
210
|
+
# end
|
211
|
+
#
|
212
|
+
# @overload getMenu(menu)
|
213
|
+
#
|
214
|
+
# @param [Sketchup::Menu] menu
|
215
|
+
#
|
216
|
+
# @overload getMenu(menu, flags, x, y, view)
|
217
|
+
#
|
218
|
+
# @version SketchUp 2015
|
219
|
+
# @param [Sketchup::Menu] menu
|
220
|
+
# @param [Integer] flags
|
221
|
+
# A bit mask that tells the state of the modifier keys and other mouse
|
222
|
+
# buttons at the time.
|
223
|
+
# @param [Integer] x
|
224
|
+
# The X coordinate on the screen where the event occurred.
|
225
|
+
# @param [Integer] y
|
226
|
+
# The Y coordinate on the screen where the event occurred.
|
227
|
+
# @param [Sketchup::View] view
|
228
|
+
#
|
229
|
+
# @return [nil]
|
230
|
+
#
|
231
|
+
# @version SketchUp 6.0
|
232
|
+
def getMenu
|
233
|
+
end
|
234
|
+
|
235
|
+
# The {#onCancel} method is called by SketchUp to cancel the current operation
|
236
|
+
# of the tool. The typical response will be to reset the tool to its initial
|
237
|
+
# state.
|
238
|
+
#
|
239
|
+
# The reason identifies the action that triggered the call. The reason can be
|
240
|
+
# one of the following values:
|
241
|
+
#
|
242
|
+
# - +0+: the user canceled the current operation by hitting the escape key.
|
243
|
+
# - +1+: the user re-selected the same tool from the toolbar or menu.
|
244
|
+
# - +2+: the user did an undo while the tool was active.
|
245
|
+
#
|
246
|
+
# @example
|
247
|
+
# def onCancel(reason, view)
|
248
|
+
# puts "MyTool was canceled for reason ##{reason} in view: #{view}"
|
249
|
+
# end
|
250
|
+
#
|
251
|
+
# @note When something is undone {#onCancel} is called before the undo is
|
252
|
+
# actually executed. If you need to do something with the model after an undo
|
253
|
+
# use {Sketchup::ModelObserver#onTransactionUndo}.
|
254
|
+
#
|
255
|
+
# @note When {#onKeyDown} is implemented and returns +true+, pressing Esc
|
256
|
+
# doesn't trigger {#onCancel}.
|
257
|
+
#
|
258
|
+
# @param [Integer] reason
|
259
|
+
# A reason value (see comments).
|
260
|
+
#
|
261
|
+
# @param [Sketchup::View] view
|
262
|
+
#
|
263
|
+
# @version SketchUp 6.0
|
264
|
+
def onCancel(reason, view)
|
265
|
+
end
|
266
|
+
|
267
|
+
# The {#onKeyDown} method is called by SketchUp when the user presses a key on
|
268
|
+
# the keyboard. If you want to get input from the VCB, you should implement
|
269
|
+
# onUserText rather than this method.
|
270
|
+
#
|
271
|
+
# This method is can be used for special keys such as the Shift key, Ctrl key,
|
272
|
+
# and so on, or for just determining which key a user pressed. This method is
|
273
|
+
# actually called for all keys that are pressed.
|
274
|
+
#
|
275
|
+
# There are several
|
276
|
+
# "virtual keys" defined as constants you can use. Their use is cross
|
277
|
+
# platform. They are:
|
278
|
+
#
|
279
|
+
# - +VK_ALT+
|
280
|
+
# - +VK_COMMAND+
|
281
|
+
# - +VK_CONTROL+
|
282
|
+
# - +VK_DELETE+
|
283
|
+
# - +VK_DOWN+
|
284
|
+
# - +VK_END+
|
285
|
+
# - +VK_HOME+
|
286
|
+
# - +VK_INSERT+
|
287
|
+
# - +VK_LEFT+
|
288
|
+
# - +VK_MENU+
|
289
|
+
# - +VK_NEXT+
|
290
|
+
# - +VK_PRIOR+
|
291
|
+
# - +VK_RIGHT+
|
292
|
+
# - +VK_SHIFT+
|
293
|
+
# - +VK_SPACE+
|
294
|
+
# - +VK_UP+
|
295
|
+
#
|
296
|
+
# V6: There is a bug on Windows where the typematic effect does
|
297
|
+
# not work. Typematic effects work fine on a Mac.
|
298
|
+
#
|
299
|
+
# @example
|
300
|
+
# def onKeyDown(key, repeat, flags, view)
|
301
|
+
# puts "onKeyDown: key = #{key}"
|
302
|
+
# puts " repeat = #{repeat}"
|
303
|
+
# puts " flags = #{flags}"
|
304
|
+
# puts " view = #{view}"
|
305
|
+
# end
|
306
|
+
#
|
307
|
+
# @param [Integer] key
|
308
|
+
# The key that was pressed.
|
309
|
+
#
|
310
|
+
# @param [Integer] repeat
|
311
|
+
# A value of 1 for a single press of a key. A value
|
312
|
+
# of 2 if the user has pressed a key and is holding
|
313
|
+
# it down.
|
314
|
+
#
|
315
|
+
# @param [Integer] flags
|
316
|
+
# A bit mask that tells the state of the modifier
|
317
|
+
# keys at the time of the event.
|
318
|
+
#
|
319
|
+
# @param [Sketchup::View] view
|
320
|
+
#
|
321
|
+
# @return [Boolean] Return +true+ to prevent SketchUp from processing the
|
322
|
+
# event.
|
323
|
+
#
|
324
|
+
# @version SketchUp 6.0
|
325
|
+
def onKeyDown(key, repeat, flags, view)
|
326
|
+
end
|
327
|
+
|
328
|
+
# The {#onKeyUp} method is called by SketchUp when the user releases a key on
|
329
|
+
# the keyboard.
|
330
|
+
#
|
331
|
+
# @example
|
332
|
+
# def onKeyUp(key, repeat, flags, view)
|
333
|
+
# puts "onKeyUp: key = #{key}"
|
334
|
+
# puts " repeat = #{repeat}"
|
335
|
+
# puts " flags = #{flags}"
|
336
|
+
# puts " view = #{view}"
|
337
|
+
# end
|
338
|
+
#
|
339
|
+
# @param [Integer] key
|
340
|
+
# The key that was pressed.
|
341
|
+
#
|
342
|
+
# @param [Integer] repeat
|
343
|
+
# A value of 1 for a single press of a key. A value
|
344
|
+
# of 2 if the user has pressed a key and is holding
|
345
|
+
# it down.
|
346
|
+
#
|
347
|
+
# @param [Integer] flags
|
348
|
+
# A bit mask that tells the state of the modifier
|
349
|
+
# keys at the time of the event.
|
350
|
+
#
|
351
|
+
# @param [Sketchup::View] view
|
352
|
+
#
|
353
|
+
# @return [Boolean] Return +true+ to prevent SketchUp from processing the
|
354
|
+
# event.
|
355
|
+
#
|
356
|
+
# @version SketchUp 6.0
|
357
|
+
def onKeyUp(key, repeat, flags, view)
|
358
|
+
end
|
359
|
+
|
360
|
+
# The {#onLButtonDoubleClick} is called by SketchUp when the user double clicks
|
361
|
+
# with the left mouse button.
|
362
|
+
#
|
363
|
+
# @example
|
364
|
+
# def onLButtonDoubleClick(flags, x, y, view)
|
365
|
+
# puts "onLButtonDoubleClick: flags = #{flags}"
|
366
|
+
# puts " x = #{x}"
|
367
|
+
# puts " y = #{y}"
|
368
|
+
# puts " view = #{view}"
|
369
|
+
# end
|
370
|
+
#
|
371
|
+
# @param [Integer] flags
|
372
|
+
# A bit mask that tells the state of the modifier
|
373
|
+
# keys and other mouse buttons at the time.
|
374
|
+
#
|
375
|
+
# @param [Integer] x
|
376
|
+
# The X coordinate on the screen where the event occurred.
|
377
|
+
#
|
378
|
+
# @param [Integer] y
|
379
|
+
# The Y coordinate on the screen where the event occurred.
|
380
|
+
#
|
381
|
+
# @param [Sketchup::View] view
|
382
|
+
#
|
383
|
+
# @version SketchUp 6.0
|
384
|
+
def onLButtonDoubleClick(flags, x, y, view)
|
385
|
+
end
|
386
|
+
|
387
|
+
# The {#onLButtonDown} method is called by SketchUp when the left mouse button
|
388
|
+
# is pressed. Most tools will implement this method.
|
389
|
+
#
|
390
|
+
# @example
|
391
|
+
# def onLButtonDown(flags, x, y, view)
|
392
|
+
# puts "onLButtonDown: flags = #{flags}"
|
393
|
+
# puts " x = #{x}"
|
394
|
+
# puts " y = #{y}"
|
395
|
+
# puts " view = #{view}"
|
396
|
+
# end
|
397
|
+
#
|
398
|
+
# @param [Integer] flags
|
399
|
+
# A bit mask that tells the state of the modifier
|
400
|
+
# keys and other mouse buttons at the time.
|
401
|
+
#
|
402
|
+
# @param [Integer] x
|
403
|
+
# The X coordinate on the screen where the event occurred.
|
404
|
+
#
|
405
|
+
# @param [Integer] y
|
406
|
+
# The Y coordinate on the screen where the event occurred.
|
407
|
+
#
|
408
|
+
# @param [Sketchup::View] view
|
409
|
+
#
|
410
|
+
# @version SketchUp 6.0
|
411
|
+
def onLButtonDown(flags, x, y, view)
|
412
|
+
end
|
413
|
+
|
414
|
+
# The {#onLButtonUp} method is called by SketchUp when the left mouse button is
|
415
|
+
# released.
|
416
|
+
#
|
417
|
+
# @example
|
418
|
+
# def onLButtonUp(flags, x, y, view)
|
419
|
+
# puts "onLButtonUp: flags = #{flags}"
|
420
|
+
# puts " x = #{x}"
|
421
|
+
# puts " y = #{y}"
|
422
|
+
# puts " view = #{view}"
|
423
|
+
# end
|
424
|
+
#
|
425
|
+
# @param [Integer] flags
|
426
|
+
# A bit mask that tells the state of the modifier
|
427
|
+
# keys and other mouse buttons at the time.
|
428
|
+
#
|
429
|
+
# @param [Integer] x
|
430
|
+
# The X coordinate on the screen where the event occurred.
|
431
|
+
#
|
432
|
+
# @param [Integer] y
|
433
|
+
# The Y coordinate on the screen where the event occurred.
|
434
|
+
#
|
435
|
+
# @param [Sketchup::View] view
|
436
|
+
#
|
437
|
+
# @version SketchUp 6.0
|
438
|
+
def onLButtonUp(flags, x, y, view)
|
439
|
+
end
|
440
|
+
|
441
|
+
# The {#onMButtonDoubleClick} method is called by SketchUp when the middle
|
442
|
+
# mouse button (on a three button mouse) is double-clicked.
|
443
|
+
#
|
444
|
+
# Only implement this method if you want SketchUp to react to a middle mouse
|
445
|
+
# button being double-clicked.
|
446
|
+
#
|
447
|
+
# @example
|
448
|
+
# def onMButtonDoubleClick(flags, x, y, view)
|
449
|
+
# puts "onMButtonDoubleClick: flags = #{flags}"
|
450
|
+
# puts " x = #{x}"
|
451
|
+
# puts " y = #{y}"
|
452
|
+
# puts " view = #{view}"
|
453
|
+
# end
|
454
|
+
#
|
455
|
+
# @note Though this method has been documented in the Ruby API for many years,
|
456
|
+
# it has never worked properly. We are leaving this documentation in place
|
457
|
+
# for now in the hopes of fixing the implementation, but you won't have any
|
458
|
+
# luck trying to use it in SU7 and earlier.
|
459
|
+
#
|
460
|
+
# @param [Integer] flags
|
461
|
+
# A bit mask that tells the state of the modifier
|
462
|
+
# keys and other mouse buttons at the time.
|
463
|
+
#
|
464
|
+
# @param [Integer] x
|
465
|
+
# The X coordinate on the screen where the event occurred.
|
466
|
+
#
|
467
|
+
# @param [Integer] y
|
468
|
+
# The Y coordinate on the screen where the event occurred.
|
469
|
+
#
|
470
|
+
# @param [Sketchup::View] view
|
471
|
+
#
|
472
|
+
# @version SketchUp 6.0
|
473
|
+
def onMButtonDoubleClick(flags, x, y, view)
|
474
|
+
end
|
475
|
+
|
476
|
+
# The {#onMButtonDown} method is called by SketchUp when the middle mouse
|
477
|
+
# button (on a three button mouse) is down.
|
478
|
+
#
|
479
|
+
# The Orbit tool is activated by default when the middle mouse button is down.
|
480
|
+
# Implement this method if you want a middle mouse button to do something
|
481
|
+
# other than invoke the Orbit tool.
|
482
|
+
#
|
483
|
+
# @example
|
484
|
+
# def onMButtonDown(flags, x, y, view)
|
485
|
+
# puts "onMButtonDown: flags = #{flags}"
|
486
|
+
# puts " x = #{x}"
|
487
|
+
# puts " y = #{y}"
|
488
|
+
# puts " view = #{view}"
|
489
|
+
# end
|
490
|
+
#
|
491
|
+
# @param [Integer] flags
|
492
|
+
# A bit mask that tells the state of the modifier
|
493
|
+
# keys and other mouse buttons at the time.
|
494
|
+
#
|
495
|
+
# @param [Integer] x
|
496
|
+
# The X coordinate on the screen where the event occurred.
|
497
|
+
#
|
498
|
+
# @param [Integer] y
|
499
|
+
# The Y coordinate on the screen where the event occurred.
|
500
|
+
#
|
501
|
+
# @param [Sketchup::View] view
|
502
|
+
#
|
503
|
+
# @version SketchUp 6.0
|
504
|
+
def onMButtonDown(flags, x, y, view)
|
505
|
+
end
|
506
|
+
|
507
|
+
# The {#onMButtonUp} method is called by SketchUp when the middle mouse button
|
508
|
+
# (on a three button mouse) is released.
|
509
|
+
#
|
510
|
+
# SketchUp returns to the previous tool from the Orbit tool when the middle
|
511
|
+
# mouse button is released. Implement this method if you want a middle mouse
|
512
|
+
# button to do something other than return to the previous tool when in the
|
513
|
+
# Orbit tool.
|
514
|
+
#
|
515
|
+
# @example
|
516
|
+
# def onMButtonUp(flags, x, y, view)
|
517
|
+
# puts "onMButtonUp: flags = #{flags}"
|
518
|
+
# puts " x = #{x}"
|
519
|
+
# puts " y = #{y}"
|
520
|
+
# puts " view = #{view}"
|
521
|
+
# end
|
522
|
+
#
|
523
|
+
# @param [Integer] flags
|
524
|
+
# A bit mask that tells the state of the modifier
|
525
|
+
# keys and other mouse buttons at the time.
|
526
|
+
#
|
527
|
+
# @param [Integer] x
|
528
|
+
# The X coordinate on the screen where the event occurred.
|
529
|
+
#
|
530
|
+
# @param [Integer] y
|
531
|
+
# The Y coordinate on the screen where the event occurred.
|
532
|
+
#
|
533
|
+
# @param [Sketchup::View] view
|
534
|
+
#
|
535
|
+
# @version SketchUp 6.0
|
536
|
+
def onMButtonUp(flags, x, y, view)
|
537
|
+
end
|
538
|
+
|
539
|
+
# The {#onMouseEnter} method is called by SketchUp when the mouse enters the
|
540
|
+
# viewport.
|
541
|
+
#
|
542
|
+
# @example
|
543
|
+
# def onMouseEnter(view)
|
544
|
+
# puts "onMouseEnter: view = #{view}"
|
545
|
+
# end
|
546
|
+
#
|
547
|
+
# @param [Sketchup::View] view
|
548
|
+
#
|
549
|
+
# @version SketchUp 6.0
|
550
|
+
def onMouseEnter(view)
|
551
|
+
end
|
552
|
+
|
553
|
+
# The {#onMouseLeave} method is called by SketchUp when the mouse leaves the
|
554
|
+
# viewport.
|
555
|
+
#
|
556
|
+
# @example
|
557
|
+
# def onMouseLeave(view)
|
558
|
+
# puts "onMouseLeave: view = #{view}"
|
559
|
+
# end
|
560
|
+
#
|
561
|
+
# @param [Sketchup::View] view
|
562
|
+
#
|
563
|
+
# @version SketchUp 6.0
|
564
|
+
def onMouseLeave(view)
|
565
|
+
end
|
566
|
+
|
567
|
+
# The {#onMouseMove} method is called by SketchUp whenever the mouse is moved.
|
568
|
+
# You will often want to implement this method.
|
569
|
+
#
|
570
|
+
# Try to make this method as efficient as possible because this method is
|
571
|
+
# called often.
|
572
|
+
#
|
573
|
+
# @example
|
574
|
+
# def onMouseMove(flags, x, y, view)
|
575
|
+
# puts "onMouseMove: flags = #{flags}"
|
576
|
+
# puts " x = #{x}"
|
577
|
+
# puts " y = #{y}"
|
578
|
+
# puts " view = #{view}"
|
579
|
+
# end
|
580
|
+
#
|
581
|
+
# @param [Integer] flags
|
582
|
+
# A bit mask that tells the state of the modifier
|
583
|
+
# keys and other mouse buttons at the time.
|
584
|
+
#
|
585
|
+
# @param [Integer] x
|
586
|
+
# The X coordinate on the screen where the event occurred.
|
587
|
+
#
|
588
|
+
# @param [Integer] y
|
589
|
+
# The Y coordinate on the screen where the event occurred.
|
590
|
+
#
|
591
|
+
# @param [Sketchup::View] view
|
592
|
+
#
|
593
|
+
# @version SketchUp 6.0
|
594
|
+
def onMouseMove(flags, x, y, view)
|
595
|
+
end
|
596
|
+
|
597
|
+
# The {#onMouseWheel} method is called by SketchUp when the mouse scroll wheel
|
598
|
+
# is used.
|
599
|
+
#
|
600
|
+
# @example
|
601
|
+
# class ExampleTool
|
602
|
+
#
|
603
|
+
# def initialize
|
604
|
+
# @property_value = 0
|
605
|
+
# @rect = [
|
606
|
+
# Geom::Point3d.new(100, 150, 0),
|
607
|
+
# Geom::Point3d.new(300, 150, 0),
|
608
|
+
# Geom::Point3d.new(300, 250, 0),
|
609
|
+
# Geom::Point3d.new(100, 250, 0),
|
610
|
+
# ]
|
611
|
+
# end
|
612
|
+
#
|
613
|
+
# def onMouseMove(flags, x, y, view)
|
614
|
+
# view.invalidate
|
615
|
+
# end
|
616
|
+
#
|
617
|
+
# def onMouseWheel(flags, delta, x, y, view)
|
618
|
+
# # If the cursor is not within the bounds of the rectangle, return false
|
619
|
+
# # to let SketchUp do its default action (zoom).
|
620
|
+
# point = Geom::Point3d.new(x, y)
|
621
|
+
# return false unless Geom.point_in_polygon_2D(point, @rect, true)
|
622
|
+
#
|
623
|
+
# # If cursor is within the bounds of the rectangle, update the value
|
624
|
+
# # and prevent the default zoom.
|
625
|
+
# @property_value += delta
|
626
|
+
# view.invalidate
|
627
|
+
# true
|
628
|
+
# end
|
629
|
+
#
|
630
|
+
# def draw(view)
|
631
|
+
# view.line_width = 2
|
632
|
+
# view.line_stipple = ''
|
633
|
+
# view.drawing_color = 'red'
|
634
|
+
# view.draw2d(GL_QUADS, @rect)
|
635
|
+
#
|
636
|
+
# point = Geom::Point3d.new(120, 170)
|
637
|
+
# view.draw_text(point, "Value: #{@property_value}",
|
638
|
+
# size: 20, bold: true, color: 'black')
|
639
|
+
# end
|
640
|
+
#
|
641
|
+
# end
|
642
|
+
#
|
643
|
+
# Sketchup.active_model.select_tool(ExampleTool.new)
|
644
|
+
#
|
645
|
+
# @param [Integer] flags
|
646
|
+
# A bit mask that tells the state of the modifier
|
647
|
+
# keys and other mouse buttons at the time.
|
648
|
+
#
|
649
|
+
# @param [Integer] delta
|
650
|
+
# Either +1+ or +-1+ depending on which direction the
|
651
|
+
# mouse wheel scrolled.
|
652
|
+
#
|
653
|
+
# @param [Float] x
|
654
|
+
# The X coordinate on the screen where the event occurred.
|
655
|
+
#
|
656
|
+
# @param [Float] y
|
657
|
+
# The Y coordinate on the screen where the event occurred.
|
658
|
+
#
|
659
|
+
# @param [Sketchup::View] view
|
660
|
+
#
|
661
|
+
# @return [Boolean] Return +true+ to prevent SketchUp from performing default
|
662
|
+
# zoom action.
|
663
|
+
#
|
664
|
+
# @version SketchUp 2019.2
|
665
|
+
def onMouseWheel(flags, delta, x, y, view)
|
666
|
+
end
|
667
|
+
|
668
|
+
# The {#onRButtonDoubleClick} is called by SketchUp when the user double clicks
|
669
|
+
# with the right mouse button.
|
670
|
+
#
|
671
|
+
# @example
|
672
|
+
# def onRButtonDoubleClick(flags, x, y, view)
|
673
|
+
# puts "onRButtonDoubleClick: flags = #{flags}"
|
674
|
+
# puts " x = #{x}"
|
675
|
+
# puts " y = #{y}"
|
676
|
+
# puts " view = #{view}"
|
677
|
+
# end
|
678
|
+
#
|
679
|
+
# @param [Integer] flags
|
680
|
+
# A bit mask that tells the state of the modifier
|
681
|
+
# keys and other mouse buttons at the time.
|
682
|
+
#
|
683
|
+
# @param [Integer] x
|
684
|
+
# The X coordinate on the screen where the event occurred.
|
685
|
+
#
|
686
|
+
# @param [Integer] y
|
687
|
+
# The Y coordinate on the screen where the event occurred.
|
688
|
+
#
|
689
|
+
# @param [Sketchup::View] view
|
690
|
+
#
|
691
|
+
# @version SketchUp 6.0
|
692
|
+
def onRButtonDoubleClick(flags, x, y, view)
|
693
|
+
end
|
694
|
+
|
695
|
+
# The {#onRButtonDown} method is called by SketchUp when the user presses
|
696
|
+
# the right mouse button. Implement this method, along with the tool.getMenu
|
697
|
+
# method, when you want your tool to do something other than display the
|
698
|
+
# default context menu when the right mouse button is clicked.
|
699
|
+
#
|
700
|
+
# @example
|
701
|
+
# def onRButtonDown(flags, x, y, view)
|
702
|
+
# puts "onRButtonDown: flags = #{flags}"
|
703
|
+
# puts " x = #{x}"
|
704
|
+
# puts " y = #{y}"
|
705
|
+
# puts " view = #{view}"
|
706
|
+
# end
|
707
|
+
#
|
708
|
+
# @param [Integer] flags
|
709
|
+
# A bit mask that tells the state of the modifier
|
710
|
+
# keys and other mouse buttons at the time.
|
711
|
+
#
|
712
|
+
# @param [Integer] x
|
713
|
+
# The X coordinate on the screen where the event occurred.
|
714
|
+
#
|
715
|
+
# @param [Integer] y
|
716
|
+
# The Y coordinate on the screen where the event occurred.
|
717
|
+
#
|
718
|
+
# @param [Sketchup::View] view
|
719
|
+
#
|
720
|
+
# @version SketchUp 6.0
|
721
|
+
def onRButtonDown(flags, x, y, view)
|
722
|
+
end
|
723
|
+
|
724
|
+
# The {#onRButtonUp} method is called by SketchUp when the user releases the
|
725
|
+
# right mouse button.
|
726
|
+
#
|
727
|
+
# @example
|
728
|
+
# def onRButtonUp(flags, x, y, view)
|
729
|
+
# puts "onRButtonUp: flags = #{flags}"
|
730
|
+
# puts " x = #{x}"
|
731
|
+
# puts " y = #{y}"
|
732
|
+
# puts " view = #{view}"
|
733
|
+
# end
|
734
|
+
#
|
735
|
+
# @param [Integer] flags
|
736
|
+
# A bit mask that tells the state of the modifier
|
737
|
+
# keys and other mouse buttons at the time.
|
738
|
+
#
|
739
|
+
# @param [Integer] x
|
740
|
+
# The X coordinate on the screen where the event occurred.
|
741
|
+
#
|
742
|
+
# @param [Integer] y
|
743
|
+
# The Y coordinate on the screen where the event occurred.
|
744
|
+
#
|
745
|
+
# @param [Sketchup::View] view
|
746
|
+
#
|
747
|
+
# @version SketchUp 6.0
|
748
|
+
def onRButtonUp(flags, x, y, view)
|
749
|
+
end
|
750
|
+
|
751
|
+
# The {#onReturn} method is called by SketchUp when the user hit the Return key
|
752
|
+
# to complete an operation in the tool. This method will rarely need to be
|
753
|
+
# implemented.
|
754
|
+
#
|
755
|
+
# @example
|
756
|
+
# def onReturn(view)
|
757
|
+
# puts "onReturn(#{view})"
|
758
|
+
# end
|
759
|
+
#
|
760
|
+
# @param [Sketchup::View] view
|
761
|
+
#
|
762
|
+
# @return [nil]
|
763
|
+
#
|
764
|
+
# @version SketchUp 6.0
|
765
|
+
def onReturn(view)
|
766
|
+
end
|
767
|
+
|
768
|
+
# The {#onSetCursor} method is called by SketchUp when the tool wants to set
|
769
|
+
# the cursor.
|
770
|
+
#
|
771
|
+
# @example
|
772
|
+
# def onSetCursor
|
773
|
+
# puts "onSetCursor: view = #{view}"
|
774
|
+
# # You would set your cursor here. See UI.set_cursor method.
|
775
|
+
# UI.set_cursor(@cursor_id) # UI.set_cursor return true
|
776
|
+
# end
|
777
|
+
#
|
778
|
+
# @return [Boolean] Return +true+ to prevent SketchUp using the default cursor.
|
779
|
+
#
|
780
|
+
# @version SketchUp 6.0
|
781
|
+
def onSetCursor
|
782
|
+
end
|
783
|
+
|
784
|
+
# The {#onUserText} method is called by SketchUp when the user has typed text
|
785
|
+
# into the VCB and hit return.
|
786
|
+
#
|
787
|
+
# @example
|
788
|
+
# def onUserText(text, view)
|
789
|
+
# @distance = text.to_l
|
790
|
+
# rescue ArgumentError
|
791
|
+
# view.tooltip = 'Invalid length'
|
792
|
+
# end
|
793
|
+
#
|
794
|
+
# @param [String] text
|
795
|
+
# The text string that was typed into the VCB.
|
796
|
+
#
|
797
|
+
# @param [Sketchup::View] view
|
798
|
+
# A view object where the method was invoked.
|
799
|
+
#
|
800
|
+
# @version SketchUp 6.0
|
801
|
+
def onUserText(text, view)
|
802
|
+
end
|
803
|
+
|
804
|
+
# The {#resume} method is called by SketchUp when the tool becomes active again
|
805
|
+
# after being suspended.
|
806
|
+
#
|
807
|
+
# @example
|
808
|
+
# def resume(view)
|
809
|
+
# puts "resume: view = #{view}"
|
810
|
+
# end
|
811
|
+
#
|
812
|
+
# @param [Sketchup::View] view
|
813
|
+
#
|
814
|
+
# @version SketchUp 6.0
|
815
|
+
def resume(view)
|
816
|
+
end
|
817
|
+
|
818
|
+
# The {#suspend} method is called by SketchUp when the tool temporarily becomes
|
819
|
+
# inactive because another tool has been activated. This typically happens
|
820
|
+
# when a viewing tool is activated, such as when orbit is active due to the
|
821
|
+
# middle mouse button.
|
822
|
+
#
|
823
|
+
# @example
|
824
|
+
# def suspend(view)
|
825
|
+
# puts "suspend: view = #{view}"
|
826
|
+
# end
|
827
|
+
#
|
828
|
+
# @param [Sketchup::View] view
|
829
|
+
#
|
830
|
+
# @version SketchUp 6.0
|
831
|
+
def suspend(view)
|
832
|
+
end
|
833
|
+
|
834
|
+
end
|