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,1459 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# This is the interface to a SketchUp model. The model is the 3D drawing that
|
5
|
+
# the user is working with, and it serves as the "entry point" for most Ruby
|
6
|
+
# API interactions. The Sketchup.active_model method gives you a handle to the
|
7
|
+
# current model, and from there you can use the model-level methods to start
|
8
|
+
# getting information and making changes.
|
9
|
+
#
|
10
|
+
# Constants:
|
11
|
+
# Product Family
|
12
|
+
# - Model::ProTrial
|
13
|
+
# - Model::ProLicensed
|
14
|
+
# - Model::MakeTrial
|
15
|
+
# - Model::MakeTrialExpired
|
16
|
+
#
|
17
|
+
# @example
|
18
|
+
# # Grab a handle to the currently active model (aka the one the user is
|
19
|
+
# # looking at in SketchUp.)
|
20
|
+
# model = Sketchup.active_model
|
21
|
+
#
|
22
|
+
# # Grab other handles to commonly used collections inside the model.
|
23
|
+
# entities = model.entities
|
24
|
+
# layers = model.layers
|
25
|
+
# materials = model.materials
|
26
|
+
# component_definitions = model.definitions
|
27
|
+
# selection = model.selection
|
28
|
+
#
|
29
|
+
# # Now that we have our handles, we can start pulling objects and making
|
30
|
+
# # method calls that are useful.
|
31
|
+
# first_entity = entities[0]
|
32
|
+
# UI.messagebox("First thing in your model is a #{first_entity.typename}")
|
33
|
+
#
|
34
|
+
# number_materials = materials.length
|
35
|
+
# UI.messagebox("Your model has #{number_materials} materials.")
|
36
|
+
#
|
37
|
+
# new_edge = entities.add_line([0,0,0], [500,500,0])
|
38
|
+
#
|
39
|
+
# @version SketchUp 6.0
|
40
|
+
class Sketchup::Model
|
41
|
+
|
42
|
+
# Constants
|
43
|
+
|
44
|
+
Make = nil # Stub value.
|
45
|
+
MakeTrial = nil # Stub value.
|
46
|
+
ProLicensed = nil # Stub value.
|
47
|
+
ProTrial = nil # Stub value.
|
48
|
+
|
49
|
+
VERSION_2013 = nil # Stub value.
|
50
|
+
VERSION_2014 = nil # Stub value.
|
51
|
+
VERSION_2015 = nil # Stub value.
|
52
|
+
VERSION_2016 = nil # Stub value.
|
53
|
+
VERSION_2017 = nil # Stub value.
|
54
|
+
VERSION_3 = nil # Stub value.
|
55
|
+
VERSION_4 = nil # Stub value.
|
56
|
+
VERSION_5 = nil # Stub value.
|
57
|
+
VERSION_6 = nil # Stub value.
|
58
|
+
VERSION_7 = nil # Stub value.
|
59
|
+
VERSION_8 = nil # Stub value.
|
60
|
+
|
61
|
+
# Instance Methods
|
62
|
+
|
63
|
+
# The abort_operation method aborts the current operation started with the
|
64
|
+
# start_operation method.
|
65
|
+
#
|
66
|
+
# The abort_operation method is normally called from inside of a rescue clause
|
67
|
+
# to cancel an operation if something goes wrong.
|
68
|
+
#
|
69
|
+
# @example
|
70
|
+
# status = model.abort_operation
|
71
|
+
#
|
72
|
+
# @return status - true if successful, false if unsuccessful
|
73
|
+
#
|
74
|
+
# @version SketchUp 6.0
|
75
|
+
def abort_operation
|
76
|
+
end
|
77
|
+
|
78
|
+
# Returns an {Sketchup::Entities} object which contains
|
79
|
+
# all of the entities in the active model, component, or group (if you are
|
80
|
+
# within a group or component edit session.)
|
81
|
+
#
|
82
|
+
# @example
|
83
|
+
# model = Sketchup.active_model
|
84
|
+
# entities = model.active_entities
|
85
|
+
# entities.each { |entity| puts "#{entity} (#{entity.class})" }
|
86
|
+
#
|
87
|
+
# @return [Sketchup::Entities]
|
88
|
+
#
|
89
|
+
# @version SketchUp 6.0
|
90
|
+
def active_entities
|
91
|
+
end
|
92
|
+
|
93
|
+
# The active_layer method retrieves the active Layer.
|
94
|
+
#
|
95
|
+
# The default layer in SketchUp is layer 0.
|
96
|
+
#
|
97
|
+
# @example
|
98
|
+
# model = Sketchup.active_model
|
99
|
+
# layer = model.active_layer
|
100
|
+
#
|
101
|
+
# @return layer - a layer object containing the currently active
|
102
|
+
# layer
|
103
|
+
#
|
104
|
+
# @version SketchUp 6.0
|
105
|
+
def active_layer
|
106
|
+
end
|
107
|
+
|
108
|
+
# The {#active_layer=} method sets the active {Sketchup::Layer} object.
|
109
|
+
#
|
110
|
+
# @example
|
111
|
+
# model = Sketchup.active_model
|
112
|
+
# layers = model.layers
|
113
|
+
# layer = layers.add('My Layer')
|
114
|
+
# model.active_layer = layer
|
115
|
+
#
|
116
|
+
# @param [Sketchup::Layer] layer
|
117
|
+
# The layer to be set as the active layer.
|
118
|
+
#
|
119
|
+
# @return [Sketchup::Layer]
|
120
|
+
#
|
121
|
+
# @version SketchUp 6.0
|
122
|
+
def active_layer=(layer)
|
123
|
+
end
|
124
|
+
|
125
|
+
# Returns an array containing the sequence of entities the user has
|
126
|
+
# double-clicked on for editing. This allows one to determine whether they are
|
127
|
+
# in component edit mode and where in the model they are.
|
128
|
+
#
|
129
|
+
# For example, if a user has double-clicked into a component to
|
130
|
+
# edit its geometry, and then double clicked into a sub-group to edit that,
|
131
|
+
# the active_path might contain:
|
132
|
+
#
|
133
|
+
# <code>[<Sketchup::ComponentInstance>, <Sketchup::Group>]</code>
|
134
|
+
#
|
135
|
+
# @example
|
136
|
+
# active_path = Sketchup.active_model.active_path
|
137
|
+
#
|
138
|
+
# @return path - array of entities showing where the user is
|
139
|
+
# currently editing.
|
140
|
+
#
|
141
|
+
# @version SketchUp 7.0
|
142
|
+
def active_path
|
143
|
+
end
|
144
|
+
|
145
|
+
# The active_view method returns the active View object for this model.
|
146
|
+
#
|
147
|
+
# @example
|
148
|
+
# model = Sketchup.active_model
|
149
|
+
# view = model.active_view
|
150
|
+
#
|
151
|
+
# @return view - a view object
|
152
|
+
#
|
153
|
+
# @version SketchUp 6.0
|
154
|
+
def active_view
|
155
|
+
end
|
156
|
+
|
157
|
+
# Add a text note to the Model. The position of the note is given as relative
|
158
|
+
# window positions between 0 and 1. For example, the following command
|
159
|
+
# would create a note that start 1/10 of the ways down the screen from the
|
160
|
+
# upper left corner of the window.
|
161
|
+
#
|
162
|
+
# @example
|
163
|
+
# model = Sketchup.active_model
|
164
|
+
# # Add a note 1/10 ways down the screen and 1/10 ways right from the
|
165
|
+
# # upper left corner of model window.
|
166
|
+
# note = Sketchup.active_model.add_note('Hello World', 0.1, 0.1)
|
167
|
+
#
|
168
|
+
# @param note
|
169
|
+
# A string note.
|
170
|
+
#
|
171
|
+
# @param x
|
172
|
+
# A distance along the x axis between 0 and 1.
|
173
|
+
#
|
174
|
+
# @param y
|
175
|
+
# A distance along the y axis between 0 and 1.
|
176
|
+
#
|
177
|
+
# @return note - a note object or an exception if it is
|
178
|
+
# unsuccessful.
|
179
|
+
#
|
180
|
+
# @version SketchUp 6.0
|
181
|
+
def add_note(note, x, y)
|
182
|
+
end
|
183
|
+
|
184
|
+
# The add_observer method is used to add an observer to the current object.
|
185
|
+
#
|
186
|
+
# @example
|
187
|
+
# model = Sketchup.active_model
|
188
|
+
# observer = Sketchup::ModelObserver.new
|
189
|
+
# status = model.add_observer(observer)
|
190
|
+
#
|
191
|
+
# @param observer
|
192
|
+
# An observer.
|
193
|
+
#
|
194
|
+
# @return true if successful, false if unsuccessful.
|
195
|
+
#
|
196
|
+
# @version SketchUp 6.0
|
197
|
+
def add_observer(observer)
|
198
|
+
end
|
199
|
+
|
200
|
+
# The attribute_dictionaries method retrieves the AttributeDictionaries object
|
201
|
+
# that is associated with the Model.
|
202
|
+
#
|
203
|
+
# @example
|
204
|
+
# model = Sketchup.active_model
|
205
|
+
# dictionaries = model.attribute_dictionaries
|
206
|
+
# if dictionaries
|
207
|
+
# # Code to do something if attribute dictionaries exist (usually you
|
208
|
+
# # parse the array of dictionaries.
|
209
|
+
# else
|
210
|
+
# # Code to do something if attribute dictionaries do not exist.
|
211
|
+
# end
|
212
|
+
#
|
213
|
+
# @return attributedictionaries - the AttributeDictionaries
|
214
|
+
# object associated with the entity, or nil if there are
|
215
|
+
# no attribute_dictionary objects associated with the
|
216
|
+
# model. Care must be taken if nil is returned, for
|
217
|
+
# example: invoking attribute_dictionaries.length will
|
218
|
+
# throw a NoMethodError exception, not return 0.
|
219
|
+
#
|
220
|
+
# @version SketchUp 6.0
|
221
|
+
def attribute_dictionaries
|
222
|
+
end
|
223
|
+
|
224
|
+
# Returns the Sketchup::AttributeDictionary object that is specified by
|
225
|
+
# name. If the model does not have an attribute dictionary that
|
226
|
+
# corresponds to name, returns either nil, or a creates an attribute
|
227
|
+
# dictionary. If the optional second argument is true, and there is no
|
228
|
+
# attribute dictionary that corresponds to name, a new attribute
|
229
|
+
# dictionary is created.
|
230
|
+
#
|
231
|
+
# @example
|
232
|
+
# model = Sketchup.active_model
|
233
|
+
# create_if_empty = true
|
234
|
+
# dictionary = model.attribute_dictionary('name', create_if_empty)
|
235
|
+
#
|
236
|
+
# @param name
|
237
|
+
# The name of the dictionary you are attempting to
|
238
|
+
# retrieve.
|
239
|
+
#
|
240
|
+
# @param [optional] create
|
241
|
+
# if set to true an attribute dictionary of the
|
242
|
+
# given "name" will be created if not found.
|
243
|
+
#
|
244
|
+
# @return attributedictionary - an attribute dictionary object if
|
245
|
+
# successful, nil if unsuccessful
|
246
|
+
#
|
247
|
+
# @version SketchUp 6.0
|
248
|
+
def attribute_dictionary(name, create = false)
|
249
|
+
end
|
250
|
+
|
251
|
+
# The axes method returns the drawing axes for the model.
|
252
|
+
#
|
253
|
+
# @example
|
254
|
+
# # Point for a rectangle.
|
255
|
+
# points = [
|
256
|
+
# Geom::Point3d.new( 0, 0, 0),
|
257
|
+
# Geom::Point3d.new(10, 0, 0),
|
258
|
+
# Geom::Point3d.new(10, 20, 0),
|
259
|
+
# Geom::Point3d.new( 0, 20, 0)
|
260
|
+
# ]
|
261
|
+
# # Transform the points so they are local to the model axes. Otherwise
|
262
|
+
# # they would be local to the model origin.
|
263
|
+
# tr = Sketchup.active_model.axes.transformation
|
264
|
+
# points.each { |point| point.transform!(tr) }
|
265
|
+
# Sketchup.active_model.active_entities.add_face(points)
|
266
|
+
#
|
267
|
+
# @return Axes - the axes for the model.
|
268
|
+
#
|
269
|
+
# @version SketchUp 2016
|
270
|
+
def axes
|
271
|
+
end
|
272
|
+
|
273
|
+
# The behavior method retrieves the behavior of the model.
|
274
|
+
#
|
275
|
+
# @example
|
276
|
+
# model = Sketchup.active_model
|
277
|
+
# behavior = model.behavior
|
278
|
+
#
|
279
|
+
# @return behavior = behavior object for the model if successful
|
280
|
+
#
|
281
|
+
# @version SketchUp 6.0
|
282
|
+
def behavior
|
283
|
+
end
|
284
|
+
|
285
|
+
# The bounds method retrieves the bounding box of the model.
|
286
|
+
#
|
287
|
+
# @example
|
288
|
+
# model = Sketchup.active_model
|
289
|
+
# bounds = model.bounds
|
290
|
+
#
|
291
|
+
# @return boundingbox = bounding box for the model if successful
|
292
|
+
#
|
293
|
+
# @version SketchUp 6.0
|
294
|
+
def bounds
|
295
|
+
end
|
296
|
+
|
297
|
+
# The classifications method is used to retrieve the Classifications object
|
298
|
+
# for this model.
|
299
|
+
#
|
300
|
+
# @example
|
301
|
+
# model = Sketchup.active_model
|
302
|
+
# c = model.classifications
|
303
|
+
#
|
304
|
+
# @return a Classifications object.
|
305
|
+
#
|
306
|
+
# @version SketchUp 2015
|
307
|
+
def classifications
|
308
|
+
end
|
309
|
+
|
310
|
+
# The close method is used to close this model. On Mac OS, only the active
|
311
|
+
# model can be closed. On Windows, since there can be only one document open,
|
312
|
+
# this method will perform a File/New operation.
|
313
|
+
#
|
314
|
+
# @example
|
315
|
+
# Sketchup.file_new
|
316
|
+
# model = Sketchup.active_model
|
317
|
+
# model.close
|
318
|
+
#
|
319
|
+
# @param ignore_changes
|
320
|
+
# boolean - if true, model changes will be
|
321
|
+
# ignored and save prompts will be suppressed.
|
322
|
+
# If false, changes will not be ignored and save
|
323
|
+
# prompts will be displayed normally.
|
324
|
+
#
|
325
|
+
# @return nil
|
326
|
+
#
|
327
|
+
# @version SketchUp 2015
|
328
|
+
def close(ignore_changes = false)
|
329
|
+
end
|
330
|
+
|
331
|
+
# The close_active method is used to close the currently active (open) group
|
332
|
+
# or component.
|
333
|
+
#
|
334
|
+
# Note: before SketchUp 2014 this method had a bug where it didn't create an
|
335
|
+
# undo operation and that could lead to corrupted geometry when undo/redo was
|
336
|
+
# used after invoking this method.
|
337
|
+
#
|
338
|
+
# @example
|
339
|
+
# model = Sketchup.active_model
|
340
|
+
# status = model.close_active
|
341
|
+
#
|
342
|
+
# @return status - true if successful, false if unsuccessful.
|
343
|
+
#
|
344
|
+
# @version SketchUp 6.0
|
345
|
+
def close_active
|
346
|
+
end
|
347
|
+
|
348
|
+
# The commit_operation method commits an operation for undo.
|
349
|
+
#
|
350
|
+
# The commit_operation method is normally called at the end of a method to
|
351
|
+
# commit the operation that the method performs.
|
352
|
+
#
|
353
|
+
# @example
|
354
|
+
# status = model.commit_operation
|
355
|
+
#
|
356
|
+
# @return status - true if successful, false if unsuccessful
|
357
|
+
#
|
358
|
+
# @version SketchUp 6.0
|
359
|
+
def commit_operation
|
360
|
+
end
|
361
|
+
|
362
|
+
# The definitions method retrieves a definition list containing all of the
|
363
|
+
# component definitions in the model.
|
364
|
+
#
|
365
|
+
# The returned definitions can be empty.
|
366
|
+
#
|
367
|
+
# @example
|
368
|
+
# model = Sketchup.active_model
|
369
|
+
# definitions = model.definitions
|
370
|
+
#
|
371
|
+
# @return definitions - a definitions list if successful.
|
372
|
+
#
|
373
|
+
# @version SketchUp 6.0
|
374
|
+
def definitions
|
375
|
+
end
|
376
|
+
|
377
|
+
# The description method retrieves a description of the model as found in the
|
378
|
+
# Model Info > Files panel.
|
379
|
+
#
|
380
|
+
# The returned description can be empty. The default description for all models
|
381
|
+
# is empty.
|
382
|
+
#
|
383
|
+
# @example
|
384
|
+
# model = Sketchup.active_model
|
385
|
+
# description = model.description
|
386
|
+
#
|
387
|
+
# @return description - a description if successful.
|
388
|
+
#
|
389
|
+
# @version SketchUp 6.0
|
390
|
+
def description
|
391
|
+
end
|
392
|
+
|
393
|
+
# The {#description=} method sets the description of the model.
|
394
|
+
#
|
395
|
+
# @example
|
396
|
+
# model = Sketchup.active_model
|
397
|
+
# description = model.description = "This is a model of a house on the " <<
|
398
|
+
# "North West Corner of 10th and Dolores Street in Carmel, California"
|
399
|
+
#
|
400
|
+
# @param [String] description
|
401
|
+
# the description string to be set.
|
402
|
+
#
|
403
|
+
# @return [String]
|
404
|
+
#
|
405
|
+
# @version SketchUp 6.0
|
406
|
+
def description=(description)
|
407
|
+
end
|
408
|
+
|
409
|
+
# Returns the transformation of the current component edit session. If a user
|
410
|
+
# has double-clicked to edit a component's geometry, this will
|
411
|
+
# return the transformation of that component, relative to its parent's
|
412
|
+
# origin. This allows one to correctly calculate "local" transformations of
|
413
|
+
# a given entity regardless of whether the user is in edit mode.
|
414
|
+
#
|
415
|
+
# @example
|
416
|
+
# Sketchup.active_model.edit_transform
|
417
|
+
#
|
418
|
+
# @return transform - the current edit Transformation
|
419
|
+
#
|
420
|
+
# @version SketchUp 7.0
|
421
|
+
def edit_transform
|
422
|
+
end
|
423
|
+
|
424
|
+
# The entities method returns an Entities object containing an array of
|
425
|
+
# entities in the model.
|
426
|
+
#
|
427
|
+
# If no entities are in your model, this method returns an empty Entities
|
428
|
+
# object (an empty array)
|
429
|
+
#
|
430
|
+
# @example
|
431
|
+
# model = Sketchup.active_model
|
432
|
+
# entities = model.entities
|
433
|
+
#
|
434
|
+
# @return entities - an Entities object if successful
|
435
|
+
#
|
436
|
+
# @version SketchUp 6.0
|
437
|
+
def entities
|
438
|
+
end
|
439
|
+
|
440
|
+
# The export method is used to export a given file format. It knows which
|
441
|
+
# format to export based on the file extension you place on the file name.
|
442
|
+
# For example, a filename of "thing.obj" will export an OBJ file, whereas
|
443
|
+
# "thing.dae" will export a COLLADA file.
|
444
|
+
#
|
445
|
+
# For SketchUp Pro 7.1+, valid extensions include dae, kmz, 3ds, dwg,
|
446
|
+
# dxf, fbx, obj, wrl, and xsi. SketchUp Free only supports dae and kmz.
|
447
|
+
#
|
448
|
+
# Format Support Changes:
|
449
|
+
# * SketchUp 7.1 added COLLADA (.dae) export capability.
|
450
|
+
# * SketchUp Pro 2016+ includes PDF export capability.
|
451
|
+
#
|
452
|
+
# The optional second parameter can be either:
|
453
|
+
# - a boolean flag, which instructs the exporter to display a summary dialog after export
|
454
|
+
# - a hash of options specific to the given exporter, which may include a summary dialog flag.
|
455
|
+
#
|
456
|
+
# The following describes the options that can be defined in the hash for the
|
457
|
+
# various exporters.
|
458
|
+
#
|
459
|
+
# All exporters
|
460
|
+
# - show_summary (default = false)
|
461
|
+
#
|
462
|
+
# DAE (COLLADA)
|
463
|
+
# - triangulated_faces (default = true)
|
464
|
+
# - doublesided_faces (default = true)
|
465
|
+
# - edges (default = false)
|
466
|
+
# - author_attribution (default = false)
|
467
|
+
# - texture_maps (default = true)
|
468
|
+
# - selectionset_only (default = false)
|
469
|
+
# - preserve_instancing (default = true)
|
470
|
+
#
|
471
|
+
# PDF
|
472
|
+
# WINDOWS OPTIONS
|
473
|
+
# - output_profile_lines (default = true)
|
474
|
+
# - output_section_lines (default = true)
|
475
|
+
# - edge_extensions (default = true)
|
476
|
+
# - match_screen_profiles (default = true)
|
477
|
+
# - match_screen_section (default = true)
|
478
|
+
# - match_screen_extensions (default = true)
|
479
|
+
# - full_scale (default = true)
|
480
|
+
# - map_fonts (default = true)
|
481
|
+
# - drawing_units (default = Length::Inches)
|
482
|
+
# - extension_units (default = Length::Feet)
|
483
|
+
# - height_units (default = Length::Feet)
|
484
|
+
# - model_units (default = Length::Feet)
|
485
|
+
# - width_units (default = Length::Feet)
|
486
|
+
# - extension_length (default = 0.0)
|
487
|
+
# - line_width (default = 0.0)
|
488
|
+
# - line_width_section (default = 0.0)
|
489
|
+
# - length_in_drawing (default = 1.0)
|
490
|
+
# - length_in_model (default = 1.0)
|
491
|
+
# - window_height (default = 1.0)
|
492
|
+
#
|
493
|
+
# MAC OPTIONS
|
494
|
+
# - line_weight (default = 0.5)
|
495
|
+
# - imageWidth (default = 50)
|
496
|
+
# - imageHeight (default = 50)
|
497
|
+
#
|
498
|
+
# Returns true or false indicating success or failure.
|
499
|
+
#
|
500
|
+
# @example
|
501
|
+
# model = Sketchup.active_model
|
502
|
+
# show_summary = true
|
503
|
+
#
|
504
|
+
# # Export dwg file on a PC, showing a summary when complete.
|
505
|
+
# status = model.export 'c:\my_export.dwg', show_summary
|
506
|
+
#
|
507
|
+
# # Export kmz file on Mac (note the absolute file path), without summary.
|
508
|
+
# status = model.export '/Library/my_export.kmz'
|
509
|
+
#
|
510
|
+
# # Export pdf file on a PC, showing a summary when complete.
|
511
|
+
# options_hash = { :show_summary => true,
|
512
|
+
# :output_profile_lines => false,
|
513
|
+
# :map_fonts => false,
|
514
|
+
# :model_units => Length::Meter }
|
515
|
+
# status = model.export 'c:/my_export.pdf', show_summary
|
516
|
+
#
|
517
|
+
# # Or for a COLLADA (.dae) file, using the default options
|
518
|
+
# options_hash = { :triangulated_faces => true,
|
519
|
+
# :doublesided_faces => true,
|
520
|
+
# :edges => false,
|
521
|
+
# :author_attribution => false,
|
522
|
+
# :texture_maps => true,
|
523
|
+
# :selectionset_only => false,
|
524
|
+
# :preserve_instancing => true }
|
525
|
+
# status = model.export 'c:/my_export.dae', options_hash
|
526
|
+
#
|
527
|
+
# @param filename
|
528
|
+
# The name of the file to export.
|
529
|
+
#
|
530
|
+
# @param options
|
531
|
+
# Either a true/false value or a hash table. See above
|
532
|
+
# for details.
|
533
|
+
#
|
534
|
+
# @return status - true if successful, false if unsuccessful
|
535
|
+
#
|
536
|
+
# @version SketchUp 6.0
|
537
|
+
def export(filename, options)
|
538
|
+
end
|
539
|
+
|
540
|
+
# Finds and returns entities by their entityID or GUID.
|
541
|
+
#
|
542
|
+
# GUIDs looked up are only relevant to Group and ComponentInstance as these
|
543
|
+
# GUIDs are persistent. ComponentDefinition and Model GUIDs are not persistent
|
544
|
+
# and are not looked up.
|
545
|
+
#
|
546
|
+
# When given an array of IDs, an array is returned with a 1:1 mapping to the
|
547
|
+
# input arguments. This array may contain nil values if some ids were not
|
548
|
+
# found. You cannot look up a mix of entityIDs and GUIDs in the same call.
|
549
|
+
#
|
550
|
+
# @example
|
551
|
+
# model = Sketchup.active_model
|
552
|
+
#
|
553
|
+
# # Look up by entityID.
|
554
|
+
# entity_id = model.entities.add_line([0,0,0], [9,9,9]).entityID
|
555
|
+
# entity = model.find_entity_by_id(entity_id)
|
556
|
+
#
|
557
|
+
# # Look up by GUID.
|
558
|
+
# guid = model.entities.add_group.guid
|
559
|
+
# entity = model.find_entity_by_id(guid)
|
560
|
+
#
|
561
|
+
# # Look up multiple.
|
562
|
+
# entities = model.find_entity_by_id(id1, id2, id3)
|
563
|
+
# entities = model.find_entity_by_id([id1, id2, id3])
|
564
|
+
# entities = model.find_entity_by_id(guid1, guid2, guid3)
|
565
|
+
# entities = model.find_entity_by_id([guid1, guid2, guid3])
|
566
|
+
#
|
567
|
+
# @param ids_or_array
|
568
|
+
# Pass either a series of ids or a single array containing
|
569
|
+
# ids. Ids must either be entityID Integers or GUID
|
570
|
+
# Strings.
|
571
|
+
#
|
572
|
+
# @return entities_or_array Returns an array with Entity objects for each id
|
573
|
+
# found and nil otherwise. Single Entity or nil when
|
574
|
+
# called with a single id.
|
575
|
+
#
|
576
|
+
# @version SketchUp 2015
|
577
|
+
def find_entity_by_id(ids_or_array)
|
578
|
+
end
|
579
|
+
|
580
|
+
# Finds and returns entities by their persistent id.
|
581
|
+
#
|
582
|
+
# When given an array of IDs, an array is returned with a 1:1 mapping to the
|
583
|
+
# input arguments. This array may contain `nil` values if some ids were not
|
584
|
+
# found.
|
585
|
+
#
|
586
|
+
# @example
|
587
|
+
# model = Sketchup.active_model
|
588
|
+
#
|
589
|
+
# # Look up by persistent_id.
|
590
|
+
# pid = model.entities.add_line([0,0,0], [9,9,9]).persistent_id
|
591
|
+
# entity = model.find_entity_by_persistent_id(pid)
|
592
|
+
#
|
593
|
+
# # Look up multiple.
|
594
|
+
# entities = model.find_entity_by_persistent_id(id1, id2, id3)
|
595
|
+
# entities = model.find_entity_by_persistent_id([id1, id2, id3])
|
596
|
+
#
|
597
|
+
# @param [Array<Integer>] ids_or_array
|
598
|
+
# Pass either a series of ids or a
|
599
|
+
# single array containing persistent ids.
|
600
|
+
#
|
601
|
+
# @return [Array<Sketchup::Entity, nil>] Returns an array with
|
602
|
+
# {Sketchup::Entity} objects for each id found and nil otherwise.
|
603
|
+
#
|
604
|
+
# @version SketchUp 2017
|
605
|
+
def find_entity_by_persistent_id(ids_or_array)
|
606
|
+
end
|
607
|
+
|
608
|
+
# This methods determines if the model is georeferenced.
|
609
|
+
#
|
610
|
+
# @example
|
611
|
+
# if model.georeferenced?
|
612
|
+
# UI.messagebox('This model is georeferenced.')
|
613
|
+
# else
|
614
|
+
# UI.messagebox('This model is NOT georeferenced.')
|
615
|
+
# end
|
616
|
+
#
|
617
|
+
# @return [Boolean]
|
618
|
+
#
|
619
|
+
# @version SketchUp 7.1
|
620
|
+
def georeferenced?
|
621
|
+
end
|
622
|
+
|
623
|
+
# The get_attribute method gets the value of an attribute that in the
|
624
|
+
# AttributeDictionary with the given name. If no value is associated
|
625
|
+
# with key, or if the model does not have an attribute dictionary
|
626
|
+
# specified by name, the optional third parameter will be returned.
|
627
|
+
#
|
628
|
+
# @example
|
629
|
+
# model = Sketchup.active_model
|
630
|
+
# model.set_attribute('testdictionary', 'test', 115)
|
631
|
+
# value = model.get_attribute('testdictionary', 'test', 42)
|
632
|
+
#
|
633
|
+
# @param dictname
|
634
|
+
# The name of the dictionary containing the value.
|
635
|
+
#
|
636
|
+
# @param key
|
637
|
+
# The key containing the value.
|
638
|
+
#
|
639
|
+
# @param [optional] defaultvalue
|
640
|
+
# default value that will be returned if a
|
641
|
+
# value does not exist.
|
642
|
+
#
|
643
|
+
# @return value - the value for a given key in the given
|
644
|
+
# dictionary if a value exists; the default value if a
|
645
|
+
# defaultvalue is provided and the value does not exist;
|
646
|
+
# nil if the value does not exist and no defaultvalue is
|
647
|
+
# provided.
|
648
|
+
#
|
649
|
+
# @version SketchUp 6.0
|
650
|
+
def get_attribute(dictname, key, defaultvalue = nil)
|
651
|
+
end
|
652
|
+
|
653
|
+
# the get_datum method retrieves the datum, in the form of a string, used in
|
654
|
+
# UTM conversions.
|
655
|
+
#
|
656
|
+
# @example
|
657
|
+
# model = Sketchup.active_model
|
658
|
+
# datum = model.get_datum
|
659
|
+
#
|
660
|
+
# @return datum - a datum represented as a string if successful.
|
661
|
+
#
|
662
|
+
# @version SketchUp 6.0
|
663
|
+
def get_datum
|
664
|
+
end
|
665
|
+
|
666
|
+
# Returns a value which indicates the product family of the installed SketchUp
|
667
|
+
# application.
|
668
|
+
# As of SketchUp 2013, the return values are:
|
669
|
+
# - +0+ = Unknown
|
670
|
+
# - +1+ = Pro Trial
|
671
|
+
# - +2+ = Pro
|
672
|
+
# - +3+ = Pro Expired
|
673
|
+
# - +4+ = Make Trial
|
674
|
+
# - +5+ = Make Expired
|
675
|
+
# - +6+ = Make
|
676
|
+
# - +7+ = Pro License Unavailable
|
677
|
+
#
|
678
|
+
# The Model class defines some of these values as constants as of SketchUp
|
679
|
+
# 2016.
|
680
|
+
#
|
681
|
+
# @example
|
682
|
+
# model = Sketchup.active_model
|
683
|
+
# product_family = model.get_product_family
|
684
|
+
# if product_family == Sketchup::Model::ProLicensed then
|
685
|
+
# puts("You are running licensed SketchUp Pro!")
|
686
|
+
# end
|
687
|
+
#
|
688
|
+
# @return number - the product family number.
|
689
|
+
#
|
690
|
+
# @version SketchUp 6.0
|
691
|
+
def get_product_family
|
692
|
+
end
|
693
|
+
|
694
|
+
# The guid method retrieves the globally unique identifier, in the form of a
|
695
|
+
# string, for the Model. The guid will change after the model is modified and
|
696
|
+
# saved. The Model guid is stored with the SketchUp file; it will not change if the
|
697
|
+
# file is moved to another computer.
|
698
|
+
#
|
699
|
+
# @example
|
700
|
+
# model = Sketchup.active_model
|
701
|
+
# guid = model.guid
|
702
|
+
#
|
703
|
+
# @return guid - a globally unique identifier, in the form of a
|
704
|
+
# string, for the model
|
705
|
+
#
|
706
|
+
# @version SketchUp 6.0
|
707
|
+
def guid
|
708
|
+
end
|
709
|
+
|
710
|
+
# The import method is used to load a file by recognizing the file extension
|
711
|
+
# and calling appropriate importer.
|
712
|
+
#
|
713
|
+
# @example
|
714
|
+
# model = Sketchup.active_model
|
715
|
+
# show_summary = true
|
716
|
+
# status = model.import "filename", show_summary
|
717
|
+
#
|
718
|
+
# @param filename
|
719
|
+
# The name of the file to import.
|
720
|
+
#
|
721
|
+
# @param show_summary
|
722
|
+
# true if you want to show a summary window, false if you
|
723
|
+
# do not want to show a summary window.
|
724
|
+
#
|
725
|
+
# @return status - true if successful, false if unsuccessful
|
726
|
+
#
|
727
|
+
# @version SketchUp 6.0
|
728
|
+
def import(filename, show_summary)
|
729
|
+
end
|
730
|
+
|
731
|
+
# The {#instance_path_from_pid_path} method returns a instance path given a
|
732
|
+
# string with persistent ids representing the path to the entity.
|
733
|
+
#
|
734
|
+
# @example
|
735
|
+
# points = [
|
736
|
+
# Geom::Point3d.new( 0, 0, 0),
|
737
|
+
# Geom::Point3d.new(10, 0, 0),
|
738
|
+
# Geom::Point3d.new(10, 20, 0),
|
739
|
+
# Geom::Point3d.new( 0, 20, 0)
|
740
|
+
# ]
|
741
|
+
# model = Sketchup.active_model
|
742
|
+
# entities = model.active_entities
|
743
|
+
# group = entities.add_group
|
744
|
+
# face = group.entities.add_face(points)
|
745
|
+
# pid_path = "#{group.persistent_id}.#{face.persistent_id}"
|
746
|
+
# # pid_path will look something like this: "658.723"
|
747
|
+
# instance_path = model.instance_path_from_pid_path(pid_path)
|
748
|
+
#
|
749
|
+
# @param [String] pid_path
|
750
|
+
# a string with persistent ids delimited by period.
|
751
|
+
#
|
752
|
+
# @raise [ArgumentError] if a valid instance path cannot be created from the
|
753
|
+
# given input path string.
|
754
|
+
#
|
755
|
+
# @return [Sketchup::InstancePath]
|
756
|
+
#
|
757
|
+
# @see Sketchup::InstancePath#persistent_id_path
|
758
|
+
#
|
759
|
+
# @version SketchUp 2017
|
760
|
+
def instance_path_from_pid_path(pid_path)
|
761
|
+
end
|
762
|
+
|
763
|
+
# The latlong_to_point method converts a latitude and longitude to a Point3d
|
764
|
+
# object in the model. It does not actually work with a LatLong object, but
|
765
|
+
# operates on a 2-element array. The returned point will always be on the
|
766
|
+
# ground (z=0).
|
767
|
+
#
|
768
|
+
# @example
|
769
|
+
# # Draw a point in Boulder, Colorado (40.0170N, 105.2830W)
|
770
|
+
# lnglat_array = [-105.28300, 40.01700]
|
771
|
+
# model = Sketchup.active_model
|
772
|
+
# local_point = model.latlong_to_point(lnglat_array)
|
773
|
+
# model.entities.add_cpoint(local_point)
|
774
|
+
#
|
775
|
+
# @param lnglat_array
|
776
|
+
# A 2-element array containing first the longitude then
|
777
|
+
# the latitude.
|
778
|
+
#
|
779
|
+
# @return point - a point3d object if successful, false if
|
780
|
+
# unsuccessful.
|
781
|
+
#
|
782
|
+
# @version SketchUp 6.0
|
783
|
+
def latlong_to_point(lnglat_array)
|
784
|
+
end
|
785
|
+
|
786
|
+
# The layers method retrieves a collection of all Layers objects in the model.
|
787
|
+
#
|
788
|
+
# @example
|
789
|
+
# model = Sketchup.active_model
|
790
|
+
# layers = model.layers
|
791
|
+
#
|
792
|
+
# @return layers - a Layers object containing a collection of
|
793
|
+
# layers in the model
|
794
|
+
#
|
795
|
+
# @version SketchUp 6.0
|
796
|
+
def layers
|
797
|
+
end
|
798
|
+
|
799
|
+
# This method retrieves an Array of all of the datums recognized by SketchUp.
|
800
|
+
#
|
801
|
+
# @example
|
802
|
+
# model = Sketchup.active_model
|
803
|
+
# datums = model.list_datums
|
804
|
+
#
|
805
|
+
# @return datums - An Array object containing the datums
|
806
|
+
# supported by SketchUp
|
807
|
+
#
|
808
|
+
# @version SketchUp 6.0
|
809
|
+
def list_datums
|
810
|
+
end
|
811
|
+
|
812
|
+
# The materials method returns a collection of all of the materials in the
|
813
|
+
# model.
|
814
|
+
#
|
815
|
+
# @example
|
816
|
+
# model = Sketchup.active_model
|
817
|
+
# materials = model.materials
|
818
|
+
#
|
819
|
+
# @return materials - materials collection.
|
820
|
+
#
|
821
|
+
# @version SketchUp 6.0
|
822
|
+
def materials
|
823
|
+
end
|
824
|
+
|
825
|
+
# This method can be used to turn mipmapping on or off.
|
826
|
+
#
|
827
|
+
# @example
|
828
|
+
# Sketchup.active_model.mipmapping = false
|
829
|
+
#
|
830
|
+
# @param mipmap
|
831
|
+
# boolean - whether mipmapping is turned on or off.
|
832
|
+
#
|
833
|
+
# @return boolean - the new mipmapping setting
|
834
|
+
#
|
835
|
+
# @version SketchUp 7.0
|
836
|
+
def mipmapping=(mipmap)
|
837
|
+
end
|
838
|
+
|
839
|
+
# This method can be used to find out if mipmapping is on or off.
|
840
|
+
#
|
841
|
+
# @example
|
842
|
+
# mipmapping = Sketchup.active_model.mipmapping?
|
843
|
+
#
|
844
|
+
# @return boolean - the current mipmapping setting
|
845
|
+
#
|
846
|
+
# @return [Boolean]
|
847
|
+
#
|
848
|
+
# @version SketchUp 7.0
|
849
|
+
def mipmapping?
|
850
|
+
end
|
851
|
+
|
852
|
+
# The modified? method determines if the Model has been modified since the
|
853
|
+
# last save.
|
854
|
+
#
|
855
|
+
# @example
|
856
|
+
# model = Sketchup.active_model
|
857
|
+
# entities = model.active_entities
|
858
|
+
# # Add a group to force the status return value to be true
|
859
|
+
# entities.add_group
|
860
|
+
# status = model.modified?
|
861
|
+
#
|
862
|
+
# @return status = true if the model has been modified since last
|
863
|
+
# save (and requires a save), false if the model has not
|
864
|
+
# been modified.
|
865
|
+
#
|
866
|
+
# @return [Boolean]
|
867
|
+
#
|
868
|
+
# @version SketchUp 6.0
|
869
|
+
def modified?
|
870
|
+
end
|
871
|
+
|
872
|
+
# The name method retrieves the string name of the model.
|
873
|
+
#
|
874
|
+
# @example
|
875
|
+
# model = Sketchup.active_model
|
876
|
+
# name = model.name
|
877
|
+
#
|
878
|
+
# @return name - string name of the model
|
879
|
+
#
|
880
|
+
# @version SketchUp 6.0
|
881
|
+
def name
|
882
|
+
end
|
883
|
+
|
884
|
+
# The name= method sets the string name of the model.
|
885
|
+
#
|
886
|
+
# @example
|
887
|
+
# Sketchup.active_model.name = "My New Model Name"
|
888
|
+
#
|
889
|
+
# @param name
|
890
|
+
# - new name of the model
|
891
|
+
#
|
892
|
+
# @return string - the new name
|
893
|
+
#
|
894
|
+
# @version SketchUp 6.0
|
895
|
+
def name=(name)
|
896
|
+
end
|
897
|
+
|
898
|
+
# Returns the number faces in a model.
|
899
|
+
#
|
900
|
+
# @example
|
901
|
+
# model = Sketchup.active_model
|
902
|
+
# number_of_faces = model.number_faces
|
903
|
+
# puts "There are #{number_of_faces} faces in the model."
|
904
|
+
#
|
905
|
+
# @version SketchUp 7.1
|
906
|
+
def number_faces
|
907
|
+
end
|
908
|
+
|
909
|
+
# The options method retrieves the options manager that defines the options
|
910
|
+
# settings for the model.
|
911
|
+
#
|
912
|
+
# Use the string keys instead of numerical indicies when accessing the options
|
913
|
+
# as the indicies are not consistent between SketchUp versions.
|
914
|
+
#
|
915
|
+
# @example
|
916
|
+
# # Output all options available.
|
917
|
+
# options_manager = Sketchup.active_model.options
|
918
|
+
# options_manager.keys.each { |options_provider|
|
919
|
+
# puts options_provider.name
|
920
|
+
# options_provider.each { |key, value|
|
921
|
+
# puts "> #{key} - #{value}"
|
922
|
+
# }
|
923
|
+
# }
|
924
|
+
#
|
925
|
+
# @return optionsmanager - an OptionsManager object containing
|
926
|
+
# one or more options providers if successful.
|
927
|
+
#
|
928
|
+
# @version SketchUp 6.0
|
929
|
+
def options
|
930
|
+
end
|
931
|
+
|
932
|
+
# The pages method retrieves a Pages object containing all of the pages in the
|
933
|
+
# Model.
|
934
|
+
#
|
935
|
+
# @example
|
936
|
+
# model = Sketchup.active_model
|
937
|
+
# pages = model.pages
|
938
|
+
#
|
939
|
+
# @return pages - returns a Pages object with 0 or more pages.
|
940
|
+
#
|
941
|
+
# @version SketchUp 6.0
|
942
|
+
def pages
|
943
|
+
end
|
944
|
+
|
945
|
+
# The path method retrieves the path of the file from which the model was
|
946
|
+
# opened.
|
947
|
+
#
|
948
|
+
# An empty string is returned for a new model (one which has not been saved
|
949
|
+
# and opened.)
|
950
|
+
#
|
951
|
+
# @example
|
952
|
+
# model = Sketchup.active_model
|
953
|
+
# path = model.path
|
954
|
+
#
|
955
|
+
# @return path - an string containing the path for the currently
|
956
|
+
# opened model.
|
957
|
+
#
|
958
|
+
# @version SketchUp 6.0
|
959
|
+
def path
|
960
|
+
end
|
961
|
+
|
962
|
+
# The place_component method places a new component in the Model using the
|
963
|
+
# component placement tool.
|
964
|
+
#
|
965
|
+
# @example
|
966
|
+
# model.place_component componentdefinition, repeat
|
967
|
+
#
|
968
|
+
# @param componentdef
|
969
|
+
# A component definition object containing the
|
970
|
+
# definition (blueprint) for the component.
|
971
|
+
#
|
972
|
+
# @param repeat
|
973
|
+
# If set to true, stay in the component
|
974
|
+
# placement tool and place multiple components.
|
975
|
+
#
|
976
|
+
# @return model - The model object on success or Nil
|
977
|
+
#
|
978
|
+
# @version SketchUp 6.0
|
979
|
+
def place_component(componentdef, repeat = false)
|
980
|
+
end
|
981
|
+
|
982
|
+
# The point_to_latlong method converts a point in the model to a LatLong so
|
983
|
+
# that you can get its latitude and longitude.
|
984
|
+
#
|
985
|
+
# This method uses the location information set in ShadowInfo.
|
986
|
+
#
|
987
|
+
# NOTE: SketchUp 6.0 and higher has a change where this method returns a
|
988
|
+
# Point3d instead of a LatLong, where the x and y values contain the LatLong
|
989
|
+
# coordinates.
|
990
|
+
#
|
991
|
+
# @example
|
992
|
+
# model = Sketchup.active_model
|
993
|
+
# local_point = Geom::Point3d.new(10, 10, 10)
|
994
|
+
# world_point = model.point_to_latlong(local_point)
|
995
|
+
#
|
996
|
+
# @param point
|
997
|
+
# A Point3d object.
|
998
|
+
#
|
999
|
+
# @return latlong_or_point - a LatLong or Point3d object. See
|
1000
|
+
# details for information.
|
1001
|
+
#
|
1002
|
+
# @version SketchUp 6.0
|
1003
|
+
def point_to_latlong(point)
|
1004
|
+
end
|
1005
|
+
|
1006
|
+
# This method converts a Point3d object in the Model to UTM coordinates.
|
1007
|
+
#
|
1008
|
+
# This method uses the location information set in ShadowInfo. See also UTM.
|
1009
|
+
#
|
1010
|
+
# @example
|
1011
|
+
# model = Sketchup.active_model
|
1012
|
+
# point = Geom::Point3d.new(10, 10, 10)
|
1013
|
+
# utm = model.point_to_utm(point)
|
1014
|
+
#
|
1015
|
+
# @param point
|
1016
|
+
# A Point3d object.
|
1017
|
+
#
|
1018
|
+
# @return utm - a UTM object
|
1019
|
+
#
|
1020
|
+
# @version SketchUp 6.0
|
1021
|
+
def point_to_utm(point)
|
1022
|
+
end
|
1023
|
+
|
1024
|
+
# The raytest method is used to cast a ray (line) through the model and return
|
1025
|
+
# the first thing that the ray hits.
|
1026
|
+
#
|
1027
|
+
# A ray is a two element array containing a point and a vector
|
1028
|
+
# [Geom::Point3d(), Geom::Vector3d()]. The point defines the start point of
|
1029
|
+
# the ray and the vector defines the direction. If direction can not be
|
1030
|
+
# normalized (e.g. direction = [0, 0, 0]), direction is taken as a point the
|
1031
|
+
# ray intersects.
|
1032
|
+
#
|
1033
|
+
# @example
|
1034
|
+
# model = Sketchup.active_model
|
1035
|
+
# ray = [Geom::Point3d.new(1, 2, 3), Geom::Vector3d.new(4, 5, 6)]
|
1036
|
+
# item = model.raytest(ray, false) # Consider hidden geometry when
|
1037
|
+
# # computing intersections.
|
1038
|
+
#
|
1039
|
+
# @note The parameter wysiwyg_flag was added in SU8 M1.
|
1040
|
+
#
|
1041
|
+
# @param wysiwyg_flag
|
1042
|
+
# An optional boolean, added in SU8 M1, indicating
|
1043
|
+
# whether or not to consider hidden geometry in intersect
|
1044
|
+
# computations. If this flag is not specified, it
|
1045
|
+
# defaults to true (WYSIWYG) - i.e. hidden geometry is
|
1046
|
+
# not intersected against.
|
1047
|
+
#
|
1048
|
+
# @param ray
|
1049
|
+
# A two element array containing a point and a vector.
|
1050
|
+
#
|
1051
|
+
# @return item - an array of two values. The first value is a
|
1052
|
+
# Point3d where the item that the ray passed through
|
1053
|
+
# exists. The second element is the instance path array
|
1054
|
+
# of the entity that the ray hit. For example, if the ray
|
1055
|
+
# hits a face that contained by a component instance the
|
1056
|
+
# instance path would be [Component1]. If the ray hit a
|
1057
|
+
# face that is contained by a component instance, which
|
1058
|
+
# is contained by another component instance and so on,
|
1059
|
+
# the instance path would be [Component1, Component2,
|
1060
|
+
# Component3...].
|
1061
|
+
#
|
1062
|
+
# @version SketchUp 6.0
|
1063
|
+
def raytest(ray, wysiwyg_flag)
|
1064
|
+
end
|
1065
|
+
|
1066
|
+
# The remove_observer method is used to remove an observer from the current
|
1067
|
+
# object.
|
1068
|
+
#
|
1069
|
+
# @example
|
1070
|
+
# model = Sketchup.active_model
|
1071
|
+
# observer = Sketchup::ModelObserver.new
|
1072
|
+
# model.add_observer(observer)
|
1073
|
+
# status = model.remove_observer(observer)
|
1074
|
+
#
|
1075
|
+
# @param observer
|
1076
|
+
# An observer.
|
1077
|
+
#
|
1078
|
+
# @return true if successful, false if unsuccessful.
|
1079
|
+
#
|
1080
|
+
# @version SketchUp 6.0
|
1081
|
+
def remove_observer(observer)
|
1082
|
+
end
|
1083
|
+
|
1084
|
+
# The rendering_options method retrieves the RenderingOptions object for this
|
1085
|
+
# Model.
|
1086
|
+
#
|
1087
|
+
# @example
|
1088
|
+
# model = Sketchup.active_model
|
1089
|
+
# renderingoptions = model.rendering_options
|
1090
|
+
#
|
1091
|
+
# @return renderingoptions - a RenderingOptions object
|
1092
|
+
#
|
1093
|
+
# @version SketchUp 6.0
|
1094
|
+
def rendering_options
|
1095
|
+
end
|
1096
|
+
|
1097
|
+
# This method is used to save the model to a file.
|
1098
|
+
#
|
1099
|
+
# @example
|
1100
|
+
# model = Sketchup.active_model
|
1101
|
+
# # Save the model using the current SketchUp format
|
1102
|
+
# filename = File.join(ENV['Home'], 'Desktop', 'mysketchup.skp')
|
1103
|
+
# status = model.save(filename)
|
1104
|
+
# # Save the model to the current file using the current SketchUp format
|
1105
|
+
# status = model.save
|
1106
|
+
# # Save the model to the current file in SketchUp 8 format
|
1107
|
+
# status = model.save("", Sketchup::Model::VERSION_8)
|
1108
|
+
# # Save the model in SketchUp 8 format
|
1109
|
+
# filename = File.join(ENV['Home'], 'Desktop', 'mysketchup_v8.skp')
|
1110
|
+
# status = model.save("filename", Sketchup::Model::VERSION_8)
|
1111
|
+
#
|
1112
|
+
# @param filename
|
1113
|
+
# The name of the file to save.
|
1114
|
+
# Starting with SketchUp 2014, this parameter is optional.
|
1115
|
+
# If not provided or an empty string, model will be saved
|
1116
|
+
# to the file to which it is associated. It must have
|
1117
|
+
# already been saved to a file.
|
1118
|
+
#
|
1119
|
+
# @param [SketchUp 2014+] version
|
1120
|
+
# Optional SketchUp file format to save.
|
1121
|
+
# If not provided, latest file format will be used.
|
1122
|
+
# Possible values are:
|
1123
|
+
# Sketchup::Model::VERSION_3, Sketchup::Model::VERSION_4,
|
1124
|
+
# Sketchup::Model::VERSION_5, Sketchup::Model::VERSION_6,
|
1125
|
+
# Sketchup::Model::VERSION_7, Sketchup::Model::VERSION_8,
|
1126
|
+
# Sketchup::Model::VERSION_2013,
|
1127
|
+
# Sketchup::Model::VERSION_2014,
|
1128
|
+
# Sketchup::Model::VERSION_2015,
|
1129
|
+
# Sketchup::Model::VERSION_2016,
|
1130
|
+
# Sketchup::Model::VERSION_2017
|
1131
|
+
#
|
1132
|
+
# @return status - true if successful, false if unsuccessful
|
1133
|
+
#
|
1134
|
+
# @version SketchUp 6.0
|
1135
|
+
def save(filename, version)
|
1136
|
+
end
|
1137
|
+
|
1138
|
+
# This method is used to save the copy of the current model to a file.
|
1139
|
+
#
|
1140
|
+
# @example
|
1141
|
+
# model = Sketchup.active_model
|
1142
|
+
# # Save copy of the model using the current SketchUp format
|
1143
|
+
# filename = File.join(ENV['Home'], 'Desktop', 'myModelCopy.skp')
|
1144
|
+
# status = model.save_copy(filename)
|
1145
|
+
# # Save copy of the model in SketchUp 8 format
|
1146
|
+
# filename = File.join(ENV['Home'], 'Desktop', 'mysketchupcopy_v8.skp')
|
1147
|
+
# status = model.save_copy(filename, Sketchup::Model::VERSION_8)
|
1148
|
+
#
|
1149
|
+
# @param filename
|
1150
|
+
# The name of the file to save the model copy.
|
1151
|
+
#
|
1152
|
+
# @param version
|
1153
|
+
# Optional SketchUp file format to save.
|
1154
|
+
# If not provided, latest file format will be used.
|
1155
|
+
# Possible values are:
|
1156
|
+
# Sketchup::Model::VERSION_3, Sketchup::Model::VERSION_4,
|
1157
|
+
# Sketchup::Model::VERSION_5, Sketchup::Model::VERSION_6,
|
1158
|
+
# Sketchup::Model::VERSION_7, Sketchup::Model::VERSION_8,
|
1159
|
+
# Sketchup::Model::VERSION_2013,
|
1160
|
+
# Sketchup::Model::VERSION_2014,
|
1161
|
+
# Sketchup::Model::VERSION_2015,
|
1162
|
+
# Sketchup::Model::VERSION_2016,
|
1163
|
+
# Sketchup::Model::VERSION_2017
|
1164
|
+
#
|
1165
|
+
# @return status - true if successful, false if unsuccessful
|
1166
|
+
#
|
1167
|
+
# @version SketchUp 2014
|
1168
|
+
def save_copy(filename, version)
|
1169
|
+
end
|
1170
|
+
|
1171
|
+
# The save_thumbnail method is used to save a thumbnail image to a file.
|
1172
|
+
# The image format is specified by the file extension of filename. Supported
|
1173
|
+
# formats are bmp, jpg, png, tif, pct, and gif.
|
1174
|
+
#
|
1175
|
+
# @example
|
1176
|
+
# model = Sketchup.active_model
|
1177
|
+
# status = model.save_thumbnail('testthumbnail2.jpg')
|
1178
|
+
#
|
1179
|
+
# @param filename
|
1180
|
+
# The name of the file, with extension, to save the
|
1181
|
+
# thumbnail as.
|
1182
|
+
#
|
1183
|
+
# @return status - true if successful, false if unsuccessful
|
1184
|
+
#
|
1185
|
+
# @version SketchUp 6.0
|
1186
|
+
def save_thumbnail(filename)
|
1187
|
+
end
|
1188
|
+
|
1189
|
+
# This method is used to select a SketchUp Tool object s the active tool. You
|
1190
|
+
# must implement the SketchUp Tool interface to create a tool prior to calling
|
1191
|
+
# this method.
|
1192
|
+
#
|
1193
|
+
# The select tool is activated if you pass nil to the select_tool method. You
|
1194
|
+
# must implement the SketchUp Tool interface to create a tool, prior to calling
|
1195
|
+
# this method, and then instance the tool implementation and pass the object to
|
1196
|
+
# this method. If you attempt to set the select_tool to nil in the initialize
|
1197
|
+
# method of a tool you have written, it will be ignored.
|
1198
|
+
#
|
1199
|
+
# @example
|
1200
|
+
# model = Sketchup.active_model
|
1201
|
+
# tool = model.select_tool(nil)
|
1202
|
+
#
|
1203
|
+
# @param tool
|
1204
|
+
# The Tool object you want to select.
|
1205
|
+
#
|
1206
|
+
# @return model - The Model object.
|
1207
|
+
#
|
1208
|
+
# @version SketchUp 6.0
|
1209
|
+
def select_tool(tool)
|
1210
|
+
end
|
1211
|
+
|
1212
|
+
# This method retrieves a Selection object for the model, containing the
|
1213
|
+
# currently selected entities. The entries in the selection list are not
|
1214
|
+
# necessarily in the same order in which the user selected them.
|
1215
|
+
#
|
1216
|
+
# @example
|
1217
|
+
# model = Sketchup.active_model
|
1218
|
+
# selection = model.selection
|
1219
|
+
#
|
1220
|
+
# @return selection - A Selection object with 0 or more entities
|
1221
|
+
# that are currently selected.
|
1222
|
+
#
|
1223
|
+
# @version SketchUp 6.0
|
1224
|
+
def selection
|
1225
|
+
end
|
1226
|
+
|
1227
|
+
# This method is used to set the value of an attribute in an attribute
|
1228
|
+
# dictionary with the given name.
|
1229
|
+
#
|
1230
|
+
# This method can be used create a new AttributeDictionary object, if needed.
|
1231
|
+
#
|
1232
|
+
# @example
|
1233
|
+
# model = Sketchup.active_model
|
1234
|
+
# value = model.set_attribute('attributedictionaryname', 'key', 'value')
|
1235
|
+
#
|
1236
|
+
# @param attrdictname
|
1237
|
+
# The name of the attribute dictionary whose attribute
|
1238
|
+
# you wish to set.
|
1239
|
+
#
|
1240
|
+
# @param key
|
1241
|
+
# The attribute name.
|
1242
|
+
#
|
1243
|
+
# @param value
|
1244
|
+
# The value to set.
|
1245
|
+
#
|
1246
|
+
# @return value - the value that was set
|
1247
|
+
#
|
1248
|
+
# @version SketchUp 6.0
|
1249
|
+
def set_attribute(attrdictname, key, value)
|
1250
|
+
end
|
1251
|
+
|
1252
|
+
# This method sets the datum used in conversions between the internal
|
1253
|
+
# coordinate system and UTM.
|
1254
|
+
#
|
1255
|
+
# The default datum is WGS84. You can use the method list_datums to get a list
|
1256
|
+
# of all of the datums supported in SketchUp. If you pass an invalid datum to
|
1257
|
+
# set_datum, set_datum returns the default datum.
|
1258
|
+
#
|
1259
|
+
# @example
|
1260
|
+
# model = Sketchup.active_model
|
1261
|
+
# value = model.set_datum('Adindan')
|
1262
|
+
#
|
1263
|
+
# @param datum
|
1264
|
+
#
|
1265
|
+
# @return nil
|
1266
|
+
#
|
1267
|
+
# @version SketchUp 6.0
|
1268
|
+
def set_datum(datum)
|
1269
|
+
end
|
1270
|
+
|
1271
|
+
# This method is used to retrieve the shadow information for the Model.
|
1272
|
+
#
|
1273
|
+
# @example
|
1274
|
+
# model = Sketchup.active_model
|
1275
|
+
# shadowinfo = model.shadow_info
|
1276
|
+
#
|
1277
|
+
# @return shadowinfo - a ShadowInfo object.
|
1278
|
+
#
|
1279
|
+
# @version SketchUp 6.0
|
1280
|
+
def shadow_info
|
1281
|
+
end
|
1282
|
+
|
1283
|
+
# The {#start_operation} method is used to notify SketchUp that a new
|
1284
|
+
# operation (which can be undone) is starting.
|
1285
|
+
#
|
1286
|
+
# The +op_name+ argument is a description for the operation that is displayed
|
1287
|
+
# adjacent to the Edit > Undo menu item. Make sure to provide a user friendly
|
1288
|
+
# name for your operation.
|
1289
|
+
#
|
1290
|
+
# Starting with SketchUp 7.0, there are three additional booleans that one can
|
1291
|
+
# pass in when starting an operation. It is recommended to always set
|
1292
|
+
# +disable_ui+ to +true+. It's left to +false+ for default for compatibility
|
1293
|
+
# reasons.
|
1294
|
+
#
|
1295
|
+
# @example Observer Operation since SU2016
|
1296
|
+
# class MyDefinitionsObserver < Sketchup::DefinitionObserver
|
1297
|
+
# def onComponentAdded(definitions, definition)
|
1298
|
+
# return if definition.deleted?
|
1299
|
+
# # The operation name won't be displayed when the fourth argument is
|
1300
|
+
# # +true+. It will absorb into the previous operation.
|
1301
|
+
# definition.model.start_operation('Tag It', true, false, true)
|
1302
|
+
# definition.set_attribute('MyExtension', 'Tag', 'You are it')
|
1303
|
+
# definition.model.commit_operation
|
1304
|
+
# end
|
1305
|
+
# end
|
1306
|
+
#
|
1307
|
+
# observer = MyDefinitionsObserver.new
|
1308
|
+
# model = Sketchup.active_model
|
1309
|
+
# model.definitions.add_observer(observer)
|
1310
|
+
#
|
1311
|
+
# @example Typical Operation
|
1312
|
+
# model = Sketchup.active_model
|
1313
|
+
# model.start_operation('Generate House', true)
|
1314
|
+
# model.entities.add_line([0, 0, 0], [9, 0, 0])
|
1315
|
+
# model.entities.add_line([9, 0, 0], [9, 0, 9])
|
1316
|
+
# model.commit_operation
|
1317
|
+
#
|
1318
|
+
# @note Operations in SketchUp are sequential and cannot be nested. If you start a
|
1319
|
+
# new Ruby operation while another is still open, you will implicitly close
|
1320
|
+
# the first one.
|
1321
|
+
#
|
1322
|
+
# @param [Boolean] transparent
|
1323
|
+
# if set to true, then this operation will
|
1324
|
+
# append to the previous operation. This is particularly useful for
|
1325
|
+
# creating observers that react to user actions without littering the
|
1326
|
+
# undo stack with extra steps that Ruby is performing.
|
1327
|
+
#
|
1328
|
+
# @param [Boolean] next_transparent
|
1329
|
+
# <b>Deprecated!</b> if set to true, then
|
1330
|
+
# whatever operation comes after this one will be appended into one
|
1331
|
+
# combined operation, allowing the user the undo both actions with a
|
1332
|
+
# single undo command. This flag is a highly difficult one, since there
|
1333
|
+
# are so many ways that a SketchUp user can interrupt a given operation
|
1334
|
+
# with one of their own. <b>Use extreme caution</b> and test thoroughly
|
1335
|
+
# when setting this to true.
|
1336
|
+
#
|
1337
|
+
# @param [Boolean] disable_ui
|
1338
|
+
# if set to true, then SketchUp's tendency to
|
1339
|
+
# update the user interface after each geometry change will be
|
1340
|
+
# suppressed. This can result in much faster Ruby code execution if the
|
1341
|
+
# operation involves updating the model in any way.
|
1342
|
+
#
|
1343
|
+
# @param [String] op_name
|
1344
|
+
# name of the operation visible in the UI
|
1345
|
+
#
|
1346
|
+
# @return [Boolean] +true+ if successful, +false+ if unsuccessful
|
1347
|
+
#
|
1348
|
+
# @version SketchUp 6.0
|
1349
|
+
def start_operation(op_name, disable_ui = false, next_transparent = false, transparent = false)
|
1350
|
+
end
|
1351
|
+
|
1352
|
+
# The styles method retrieves the styles associated with the model.
|
1353
|
+
#
|
1354
|
+
# @example
|
1355
|
+
# model = Sketchup.active_model
|
1356
|
+
# styles = model.styles
|
1357
|
+
#
|
1358
|
+
# @return styles - the Styles object if successful
|
1359
|
+
#
|
1360
|
+
# @version SketchUp 6.0
|
1361
|
+
def styles
|
1362
|
+
end
|
1363
|
+
|
1364
|
+
# The tags method retrieves the string tags of the model.
|
1365
|
+
#
|
1366
|
+
# @example
|
1367
|
+
# model = Sketchup.active_model
|
1368
|
+
# tags = model.tags
|
1369
|
+
#
|
1370
|
+
# @return tags - string tags of the model
|
1371
|
+
#
|
1372
|
+
# @version SketchUp 6.0
|
1373
|
+
def tags
|
1374
|
+
end
|
1375
|
+
|
1376
|
+
# The tags= method sets the string tags of the model.
|
1377
|
+
#
|
1378
|
+
# @example
|
1379
|
+
# Sketchup.active_model.tags = "Building, House, Brick"
|
1380
|
+
#
|
1381
|
+
# @param tags
|
1382
|
+
# - new tags of the model
|
1383
|
+
#
|
1384
|
+
# @return string - the new tags
|
1385
|
+
#
|
1386
|
+
# @version SketchUp 6.0
|
1387
|
+
def tags=(tags)
|
1388
|
+
end
|
1389
|
+
|
1390
|
+
# The tile method retrieves the name of the model. If the model is saved on
|
1391
|
+
# disk, returns the file name without extension. Otherwise returns an empty
|
1392
|
+
# string.
|
1393
|
+
#
|
1394
|
+
# @example
|
1395
|
+
# model = Sketchup.active_model
|
1396
|
+
# title = model.title
|
1397
|
+
#
|
1398
|
+
# @return title - the title of the model or an empty string (if
|
1399
|
+
# the title is not set)
|
1400
|
+
#
|
1401
|
+
# @version SketchUp 6.0
|
1402
|
+
def title
|
1403
|
+
end
|
1404
|
+
|
1405
|
+
# The tools method is used to retrieve the current Tools object.
|
1406
|
+
#
|
1407
|
+
# @example
|
1408
|
+
# model = Sketchup.active_model
|
1409
|
+
# tools = model.tools
|
1410
|
+
#
|
1411
|
+
# @return tools - a Tools object.
|
1412
|
+
#
|
1413
|
+
# @version SketchUp 6.0
|
1414
|
+
def tools
|
1415
|
+
end
|
1416
|
+
|
1417
|
+
# The utm_to_point method converts a position given in UTM coordinates to a
|
1418
|
+
# Point3d in the Model.
|
1419
|
+
#
|
1420
|
+
# @example
|
1421
|
+
# model = Sketchup.active_model
|
1422
|
+
# utm = Geom::UTM.new([+1, "A", 0.12333333, 0.12321321])
|
1423
|
+
# point = model.utm_to_point(utm)
|
1424
|
+
#
|
1425
|
+
# @param utm
|
1426
|
+
# A UTM object.
|
1427
|
+
#
|
1428
|
+
# @return point - A Point3d object.
|
1429
|
+
#
|
1430
|
+
# @version SketchUp 6.0
|
1431
|
+
def utm_to_point(utm)
|
1432
|
+
end
|
1433
|
+
|
1434
|
+
# Determine if a model is a valid Sketchup::Model object. Returns false
|
1435
|
+
# if the model has been closed.
|
1436
|
+
#
|
1437
|
+
# This is useful on the mac where one can have multiple models open at the
|
1438
|
+
# same time. In such a case, this method can tell you if the user has closed
|
1439
|
+
# the model before you perform operations on it.
|
1440
|
+
#
|
1441
|
+
# @example
|
1442
|
+
# # This is a silly example since the active model is generally going to
|
1443
|
+
# # be valid, but it illustrates the idea.
|
1444
|
+
# model = Sketchup.active_model
|
1445
|
+
# if model.valid?
|
1446
|
+
# UI.messagebox('This model is valid.')
|
1447
|
+
# else
|
1448
|
+
# UI.messagebox('This model is NOT valid.')
|
1449
|
+
# end
|
1450
|
+
#
|
1451
|
+
# @return valid - true or false depending on model validity
|
1452
|
+
#
|
1453
|
+
# @return [Boolean]
|
1454
|
+
#
|
1455
|
+
# @version SketchUp 6.0
|
1456
|
+
def valid?
|
1457
|
+
end
|
1458
|
+
|
1459
|
+
end
|