sketchup-api-stubs 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/SketchUp/Geom/BoundingBox.rb +335 -0
- data/SketchUp/Geom/LatLong.rb +123 -0
- data/SketchUp/Geom/Point3d.rb +643 -0
- data/SketchUp/Geom/PolygonMesh.rb +478 -0
- data/SketchUp/Geom/Transformation.rb +476 -0
- data/SketchUp/Geom/UTM.rb +135 -0
- data/SketchUp/Geom/Vector3d.rb +684 -0
- data/SketchUp/Sketchup/Animation.rb +137 -0
- data/SketchUp/Sketchup/AppObserver.rb +157 -0
- data/SketchUp/Sketchup/ArcCurve.rb +209 -0
- data/SketchUp/Sketchup/AttributeDictionaries.rb +146 -0
- data/SketchUp/Sketchup/AttributeDictionary.rb +280 -0
- data/SketchUp/Sketchup/Axes.rb +149 -0
- data/SketchUp/Sketchup/Behavior.rb +338 -0
- data/SketchUp/Sketchup/Camera.rb +594 -0
- data/SketchUp/Sketchup/ClassificationSchema.rb +63 -0
- data/SketchUp/Sketchup/Classifications.rb +118 -0
- data/SketchUp/Sketchup/Color.rb +291 -0
- data/SketchUp/Sketchup/ComponentDefinition.rb +562 -0
- data/SketchUp/Sketchup/ComponentInstance.rb +597 -0
- data/SketchUp/Sketchup/Console.rb +78 -0
- data/SketchUp/Sketchup/ConstructionLine.rb +257 -0
- data/SketchUp/Sketchup/ConstructionPoint.rb +32 -0
- data/SketchUp/Sketchup/Curve.rb +196 -0
- data/SketchUp/Sketchup/DefinitionList.rb +312 -0
- data/SketchUp/Sketchup/DefinitionObserver.rb +73 -0
- data/SketchUp/Sketchup/DefinitionsObserver.rb +102 -0
- data/SketchUp/Sketchup/Dimension.rb +167 -0
- data/SketchUp/Sketchup/DimensionLinear.rb +232 -0
- data/SketchUp/Sketchup/DimensionObserver.rb +38 -0
- data/SketchUp/Sketchup/DimensionRadial.rb +87 -0
- data/SketchUp/Sketchup/Drawingelement.rb +400 -0
- data/SketchUp/Sketchup/Edge.rb +517 -0
- data/SketchUp/Sketchup/EdgeUse.rb +213 -0
- data/SketchUp/Sketchup/Entities.rb +1011 -0
- data/SketchUp/Sketchup/EntitiesObserver.rb +125 -0
- data/SketchUp/Sketchup/Entity.rb +522 -0
- data/SketchUp/Sketchup/EntityObserver.rb +59 -0
- data/SketchUp/Sketchup/ExtensionsManager.rb +129 -0
- data/SketchUp/Sketchup/Face.rb +737 -0
- data/SketchUp/Sketchup/FrameChangeObserver.rb +104 -0
- data/SketchUp/Sketchup/Group.rb +705 -0
- data/SketchUp/Sketchup/Http.rb +27 -0
- data/SketchUp/Sketchup/Http/Request.rb +285 -0
- data/SketchUp/Sketchup/Http/Response.rb +62 -0
- data/SketchUp/Sketchup/Image.rb +393 -0
- data/SketchUp/Sketchup/Importer.rb +192 -0
- data/SketchUp/Sketchup/InputPoint.rb +393 -0
- data/SketchUp/Sketchup/InstanceObserver.rb +82 -0
- data/SketchUp/Sketchup/InstancePath.rb +297 -0
- data/SketchUp/Sketchup/Layer.rb +240 -0
- data/SketchUp/Sketchup/Layers.rb +235 -0
- data/SketchUp/Sketchup/LayersObserver.rb +136 -0
- data/SketchUp/Sketchup/Licensing.rb +47 -0
- data/SketchUp/Sketchup/Licensing/ExtensionLicense.rb +88 -0
- data/SketchUp/Sketchup/Loop.rb +141 -0
- data/SketchUp/Sketchup/Material.rb +384 -0
- data/SketchUp/Sketchup/Materials.rb +283 -0
- data/SketchUp/Sketchup/MaterialsObserver.rb +141 -0
- data/SketchUp/Sketchup/Menu.rb +97 -0
- data/SketchUp/Sketchup/Model.rb +1459 -0
- data/SketchUp/Sketchup/ModelObserver.rb +356 -0
- data/SketchUp/Sketchup/OptionsManager.rb +135 -0
- data/SketchUp/Sketchup/OptionsProvider.rb +277 -0
- data/SketchUp/Sketchup/OptionsProviderObserver.rb +58 -0
- data/SketchUp/Sketchup/Page.rb +636 -0
- data/SketchUp/Sketchup/Pages.rb +349 -0
- data/SketchUp/Sketchup/PagesObserver.rb +76 -0
- data/SketchUp/Sketchup/PickHelper.rb +457 -0
- data/SketchUp/Sketchup/RegionalSettings.rb +43 -0
- data/SketchUp/Sketchup/RenderingOptions.rb +337 -0
- data/SketchUp/Sketchup/RenderingOptionsObserver.rb +44 -0
- data/SketchUp/Sketchup/SectionPlane.rb +88 -0
- data/SketchUp/Sketchup/Selection.rb +470 -0
- data/SketchUp/Sketchup/SelectionObserver.rb +115 -0
- data/SketchUp/Sketchup/Set.rb +253 -0
- data/SketchUp/Sketchup/ShadowInfo.rb +257 -0
- data/SketchUp/Sketchup/ShadowInfoObserver.rb +57 -0
- data/SketchUp/Sketchup/Style.rb +77 -0
- data/SketchUp/Sketchup/Styles.rb +204 -0
- data/SketchUp/Sketchup/Text.rb +241 -0
- data/SketchUp/Sketchup/Texture.rb +211 -0
- data/SketchUp/Sketchup/TextureWriter.rb +237 -0
- data/SketchUp/Sketchup/Tool.rb +808 -0
- data/SketchUp/Sketchup/Tools.rb +120 -0
- data/SketchUp/Sketchup/ToolsObserver.rb +154 -0
- data/SketchUp/Sketchup/UVHelper.rb +61 -0
- data/SketchUp/Sketchup/Vertex.rb +143 -0
- data/SketchUp/Sketchup/View.rb +965 -0
- data/SketchUp/Sketchup/ViewObserver.rb +40 -0
- data/SketchUp/UI/Command.rb +307 -0
- data/SketchUp/UI/HtmlDialog.rb +346 -0
- data/SketchUp/UI/Notification.rb +229 -0
- data/SketchUp/UI/Toolbar.rb +243 -0
- data/SketchUp/UI/WebDialog.rb +623 -0
- data/SketchUp/_top_level.rb +193 -0
- data/SketchUp/array.rb +593 -0
- data/SketchUp/geom.rb +231 -0
- data/SketchUp/languagehandler.rb +92 -0
- data/SketchUp/length.rb +210 -0
- data/SketchUp/numeric.rb +249 -0
- data/SketchUp/sketchup.rb +1290 -0
- data/SketchUp/sketchupextension.rb +355 -0
- data/SketchUp/string.rb +24 -0
- data/SketchUp/ui.rb +637 -0
- metadata +176 -0
@@ -0,0 +1,211 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The Texture class contains methods for obtaining information about textures
|
5
|
+
# that are part of your materials in your model (within the In-Model section
|
6
|
+
# of the Materials Browser). Remember, textures are repeatable images that
|
7
|
+
# "tile" when painted on a surface.
|
8
|
+
#
|
9
|
+
# @version SketchUp 6.0
|
10
|
+
class Sketchup::Texture < Sketchup::Entity
|
11
|
+
|
12
|
+
# Instance Methods
|
13
|
+
|
14
|
+
# The average_color method retrieves a color object with the average color
|
15
|
+
# found in the texture.
|
16
|
+
#
|
17
|
+
# @example
|
18
|
+
# model = Sketchup.active_model
|
19
|
+
# materials=model.materials
|
20
|
+
# # Adds a material as an in model material
|
21
|
+
# m = materials.add "Test Color"
|
22
|
+
# begin
|
23
|
+
# # Returns nil if not successful, path if successful
|
24
|
+
# m.texture = "c:\\Materials\\Carpet.jpg"
|
25
|
+
# rescue
|
26
|
+
# UI.messagebox $!.message
|
27
|
+
# end
|
28
|
+
# texture = m.texture
|
29
|
+
# # Returns a color object
|
30
|
+
# color = texture.average_color
|
31
|
+
# if (color)
|
32
|
+
# UI.messagebox color
|
33
|
+
# else
|
34
|
+
# UI.messagebox "Failure: No average color"
|
35
|
+
# end
|
36
|
+
#
|
37
|
+
# @return color - a color object (if successful), nil if
|
38
|
+
# unsuccessful.
|
39
|
+
#
|
40
|
+
# @version SketchUp 6.0
|
41
|
+
def average_color
|
42
|
+
end
|
43
|
+
|
44
|
+
# The filename method retrieves the entire path, including the file, for a
|
45
|
+
# texture object.
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
# model = Sketchup.active_model
|
49
|
+
# materials=model.materials
|
50
|
+
# # Adds a material as an in model material
|
51
|
+
# m = materials.add "Test Color"
|
52
|
+
# begin
|
53
|
+
# # Returns nil if not successful, path if successful
|
54
|
+
# m.texture = "c:\\Materials\\Carpet.jpg"
|
55
|
+
# rescue
|
56
|
+
# UI.messagebox $!.message
|
57
|
+
# end
|
58
|
+
# texture = m.texture
|
59
|
+
# filename = texture.filename
|
60
|
+
# if (filename)
|
61
|
+
# UI.messagebox filename
|
62
|
+
# else
|
63
|
+
# UI.messagebox "Failure"
|
64
|
+
# end
|
65
|
+
#
|
66
|
+
# @return filename - a string representation of the path and
|
67
|
+
# filename used for the texture.
|
68
|
+
#
|
69
|
+
# @version SketchUp 6.0
|
70
|
+
def filename
|
71
|
+
end
|
72
|
+
|
73
|
+
# The height method is used to get the height of a repeatable texture image,
|
74
|
+
# in inches.
|
75
|
+
#
|
76
|
+
# @example
|
77
|
+
# height = texture.height
|
78
|
+
#
|
79
|
+
# @return height - the height, in inches, of the texture pattern
|
80
|
+
#
|
81
|
+
# @version SketchUp 6.0
|
82
|
+
def height
|
83
|
+
end
|
84
|
+
|
85
|
+
# The image_height method retrieves the height of the repeatable texture
|
86
|
+
# image, in pixels.
|
87
|
+
#
|
88
|
+
# @example
|
89
|
+
# imageheight = texture.image_height
|
90
|
+
# if (imageheight)
|
91
|
+
# UI.messagebox imageheight
|
92
|
+
# else
|
93
|
+
# UI.messagebox "Failure"
|
94
|
+
# end
|
95
|
+
#
|
96
|
+
# @return imageheight - the height, in pixels, of the texture
|
97
|
+
# pattern
|
98
|
+
#
|
99
|
+
# @version SketchUp 6.0
|
100
|
+
def image_height
|
101
|
+
end
|
102
|
+
|
103
|
+
# The image_width method retrieves the width of the repeatable texture image,
|
104
|
+
# in pixels.
|
105
|
+
#
|
106
|
+
# @example
|
107
|
+
# imagewidth = texture.image_width
|
108
|
+
# if (imagewidth)
|
109
|
+
# UI.messagebox imagewidth
|
110
|
+
# else
|
111
|
+
# UI.messagebox "Failure"
|
112
|
+
# end
|
113
|
+
#
|
114
|
+
# @return imagewidth - the width, in pixels, of the texture
|
115
|
+
# pattern
|
116
|
+
#
|
117
|
+
# @version SketchUp 6.0
|
118
|
+
def image_width
|
119
|
+
end
|
120
|
+
|
121
|
+
# The size= method allows you to set the size of the repeatable texture image,
|
122
|
+
# in inches,
|
123
|
+
#
|
124
|
+
# @example
|
125
|
+
# size = texture.size = 60
|
126
|
+
# imagewidth = texture.width
|
127
|
+
#
|
128
|
+
# if (imagewidth)
|
129
|
+
# UI.messagebox imagewidth
|
130
|
+
# else
|
131
|
+
# UI.messagebox "Failure"
|
132
|
+
# end
|
133
|
+
#
|
134
|
+
# # Using two values which will not preserve ratio
|
135
|
+
# width_height = texture.size = [10,100]
|
136
|
+
# if (width_height)
|
137
|
+
# UI.messagebox width_height
|
138
|
+
# else
|
139
|
+
# UI.messagebox "Failure"
|
140
|
+
# end
|
141
|
+
#
|
142
|
+
# @param size
|
143
|
+
# The size, in inches, of the texture. This number will
|
144
|
+
# apply to height and width to keep aspect ratio.
|
145
|
+
# You can also pass as a parameter an array of two
|
146
|
+
# numeric values which will set width and height
|
147
|
+
# regardless of maintaining the height/width ratio.
|
148
|
+
#
|
149
|
+
# @return size - the size, in inches, of the texture. This number
|
150
|
+
# will apply to height and width to keep aspect ratio.
|
151
|
+
# If you have passed in an array of two numbers for width
|
152
|
+
# and height, the same array will be returned if
|
153
|
+
# successful.
|
154
|
+
#
|
155
|
+
# @version SketchUp 6.0
|
156
|
+
def size=(size)
|
157
|
+
end
|
158
|
+
|
159
|
+
# The valid? method ensures that a texture is valid.
|
160
|
+
#
|
161
|
+
# @example
|
162
|
+
# status = texture.valid?
|
163
|
+
# if (status)
|
164
|
+
# UI.messagebox status
|
165
|
+
# else
|
166
|
+
# UI.messagebox status
|
167
|
+
# end
|
168
|
+
#
|
169
|
+
# @return status - true if valid, false if invalid.
|
170
|
+
#
|
171
|
+
# @return [Boolean]
|
172
|
+
#
|
173
|
+
# @version SketchUp 6.0
|
174
|
+
def valid?
|
175
|
+
end
|
176
|
+
|
177
|
+
# The width method is used to get the width of a repeatable texture image,
|
178
|
+
# in inches.
|
179
|
+
#
|
180
|
+
# @example
|
181
|
+
# width = texture.width
|
182
|
+
#
|
183
|
+
# @return width - the width, in inches, of the texture pattern
|
184
|
+
#
|
185
|
+
# @version SketchUp 6.0
|
186
|
+
def width
|
187
|
+
end
|
188
|
+
|
189
|
+
# Writes the texture to file with option to preserve the color adjustments made
|
190
|
+
# by the material.
|
191
|
+
#
|
192
|
+
# @example
|
193
|
+
# material = Sketchup.active_model.materials[0]
|
194
|
+
# basename = File.basename(material.texture.filename)
|
195
|
+
# filename = File.join(Sketchup.temp_dir, basename)
|
196
|
+
# material.texture.write(filename)
|
197
|
+
#
|
198
|
+
# @param filename
|
199
|
+
# String - The filename to write the texture to.
|
200
|
+
#
|
201
|
+
# @param colorize
|
202
|
+
# Boolean - Allows for the texture to
|
203
|
+
# be exported with the color adjustments.
|
204
|
+
#
|
205
|
+
# @return Boolean - true if the method succeeded
|
206
|
+
#
|
207
|
+
# @version SketchUp 2016
|
208
|
+
def write(filename, colorize = false)
|
209
|
+
end
|
210
|
+
|
211
|
+
end
|
@@ -0,0 +1,237 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The TextureWriter class is used primarily for writing the textures used in a
|
5
|
+
# SketchUp model out to files as part of an export for use in another
|
6
|
+
# application. These methods are usually invoked in this order:
|
7
|
+
#
|
8
|
+
# - 1. load - load one or more textures from a model into the TextureWriter.
|
9
|
+
# - 2. write_all or write - write the texture(s) to file.
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# # This code snippet sets up a texture writer and some variables that are
|
13
|
+
# # used in the following texture writer examples.
|
14
|
+
# # Assumptions:
|
15
|
+
# # 1) The active model contains at least one entity at the root level of the
|
16
|
+
# # following types: component instance, group, or image.
|
17
|
+
# # 2) The active model contains at least one face at the root level.
|
18
|
+
# model = Sketchup.active_model
|
19
|
+
# entities = model.entities
|
20
|
+
# faces = entities.grep(Sketchup::Face)
|
21
|
+
# texturable_entities = entities.select{ |ent|
|
22
|
+
# (ent.is_a?(Sketchup::ComponentInstance) ||
|
23
|
+
# ent.is_a?(Sketchup::Group) || ent.is_a?(Sketchup::Image)) }
|
24
|
+
# tw = Sketchup.create_texture_writer
|
25
|
+
#
|
26
|
+
# @version SketchUp 6.0
|
27
|
+
class Sketchup::TextureWriter
|
28
|
+
|
29
|
+
# Instance Methods
|
30
|
+
|
31
|
+
# The {#length} method is used to determine the number of textures loaded into
|
32
|
+
# the texture writer.
|
33
|
+
#
|
34
|
+
# The {#count} method is an alias for {#length}.
|
35
|
+
#
|
36
|
+
# @example
|
37
|
+
# length = tw.length
|
38
|
+
# tw.load(texturable_entities[0])
|
39
|
+
# if length < tw.length
|
40
|
+
# puts("A new entity was successfully loaded into the writer.")
|
41
|
+
# end
|
42
|
+
#
|
43
|
+
# @return [Integer] length - the number of textures loaded in the texture
|
44
|
+
# writer
|
45
|
+
#
|
46
|
+
# @version SketchUp 6.0
|
47
|
+
def count
|
48
|
+
end
|
49
|
+
|
50
|
+
# The filename method is used to retrieve the original filename for a
|
51
|
+
# particular texture.
|
52
|
+
#
|
53
|
+
# @example
|
54
|
+
# index = tw.load(texturable_entities[0])
|
55
|
+
# filename = tw.filename(index)
|
56
|
+
# puts("filename = #{filename}")
|
57
|
+
#
|
58
|
+
# @param [Integer] handle
|
59
|
+
# The index or handle of the texture in the texture
|
60
|
+
# writer.
|
61
|
+
#
|
62
|
+
# @return [String] filename - the filename of the texture on the file system.
|
63
|
+
# Textures can be generated without filenames, so if the
|
64
|
+
# texture doesn't have a name write_all will save the
|
65
|
+
# texture to an image file named "i.png". Where i is the
|
66
|
+
# first integer greater than zero which was not already used
|
67
|
+
# for a png file name.
|
68
|
+
#
|
69
|
+
# @version SketchUp 6.0
|
70
|
+
def filename(handle)
|
71
|
+
end
|
72
|
+
|
73
|
+
# The handle method is used to retrieve a handle or index for a specific
|
74
|
+
# texture in the texture writer.
|
75
|
+
#
|
76
|
+
# @example
|
77
|
+
# load_front_face = true
|
78
|
+
# tw.load(faces[0], load_front_face)
|
79
|
+
# handle = tw.handle(faces[0], load_front_face)
|
80
|
+
#
|
81
|
+
# @example
|
82
|
+
# tw.load(texturable_entities[0])
|
83
|
+
# handle = tw.handle(texturable_entities[0])
|
84
|
+
#
|
85
|
+
# @overload handle(entity)
|
86
|
+
#
|
87
|
+
# @param [Sketchup::Entity] entity A image, component instance, group, or
|
88
|
+
# layer.
|
89
|
+
# @return [Integer] the index for the entity in the texture writer.
|
90
|
+
#
|
91
|
+
# @overload handle(face, side)
|
92
|
+
#
|
93
|
+
# @param [Sketchup::Face] face
|
94
|
+
# @param [Boolean] side Specifies one of the sides of the face
|
95
|
+
# (true if front, false if back.)
|
96
|
+
# @return [Integer] the index for the entity in the texture writer.
|
97
|
+
#
|
98
|
+
# @version SketchUp 6.0
|
99
|
+
def handle(*args)
|
100
|
+
end
|
101
|
+
|
102
|
+
# The {#length} method is used to determine the number of textures loaded into
|
103
|
+
# the texture writer.
|
104
|
+
#
|
105
|
+
# The {#count} method is an alias for {#length}.
|
106
|
+
#
|
107
|
+
# @example
|
108
|
+
# length = tw.length
|
109
|
+
# tw.load(texturable_entities[0])
|
110
|
+
# if length < tw.length
|
111
|
+
# puts("A new entity was successfully loaded into the writer.")
|
112
|
+
# end
|
113
|
+
#
|
114
|
+
# @return [Integer] length - the number of textures loaded in the texture
|
115
|
+
# writer
|
116
|
+
#
|
117
|
+
# @version SketchUp 6.0
|
118
|
+
def length
|
119
|
+
end
|
120
|
+
|
121
|
+
# The load method is used to load one or more textures into the texture writer
|
122
|
+
# for writing out to a file.
|
123
|
+
#
|
124
|
+
# @example
|
125
|
+
# index = tw.load(faces[0], true)
|
126
|
+
#
|
127
|
+
# @example
|
128
|
+
# index = tw.load(texturable_entities[0])
|
129
|
+
#
|
130
|
+
# @note If you are passing a face in as the entity argument when loading a
|
131
|
+
# texture you will have to specify the second boolean argument, side.
|
132
|
+
# The argument side specifies which side of the face the texture will be
|
133
|
+
# loaded from.
|
134
|
+
#
|
135
|
+
# @overload load(entity)
|
136
|
+
#
|
137
|
+
# @param [Sketchup::Entity] entity Image, component instance, group, or layer
|
138
|
+
# to load.
|
139
|
+
# @return [Integer] handle - the index or handle of the entity that was
|
140
|
+
# loaded
|
141
|
+
#
|
142
|
+
# @overload load(face, side)
|
143
|
+
#
|
144
|
+
# @param [Sketchup::Face] face A face to load.
|
145
|
+
# @param [Boolean] side A boolean used to indicate the side of the
|
146
|
+
# face being loaded (true if front, false if
|
147
|
+
# back).
|
148
|
+
# @return [Integer] handle - the index or handle of the entity that was
|
149
|
+
# loaded
|
150
|
+
#
|
151
|
+
# @version SketchUp 6.0
|
152
|
+
def load(*args)
|
153
|
+
end
|
154
|
+
|
155
|
+
# The write method is used to write an individual textures, within the texture
|
156
|
+
# writer, to a file. An entity's texture must have been loaded into the texture
|
157
|
+
# writer before this method can be used to write it's texture.
|
158
|
+
#
|
159
|
+
# This method will return one of the following status messages. (These are
|
160
|
+
# constants that are defined by the API.)
|
161
|
+
#
|
162
|
+
# - 0 = FILE_WRITE_OK
|
163
|
+
# - 1 = FILE_WRITE_FAILED_INVALID_TIFF
|
164
|
+
# - 2 = FILE_WRITE_FAILED_UNKNOWN
|
165
|
+
#
|
166
|
+
# @example
|
167
|
+
# tw.load(faces[0], true)
|
168
|
+
# if tw.write(faces[0], true, "C:\\textures\\Face.png") == FILE_WRITE_OK
|
169
|
+
# puts("PNG file successfully written.")
|
170
|
+
# end
|
171
|
+
# if tw.write(faces[0], true, "C:\\textures\\Face.bmp") == FILE_WRITE_OK
|
172
|
+
# puts("BMP file successfully written.")
|
173
|
+
# end
|
174
|
+
# if tw.write(faces[0], true, "C:\\textures\\Face.tif") == FILE_WRITE_OK
|
175
|
+
# puts("TIFF file successfully written.")
|
176
|
+
# end
|
177
|
+
#
|
178
|
+
# @example
|
179
|
+
# tw.load(texturable_entities[0])
|
180
|
+
# if tw.write(texturable_entities[0], "C:\\textures\\A.jpg") == FILE_WRITE_OK
|
181
|
+
# puts("JPEG file successfully written.")
|
182
|
+
# end
|
183
|
+
#
|
184
|
+
# @note If you are passing a face in as the entity argument when writing a
|
185
|
+
# texture you will have to specify the boolean argument, side. The argument
|
186
|
+
# side controls the side of the face from which the texture will be sampled
|
187
|
+
# before writing it.
|
188
|
+
#
|
189
|
+
# @overload write(entity, filename)
|
190
|
+
#
|
191
|
+
# @param [Sketchup::Entity] entity An image, component instance, group, or
|
192
|
+
# layer to write.
|
193
|
+
# @param [String] filename The name of the file to contain the
|
194
|
+
# texture.
|
195
|
+
# @return [Integer] status - one of three status messages (see comments.)
|
196
|
+
#
|
197
|
+
# @overload write(entity, side, filename)
|
198
|
+
#
|
199
|
+
# @param [Sketchup::Entity] entity A face to write.
|
200
|
+
# @param [Boolean] side A boolean used to indicate the side of the
|
201
|
+
# face being written (true if front, false
|
202
|
+
# if back).
|
203
|
+
# @param [String] filename The name of the file to contain the
|
204
|
+
# texture.
|
205
|
+
# @return [Integer] status - one of three status messages (see comments.)
|
206
|
+
#
|
207
|
+
# @version SketchUp 6.0
|
208
|
+
def write(*args)
|
209
|
+
end
|
210
|
+
|
211
|
+
# The write_all method is used to write all of the textures within the texture
|
212
|
+
# writer to files. It will return one of three status numbers:
|
213
|
+
#
|
214
|
+
# - 0 = FILE_WRITE_OK
|
215
|
+
# - 1 = FILE_WRITE_FAILED_INVALID_TIFF
|
216
|
+
# - 2 = FILE_WRITE_FAILED_UNKNOWN
|
217
|
+
#
|
218
|
+
# @example
|
219
|
+
# tw.load(texturable_entities[0]
|
220
|
+
# tw.load(faces[0], false)
|
221
|
+
# if tw.write_all("C:\\textures\\", true) == FILE_WRITE_OK
|
222
|
+
# puts("Texture files were successfully written.")
|
223
|
+
# end
|
224
|
+
#
|
225
|
+
# @param [String] dirname
|
226
|
+
# The directory to write to.
|
227
|
+
#
|
228
|
+
# @param [Boolean] filename_format
|
229
|
+
# true to use 8.3 DOS name format.
|
230
|
+
#
|
231
|
+
# @return [Integer] status - one of three status messages (see comments.)
|
232
|
+
#
|
233
|
+
# @version SketchUp 6.0
|
234
|
+
def write_all(dirname, filename_format)
|
235
|
+
end
|
236
|
+
|
237
|
+
end
|
@@ -0,0 +1,808 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# Tool is the interface that you implement to create a SketchUp tool.
|
5
|
+
# See the file Plugins/Examples/linetool.rb (in your SketchUp install
|
6
|
+
# directory) for an example of how to create a custom tool in Ruby.
|
7
|
+
#
|
8
|
+
# To create a new tool in Ruby, you must define a new class that implements
|
9
|
+
# the methods for the events that you want to respond to. You do not have
|
10
|
+
# to implement methods for every possible event that a Tool can respond to.
|
11
|
+
#
|
12
|
+
# Once you have defined a tool class, you select that tool by creating an
|
13
|
+
# instance of it and passing it to {Sketchup::Model#select_tool}. For
|
14
|
+
# example:
|
15
|
+
#
|
16
|
+
# class MyTool
|
17
|
+
# def activate
|
18
|
+
# puts 'Your tool has been activated.'
|
19
|
+
# end
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# my_tool = MyTool.new
|
23
|
+
# Sketchup.active_model.select_tool(my_tool)
|
24
|
+
#
|
25
|
+
# The following table contains several constants you can use when check for
|
26
|
+
# certain key presses inside the keyboard handling callbacks:
|
27
|
+
#
|
28
|
+
# - +CONSTRAIN_MODIFIER_KEY+ = Shift Key
|
29
|
+
# - +CONSTRAIN_MODIFIER_MASK+ = Shift Key
|
30
|
+
# - +COPY_MODIFIER_KEY+ = Menu on Mac, Ctrl on PC
|
31
|
+
# - +COPY_MODIFIER_MASK+ = Alt on Mac, Ctrl on PC
|
32
|
+
# - +ALT_MODIFIER_KEY+ = Command on Mac, Menu on PC
|
33
|
+
# - +ALT_MODIFIER_MASK+ = Command on Mac, Alt on PC
|
34
|
+
#
|
35
|
+
# @version SketchUp 6.0
|
36
|
+
class Sketchup::Tool
|
37
|
+
|
38
|
+
# Instance Methods
|
39
|
+
|
40
|
+
# The activate method is called by SketchUp when the tool is selected.
|
41
|
+
# It is a good place to put most of your initialization, such as instance
|
42
|
+
# variables to track the state of the tool.
|
43
|
+
#
|
44
|
+
# @example
|
45
|
+
# def activate
|
46
|
+
# puts 'Your tool has been activated.'
|
47
|
+
# end
|
48
|
+
#
|
49
|
+
# @return nil
|
50
|
+
#
|
51
|
+
# @version SketchUp 6.0
|
52
|
+
def activate
|
53
|
+
end
|
54
|
+
|
55
|
+
# The deactivate method is called when the tool is deactivated because a
|
56
|
+
# different tool was selected.
|
57
|
+
#
|
58
|
+
# @example
|
59
|
+
# def deactivate(view)
|
60
|
+
# puts "Your tool has been deactivated in view: #{view}"
|
61
|
+
# end
|
62
|
+
#
|
63
|
+
# @param view
|
64
|
+
# A View object where the method was invoked.
|
65
|
+
#
|
66
|
+
# @return nil
|
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
|
+
# @return nil
|
103
|
+
#
|
104
|
+
# @see Sketchup::View#draw
|
105
|
+
#
|
106
|
+
# @see getExtents
|
107
|
+
#
|
108
|
+
# @version SketchUp 6.0
|
109
|
+
def draw(view)
|
110
|
+
end
|
111
|
+
|
112
|
+
# The enableVCB? method is used to tell SketchUp whether to allow the user to
|
113
|
+
# enter text into the VCB (value control box, aka the "measurements" panel).
|
114
|
+
# If you do not implement this method, then the vcb is disabled by default.
|
115
|
+
#
|
116
|
+
# @example
|
117
|
+
# # For this tool, allow vcb text entry while the tool is active.
|
118
|
+
# def enableVCB?
|
119
|
+
# return true
|
120
|
+
# end
|
121
|
+
#
|
122
|
+
# @return enable - true if you want the VCB enabled
|
123
|
+
#
|
124
|
+
# @return [Boolean]
|
125
|
+
#
|
126
|
+
# @version SketchUp 6.0
|
127
|
+
def enableVCB?
|
128
|
+
end
|
129
|
+
|
130
|
+
# In order to accurately draw things, SketchUp needs to know the extents of
|
131
|
+
# what it is drawing. If the tool is doing its own drawing, it may need to
|
132
|
+
# implement this method to tell SketchUp the extents of what it will be
|
133
|
+
# drawing. If you don't implement this method, you may find that part of what
|
134
|
+
# the tool is drawing gets clipped to the extents of the rest of the
|
135
|
+
# model.
|
136
|
+
#
|
137
|
+
# This must return a BoundingBox. In a typical implementation, you
|
138
|
+
# will create a new BoundingBox, add points to set the extents of the drawing
|
139
|
+
# that the tool will do and then return it.
|
140
|
+
#
|
141
|
+
# @example
|
142
|
+
# def getExtents
|
143
|
+
# bb = Sketchup.active_model.bounds
|
144
|
+
# return bb
|
145
|
+
# end
|
146
|
+
#
|
147
|
+
# @return BoundingBox - a BoundingBox object
|
148
|
+
#
|
149
|
+
# @version SketchUp 6.0
|
150
|
+
def getExtents
|
151
|
+
end
|
152
|
+
|
153
|
+
# The getInstructorContentDirectory method is used to tell SketchUp the
|
154
|
+
# directory containing your Tool's instructor content. To use this, create
|
155
|
+
# a custom instructor directory, put an index.html file inside of it, and then
|
156
|
+
# return that path via this method. If the SketchUp user has the Instructor
|
157
|
+
# window open when they activate your tool, they will see your html file.
|
158
|
+
#
|
159
|
+
# NOTE: Prior to SketchUp 2014 this method would assume the path was relative
|
160
|
+
# to the SketchUp resource folder. From 2014 and onwards you can specify the
|
161
|
+
# absolute path to an HTML file or the absolute path to a directory containing
|
162
|
+
# an index.html file.
|
163
|
+
#
|
164
|
+
# @example
|
165
|
+
# def getInstructorContentDirectory
|
166
|
+
# extension_path = Sketchup.extensions['MyExtension].extension_path
|
167
|
+
# instructor_path = File.join(extension_path, 'MyExtension', 'instructor')
|
168
|
+
# return instructor_path
|
169
|
+
# end
|
170
|
+
#
|
171
|
+
# @return directory - the string directory where the Instructor
|
172
|
+
# content exists.
|
173
|
+
#
|
174
|
+
# @version SketchUp 6.0
|
175
|
+
def getInstructorContentDirectory
|
176
|
+
end
|
177
|
+
|
178
|
+
# The getMenu method is called by SketchUp to let the tool provide its own
|
179
|
+
# context menu. Most tools will not want to implement this method and,
|
180
|
+
# instead, use the normal context menu found on all entities.
|
181
|
+
#
|
182
|
+
# If you do implement this method, the argument is a Menu. You should use the
|
183
|
+
# add_item method to build the context menu.
|
184
|
+
#
|
185
|
+
# Your tool will use a standard context menu by default if you do not
|
186
|
+
# implement this method. Implement this method if you want a context-click to
|
187
|
+
# display something other than this default context menu.
|
188
|
+
#
|
189
|
+
# In SketchUp 2015 the flags, x, y and view parameters were added. They are
|
190
|
+
# needed if you need to pick the entities under the mouse position. The new
|
191
|
+
# parameters are optional, but if you need to use one you must include them
|
192
|
+
# all.
|
193
|
+
#
|
194
|
+
# @example
|
195
|
+
# if Sketchup.version.to_i < 15
|
196
|
+
# # Compatible with SketchUp 2014 and older:
|
197
|
+
# def getMenu(menu)
|
198
|
+
# menu.add_item('Say Hello') {
|
199
|
+
# UI.messagebox('Hello')
|
200
|
+
# }
|
201
|
+
# end
|
202
|
+
# else
|
203
|
+
# # Only works with SketchUp 2015 and newer:
|
204
|
+
# def getMenu(menu, flags, x, y, view)
|
205
|
+
# ph = view.pick_helper(x, y)
|
206
|
+
# entity = ph.best_picked
|
207
|
+
# if entity
|
208
|
+
# view.model.selection.clear
|
209
|
+
# view.model.selection.add(entity)
|
210
|
+
# menu.add_item("Erase #{entity.typename}") {
|
211
|
+
# entity.erase!
|
212
|
+
# }
|
213
|
+
# end
|
214
|
+
# end
|
215
|
+
# end
|
216
|
+
#
|
217
|
+
# @param [optional] flags
|
218
|
+
# A bit mask that tells the state of the
|
219
|
+
# modifier keys and other mouse buttons at the time.
|
220
|
+
# Added in SU2015.
|
221
|
+
#
|
222
|
+
# @param menu
|
223
|
+
# A Menu object.
|
224
|
+
#
|
225
|
+
# @param [optional] x
|
226
|
+
# The X coordinate on the screen where the
|
227
|
+
# event occurred. Added in SU2015.
|
228
|
+
#
|
229
|
+
# @param [optional] view
|
230
|
+
# A View object where the method was invoked.
|
231
|
+
# Added in SU2015.
|
232
|
+
#
|
233
|
+
# @param [optional] y
|
234
|
+
# The Y coordinate on the screen where the
|
235
|
+
# event occurred. Added in SU2015.
|
236
|
+
#
|
237
|
+
# @return nil
|
238
|
+
#
|
239
|
+
# @version SketchUp 6.0
|
240
|
+
def getMenu(menu, flags, x, y, view)
|
241
|
+
end
|
242
|
+
|
243
|
+
# The onCancel method is called by SketchUp to cancel the current operation of
|
244
|
+
# the tool. The typical response will be to reset the tool to its initial
|
245
|
+
# state.
|
246
|
+
#
|
247
|
+
# The reason identifies the action that triggered the call. The reason can be
|
248
|
+
# one of the following values:
|
249
|
+
#
|
250
|
+
# - +0+: the user canceled the current operation by hitting the escape key.
|
251
|
+
# - +1+: the user re-selected the same tool from the toolbar or menu.
|
252
|
+
# - +2+: the user did an undo while the tool was active.
|
253
|
+
#
|
254
|
+
# @example
|
255
|
+
# def onCancel(reason, view)
|
256
|
+
# puts "MyTool was canceled for reason ##{reason} in view: #{view}"
|
257
|
+
# end
|
258
|
+
#
|
259
|
+
# @param reason
|
260
|
+
# A reason value (see comments).
|
261
|
+
#
|
262
|
+
# @param view
|
263
|
+
# A View object where the method was invoked.
|
264
|
+
#
|
265
|
+
# @return nil
|
266
|
+
#
|
267
|
+
# @version SketchUp 6.0
|
268
|
+
def onCancel(reason, view)
|
269
|
+
end
|
270
|
+
|
271
|
+
# The onKeyDown method is called by SketchUp when the user presses a key on
|
272
|
+
# the keyboard. If you want to get input from the VCB, you should implement
|
273
|
+
# onUserText rather than this method.
|
274
|
+
#
|
275
|
+
# This method is can be used for special keys such as the Shift key, Ctrl key,
|
276
|
+
# and so on, or for just determining which key a user pressed. This method is
|
277
|
+
# actually called for all keys that are pressed.
|
278
|
+
#
|
279
|
+
# There are several
|
280
|
+
# "virtual keys" defined as constants you can use. Their use is cross
|
281
|
+
# platform. They are:
|
282
|
+
#
|
283
|
+
# - +VK_ALT+
|
284
|
+
# - +VK_COMMAND+
|
285
|
+
# - +VK_CONTROL+
|
286
|
+
# - +VK_DELETE+
|
287
|
+
# - +VK_DOWN+
|
288
|
+
# - +VK_END+
|
289
|
+
# - +VK_HOME+
|
290
|
+
# - +VK_INSERT+
|
291
|
+
# - +VK_LEFT+
|
292
|
+
# - +VK_MENU+
|
293
|
+
# - +VK_NEXT+
|
294
|
+
# - +VK_PRIOR+
|
295
|
+
# - +VK_RIGHT+
|
296
|
+
# - +VK_SHIFT+
|
297
|
+
# - +VK_SPACE+
|
298
|
+
# - +VK_UP+
|
299
|
+
#
|
300
|
+
# V6: There is a bug on Windows where the typematic effect does
|
301
|
+
# not work. Typematic effects work fine on a Mac.
|
302
|
+
#
|
303
|
+
# @example
|
304
|
+
# def onKeyDown(key, repeat, flags, view)
|
305
|
+
# puts "onKeyDown: key = #{key}"
|
306
|
+
# puts " repeat = #{repeat}"
|
307
|
+
# puts " flags = #{flags}"
|
308
|
+
# puts " view = #{view}"
|
309
|
+
# end
|
310
|
+
#
|
311
|
+
# @param key
|
312
|
+
# The key that was pressed.
|
313
|
+
#
|
314
|
+
# @param repeat
|
315
|
+
# A value of 1 for a single press of a key. A value of 2
|
316
|
+
# if the user has pressed a key and is holding it down.
|
317
|
+
#
|
318
|
+
# @param view
|
319
|
+
# A View object where the method was invoked.
|
320
|
+
#
|
321
|
+
# @param flags
|
322
|
+
# A bit mask that tells the state of the modifier keys at
|
323
|
+
# the time of the onKeyDown.
|
324
|
+
#
|
325
|
+
# @return nil
|
326
|
+
#
|
327
|
+
# @version SketchUp 6.0
|
328
|
+
def onKeyDown(key, repeat, flags, view)
|
329
|
+
end
|
330
|
+
|
331
|
+
# The onKeyUp method is called by SketchUp when the user releases a key on the
|
332
|
+
# keyboard.
|
333
|
+
#
|
334
|
+
# @example
|
335
|
+
# def onKeyUp(key, repeat, flags, view)
|
336
|
+
# puts "onKeyUp: key = #{key}"
|
337
|
+
# puts " repeat = #{repeat}"
|
338
|
+
# puts " flags = #{flags}"
|
339
|
+
# puts " view = #{view}"
|
340
|
+
# end
|
341
|
+
#
|
342
|
+
# @param key
|
343
|
+
# The key that was pressed.
|
344
|
+
#
|
345
|
+
# @param repeat
|
346
|
+
# A value of 1 for a single press of a key. A value of 2
|
347
|
+
# if the user has pressed a key and is holding it down.
|
348
|
+
#
|
349
|
+
# @param view
|
350
|
+
# A View object where the method was invoked.
|
351
|
+
#
|
352
|
+
# @param flags
|
353
|
+
# A bit mask that tells the state of the modifier keys at
|
354
|
+
# the time of the onKeyUp.
|
355
|
+
#
|
356
|
+
# @return nil
|
357
|
+
#
|
358
|
+
# @version SketchUp 6.0
|
359
|
+
def onKeyUp(key, repeat, flags, view)
|
360
|
+
end
|
361
|
+
|
362
|
+
# The onLButtonDoubleClick is called by SketchUp when the user double clicks
|
363
|
+
# with the left mouse button.
|
364
|
+
#
|
365
|
+
# @example
|
366
|
+
# def onLButtonDoubleClick(flags, x, y, view)
|
367
|
+
# puts "onLButtonDoubleClick: flags = #{flags}"
|
368
|
+
# puts " x = #{x}"
|
369
|
+
# puts " y = #{y}"
|
370
|
+
# puts " view = #{view}"
|
371
|
+
# end
|
372
|
+
#
|
373
|
+
# @param flags
|
374
|
+
# A bit mask that tells the state of the modifier keys
|
375
|
+
# and other mouse buttons at the time.
|
376
|
+
#
|
377
|
+
# @param x
|
378
|
+
# The X coordinate on the screen where the event occurred.
|
379
|
+
#
|
380
|
+
# @param view
|
381
|
+
# A View object where the method was invoked.
|
382
|
+
#
|
383
|
+
# @param y
|
384
|
+
# The Y coordinate on the screen where the event occurred.
|
385
|
+
#
|
386
|
+
# @return nil
|
387
|
+
#
|
388
|
+
# @version SketchUp 6.0
|
389
|
+
def onLButtonDoubleClick(flags, x, y, view)
|
390
|
+
end
|
391
|
+
|
392
|
+
# The onLButtonDown method is called by SketchUp when the left mouse button is
|
393
|
+
# pressed. Most tools will implement this method.
|
394
|
+
#
|
395
|
+
# @example
|
396
|
+
# def onLButtonDown(flags, x, y, view)
|
397
|
+
# puts "onLButtonDown: flags = #{flags}"
|
398
|
+
# puts " x = #{x}"
|
399
|
+
# puts " y = #{y}"
|
400
|
+
# puts " view = #{view}"
|
401
|
+
# end
|
402
|
+
#
|
403
|
+
# @param flags
|
404
|
+
# A bit mask that tells the state of the modifier keys and
|
405
|
+
# other mouse buttons at the time.
|
406
|
+
#
|
407
|
+
# @param x
|
408
|
+
# The X coordinate on the screen where the event occurred.
|
409
|
+
#
|
410
|
+
# @param view
|
411
|
+
# A View object where the method was invoked.
|
412
|
+
#
|
413
|
+
# @param y
|
414
|
+
# The Y coordinate on the screen where the event occurred.
|
415
|
+
#
|
416
|
+
# @return nil
|
417
|
+
#
|
418
|
+
# @version SketchUp 6.0
|
419
|
+
def onLButtonDown(flags, x, y, view)
|
420
|
+
end
|
421
|
+
|
422
|
+
# The onLButtonUp method is called by SketchUp when the left mouse button is
|
423
|
+
# released.
|
424
|
+
#
|
425
|
+
# @example
|
426
|
+
# def onLButtonUp(flags, x, y, view)
|
427
|
+
# puts "onLButtonUp: flags = #{flags}"
|
428
|
+
# puts " x = #{x}"
|
429
|
+
# puts " y = #{y}"
|
430
|
+
# puts " view = #{view}"
|
431
|
+
# end
|
432
|
+
#
|
433
|
+
# @param flags
|
434
|
+
# A bit mask that tells the state of the modifier keys and
|
435
|
+
# other mouse buttons at the time.
|
436
|
+
#
|
437
|
+
# @param x
|
438
|
+
# The X coordinate on the screen where the event occurred.
|
439
|
+
#
|
440
|
+
# @param view
|
441
|
+
# A View object where the method was invoked.
|
442
|
+
#
|
443
|
+
# @param y
|
444
|
+
# The Y coordinate on the screen where the event occurred.
|
445
|
+
#
|
446
|
+
# @return nil
|
447
|
+
#
|
448
|
+
# @version SketchUp 6.0
|
449
|
+
def onLButtonUp(flags, x, y, view)
|
450
|
+
end
|
451
|
+
|
452
|
+
# NOTE: Though this method has been documented in the Ruby API for many years,
|
453
|
+
# it has never worked properly. We are leaving this documentation in place
|
454
|
+
# for now in the hopes of fixing the implementation, but you won't have any
|
455
|
+
# luck trying to use it in SU7 and earlier.
|
456
|
+
#
|
457
|
+
# The onMButtonDoubleClick method is called by SketchUp when the middle mouse
|
458
|
+
# button (on a three button mouse) is double-clicked.
|
459
|
+
#
|
460
|
+
# Only implement this method if you want SketchUp to react to a middle mouse
|
461
|
+
# button being double-clicked.
|
462
|
+
#
|
463
|
+
# @example
|
464
|
+
# def onMButtonDoubleClick(flags, x, y, view)
|
465
|
+
# puts "onMButtonDoubleClick: flags = #{flags}"
|
466
|
+
# puts " x = #{x}"
|
467
|
+
# puts " y = #{y}"
|
468
|
+
# puts " view = #{view}"
|
469
|
+
# end
|
470
|
+
#
|
471
|
+
# @param flags
|
472
|
+
# A bit mask that tells the state of the modifier keys and
|
473
|
+
# other mouse buttons at the time.
|
474
|
+
#
|
475
|
+
# @param x
|
476
|
+
# The X coordinate on the screen where the event occurred.
|
477
|
+
#
|
478
|
+
# @param view
|
479
|
+
# A View object where the method was invoked.
|
480
|
+
#
|
481
|
+
# @param y
|
482
|
+
# The Y coordinate on the screen where the event occurred.
|
483
|
+
#
|
484
|
+
# @return nil
|
485
|
+
#
|
486
|
+
# @version SketchUp 6.0
|
487
|
+
def onMButtonDoubleClick(flags, x, y, view)
|
488
|
+
end
|
489
|
+
|
490
|
+
# The onMButtonDown method is called by SketchUp when the middle mouse button
|
491
|
+
# (on a three button mouse) is down.
|
492
|
+
#
|
493
|
+
# The Orbit tool is activated by default when the middle mouse button is down.
|
494
|
+
# Implement this method if you want a middle mouse button to do something
|
495
|
+
# other than invoke the Orbit tool.
|
496
|
+
#
|
497
|
+
# @example
|
498
|
+
# def onMButtonDown(flags, x, y, view)
|
499
|
+
# puts "onMButtonDown: flags = #{flags}"
|
500
|
+
# puts " x = #{x}"
|
501
|
+
# puts " y = #{y}"
|
502
|
+
# puts " view = #{view}"
|
503
|
+
# end
|
504
|
+
#
|
505
|
+
# @param flags
|
506
|
+
# A bit mask that tells the state of the modifier keys and
|
507
|
+
# other mouse buttons at the time.
|
508
|
+
#
|
509
|
+
# @param x
|
510
|
+
# The X coordinate on the screen where the event occurred.
|
511
|
+
#
|
512
|
+
# @param view
|
513
|
+
# A View object where the method was invoked.
|
514
|
+
#
|
515
|
+
# @param y
|
516
|
+
# The Y coordinate on the screen where the event occurred.
|
517
|
+
#
|
518
|
+
# @return nil
|
519
|
+
#
|
520
|
+
# @version SketchUp 6.0
|
521
|
+
def onMButtonDown(flags, x, y, view)
|
522
|
+
end
|
523
|
+
|
524
|
+
# The onMButtonUp method is called by SketchUp when the middle mouse button
|
525
|
+
# (on a three button mouse) is released.
|
526
|
+
#
|
527
|
+
# SketchUp returns to the previous tool from the Orbit tool when the middle
|
528
|
+
# mouse button is released. Implement this method if you want a middle mouse
|
529
|
+
# button to do something other than return to the previous tool when in the
|
530
|
+
# Orbit tool.
|
531
|
+
#
|
532
|
+
# @example
|
533
|
+
# def onMButtonUp(flags, x, y, view)
|
534
|
+
# puts "onMButtonUp: flags = #{flags}"
|
535
|
+
# puts " x = #{x}"
|
536
|
+
# puts " y = #{y}"
|
537
|
+
# puts " view = #{view}"
|
538
|
+
# end
|
539
|
+
#
|
540
|
+
# @param flags
|
541
|
+
# A bit mask that tells the state of the modifier keys and
|
542
|
+
# other mouse buttons at the time.
|
543
|
+
#
|
544
|
+
# @param x
|
545
|
+
# The X coordinate on the screen where the event occurred.
|
546
|
+
#
|
547
|
+
# @param view
|
548
|
+
# A View object where the method was invoked.
|
549
|
+
#
|
550
|
+
# @param y
|
551
|
+
# The Y coordinate on the screen where the event occurred.
|
552
|
+
#
|
553
|
+
# @return nil
|
554
|
+
#
|
555
|
+
# @version SketchUp 6.0
|
556
|
+
def onMButtonUp(flags, x, y, view)
|
557
|
+
end
|
558
|
+
|
559
|
+
# The onMouseEnter method is called by SketchUp when the mouse enters the View
|
560
|
+
# object.
|
561
|
+
#
|
562
|
+
# @example
|
563
|
+
# def onMouseEnter(view)
|
564
|
+
# puts "onMouseEnter: view = #{view}"
|
565
|
+
# end
|
566
|
+
#
|
567
|
+
# @param view
|
568
|
+
# A View object where the method was invoked.
|
569
|
+
#
|
570
|
+
# @return nil
|
571
|
+
#
|
572
|
+
# @version SketchUp 6.0
|
573
|
+
def onMouseEnter(view)
|
574
|
+
end
|
575
|
+
|
576
|
+
# The onMouseLeave method is called by SketchUp when the mouse leaves the View
|
577
|
+
# object.
|
578
|
+
#
|
579
|
+
# @example
|
580
|
+
# def onMouseLeave(view)
|
581
|
+
# puts "onMouseLeave: view = #{view}"
|
582
|
+
# end
|
583
|
+
#
|
584
|
+
# @param view
|
585
|
+
# A View object where the method was invoked.
|
586
|
+
#
|
587
|
+
# @return nil
|
588
|
+
#
|
589
|
+
# @version SketchUp 6.0
|
590
|
+
def onMouseLeave(view)
|
591
|
+
end
|
592
|
+
|
593
|
+
# The onMouseMove method is called by SketchUp whenever the mouse is moved.
|
594
|
+
# You will often want to implement this method.
|
595
|
+
#
|
596
|
+
# Try to make this method as efficient as possible because this method is
|
597
|
+
# called often.
|
598
|
+
#
|
599
|
+
# @example
|
600
|
+
# def onMouseMove(flags, x, y, view)
|
601
|
+
# puts "onMouseMove: flags = #{flags}"
|
602
|
+
# puts " x = #{x}"
|
603
|
+
# puts " y = #{y}"
|
604
|
+
# puts " view = #{view}"
|
605
|
+
# end
|
606
|
+
#
|
607
|
+
# @param flags
|
608
|
+
# A bit mask that tells the state of the modifier keys and
|
609
|
+
# other mouse buttons at the time.
|
610
|
+
#
|
611
|
+
# @param x
|
612
|
+
# The X coordinate on the screen where the event occurred.
|
613
|
+
#
|
614
|
+
# @param view
|
615
|
+
# A View object where the method was invoked.
|
616
|
+
#
|
617
|
+
# @param y
|
618
|
+
# The Y coordinate on the screen where the event occurred.
|
619
|
+
#
|
620
|
+
# @return nil
|
621
|
+
#
|
622
|
+
# @version SketchUp 6.0
|
623
|
+
def onMouseMove(flags, x, y, view)
|
624
|
+
end
|
625
|
+
|
626
|
+
# The onRButtonDoubleClick is called by SketchUp when the user double clicks
|
627
|
+
# with the right mouse button.
|
628
|
+
#
|
629
|
+
# @example
|
630
|
+
# def onRButtonDoubleClick(flags, x, y, view)
|
631
|
+
# puts "onRButtonDoubleClick: flags = #{flags}"
|
632
|
+
# puts " x = #{x}"
|
633
|
+
# puts " y = #{y}"
|
634
|
+
# puts " view = #{view}"
|
635
|
+
# end
|
636
|
+
#
|
637
|
+
# @param flags
|
638
|
+
# A bit mask that tells the state of the modifier keys and
|
639
|
+
# other mouse buttons at the time.
|
640
|
+
#
|
641
|
+
# @param x
|
642
|
+
# The X coordinate on the screen where the event occurred.
|
643
|
+
#
|
644
|
+
# @param view
|
645
|
+
# A View object where the method was invoked.
|
646
|
+
#
|
647
|
+
# @param y
|
648
|
+
# The Y coordinate on the screen where the event occurred.
|
649
|
+
#
|
650
|
+
# @return nil
|
651
|
+
#
|
652
|
+
# @version SketchUp 6.0
|
653
|
+
def onRButtonDoubleClick(flags, x, y, view)
|
654
|
+
end
|
655
|
+
|
656
|
+
# The onRButtonDown method is called by SketchUp when the user presses
|
657
|
+
# the right mouse button. Implement this method, along with the tool.getMenu
|
658
|
+
# method, when you want your tool to do something other than display the
|
659
|
+
# default context menu when the right mouse button is clicked.
|
660
|
+
#
|
661
|
+
# @example
|
662
|
+
# def onRButtonDown(flags, x, y, view)
|
663
|
+
# puts "onRButtonDown: flags = #{flags}"
|
664
|
+
# puts " x = #{x}"
|
665
|
+
# puts " y = #{y}"
|
666
|
+
# puts " view = #{view}"
|
667
|
+
# end
|
668
|
+
#
|
669
|
+
# @param flags
|
670
|
+
# A bit mask that tells the state of the modifier keys and
|
671
|
+
# other mouse buttons at the time.
|
672
|
+
#
|
673
|
+
# @param x
|
674
|
+
# The X coordinate on the screen where the event occurred.
|
675
|
+
#
|
676
|
+
# @param view
|
677
|
+
# A View object where the method was invoked.
|
678
|
+
#
|
679
|
+
# @param y
|
680
|
+
# The Y coordinate on the screen where the event occurred.
|
681
|
+
#
|
682
|
+
# @return nil
|
683
|
+
#
|
684
|
+
# @version SketchUp 6.0
|
685
|
+
def onRButtonDown(flags, x, y, view)
|
686
|
+
end
|
687
|
+
|
688
|
+
# The onRButtonUp method is called by SketchUp when the user releases the
|
689
|
+
# right mouse button.
|
690
|
+
#
|
691
|
+
# @example
|
692
|
+
# def onRButtonUp(flags, x, y, view)
|
693
|
+
# puts "onRButtonUp: flags = #{flags}"
|
694
|
+
# puts " x = #{x}"
|
695
|
+
# puts " y = #{y}"
|
696
|
+
# puts " view = #{view}"
|
697
|
+
# end
|
698
|
+
#
|
699
|
+
# @param flags
|
700
|
+
# A bit mask that tells the state of the modifier keys and
|
701
|
+
# other mouse buttons at the time.
|
702
|
+
#
|
703
|
+
# @param x
|
704
|
+
# The X coordinate on the screen where the event occurred.
|
705
|
+
#
|
706
|
+
# @param view
|
707
|
+
# A View object where the method was invoked.
|
708
|
+
#
|
709
|
+
# @param y
|
710
|
+
# The Y coordinate on the screen where the event occurred.
|
711
|
+
#
|
712
|
+
# @return nil
|
713
|
+
#
|
714
|
+
# @version SketchUp 6.0
|
715
|
+
def onRButtonUp(flags, x, y, view)
|
716
|
+
end
|
717
|
+
|
718
|
+
# The onReturn method is called by SketchUp when the user hit the Return key
|
719
|
+
# to complete an operation in the tool. This method will rarely need to be
|
720
|
+
# implemented.
|
721
|
+
#
|
722
|
+
# @example
|
723
|
+
# def onMouseLeave(view)
|
724
|
+
# puts "onMouseLeave: view = #{view}"
|
725
|
+
# end
|
726
|
+
#
|
727
|
+
# @param view
|
728
|
+
# A View object where the method was invoked.
|
729
|
+
#
|
730
|
+
# @return nil
|
731
|
+
#
|
732
|
+
# @version SketchUp 6.0
|
733
|
+
def onReturn(view)
|
734
|
+
end
|
735
|
+
|
736
|
+
# The onSetCursor method is called by SketchUp when the tool wants to set the
|
737
|
+
# cursor.
|
738
|
+
#
|
739
|
+
# @example
|
740
|
+
# def onSetCursor
|
741
|
+
# puts "onSetCursor: view = #{view}"
|
742
|
+
# # You would set your cursor here. See UI.set_cursor method.
|
743
|
+
# UI.set_cursor(@cursor_id)
|
744
|
+
# end
|
745
|
+
#
|
746
|
+
# @return nil
|
747
|
+
#
|
748
|
+
# @version SketchUp 6.0
|
749
|
+
def onSetCursor
|
750
|
+
end
|
751
|
+
|
752
|
+
# The onUserText method is called by SketchUp when the user has typed text
|
753
|
+
# into the VCB and hit return.
|
754
|
+
#
|
755
|
+
# @example
|
756
|
+
# def onUserText(text, view)
|
757
|
+
# puts "onSetCursor: text = #{text}, view = #{view}"
|
758
|
+
# end
|
759
|
+
#
|
760
|
+
# @param text
|
761
|
+
# The text string that was typed into the VCB.
|
762
|
+
#
|
763
|
+
# @param view
|
764
|
+
# A View object where the method was invoked.
|
765
|
+
#
|
766
|
+
# @return nil
|
767
|
+
#
|
768
|
+
# @version SketchUp 6.0
|
769
|
+
def onUserText(text, view)
|
770
|
+
end
|
771
|
+
|
772
|
+
# The resume method is called by SketchUp when the tool becomes active again
|
773
|
+
# after being suspended.
|
774
|
+
#
|
775
|
+
# @example
|
776
|
+
# def resume(view)
|
777
|
+
# puts "resume: view = #{view}"
|
778
|
+
# end
|
779
|
+
#
|
780
|
+
# @param view
|
781
|
+
# A View object where the method was invoked.
|
782
|
+
#
|
783
|
+
# @return nil
|
784
|
+
#
|
785
|
+
# @version SketchUp 6.0
|
786
|
+
def resume(view)
|
787
|
+
end
|
788
|
+
|
789
|
+
# The suspend method is called by SketchUp when the tool temporarily becomes
|
790
|
+
# inactive because another tool has been activated. This typically happens
|
791
|
+
# when a viewing tool is activated, such as when orbit is active due to the
|
792
|
+
# middle mouse button.
|
793
|
+
#
|
794
|
+
# @example
|
795
|
+
# def suspend(view)
|
796
|
+
# puts "suspend: view = #{view}"
|
797
|
+
# end
|
798
|
+
#
|
799
|
+
# @param view
|
800
|
+
# A View object where the method was invoked.
|
801
|
+
#
|
802
|
+
# @return nil
|
803
|
+
#
|
804
|
+
# @version SketchUp 6.0
|
805
|
+
def suspend(view)
|
806
|
+
end
|
807
|
+
|
808
|
+
end
|