sketchup-api-stubs 0.7.2 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/sketchup-api-stubs/sketchup.rb +3 -1
- data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +15 -11
- data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +5 -5
- data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +5 -5
- data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +5 -6
- data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +18 -18
- data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +27 -10
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +2 -3
- data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +4 -4
- data/lib/sketchup-api-stubs/stubs/Layout.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +5 -1
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +7 -14
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +61 -5
- data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +7 -14
- data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +189 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +9 -4
- data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +2 -3
- data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +7 -14
- data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +6 -2
- data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +7 -14
- data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +148 -5
- data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +5 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +4 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +3 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +6 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +32 -58
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +110 -209
- data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +24 -11
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +24 -9
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +58 -57
- data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +16 -9
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +135 -39
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +6 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +6 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +3 -9
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +5 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +10 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +8 -14
- data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +55 -26
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +6 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +20 -15
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +6 -5
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +9 -8
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +232 -65
- data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +98 -45
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +48 -41
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +7 -7
- data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +60 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +47 -7
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +11 -12
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +33 -21
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +6 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +5 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +115 -68
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +422 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +225 -29
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +118 -5
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +2 -13
- data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +8 -10
- data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +16 -9
- data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +6 -5
- data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +9 -11
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +126 -73
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +5 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +2 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +7 -7
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +4 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +143 -40
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +22 -12
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +6 -5
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +37 -15
- data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +5 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +10 -5
- data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +20 -20
- data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +5 -5
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +6 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +9 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +14 -22
- data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +31 -25
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +6 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +32 -22
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +73 -67
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +6 -4
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +13 -6
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +132 -10
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +94 -54
- data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +3 -3
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +3 -1
- data/lib/sketchup-api-stubs/stubs/array.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/geom.rb +4 -1
- data/lib/sketchup-api-stubs/stubs/languagehandler.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/length.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/numeric.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/sketchup.rb +66 -23
- data/lib/sketchup-api-stubs/stubs/sketchupextension.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/string.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/ui.rb +17 -12
- metadata +5 -3
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright:: Copyright
|
1
|
+
# Copyright:: Copyright 2021 Trimble Inc.
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
4
|
# A DefinitionList object holds a list of all of the ComponentDefinition
|
@@ -6,7 +6,7 @@
|
|
6
6
|
# definitions from the list.
|
7
7
|
#
|
8
8
|
# @version SketchUp 6.0
|
9
|
-
class Sketchup::DefinitionList <
|
9
|
+
class Sketchup::DefinitionList < Entity
|
10
10
|
|
11
11
|
# Includes
|
12
12
|
|
@@ -131,10 +131,8 @@ class Sketchup::DefinitionList < Sketchup::Entity
|
|
131
131
|
def count
|
132
132
|
end
|
133
133
|
|
134
|
-
# The each method is used to iterate through all of the component
|
135
|
-
# in the definition list.
|
136
|
-
#
|
137
|
-
# Throws an exception if there are no component definitions.
|
134
|
+
# The {#each} method is used to iterate through all of the component
|
135
|
+
# definitions in the definition list.
|
138
136
|
#
|
139
137
|
# @example
|
140
138
|
# model = Sketchup.active_model
|
@@ -142,6 +140,11 @@ class Sketchup::DefinitionList < Sketchup::Entity
|
|
142
140
|
# definitions.add("BedTraditional")
|
143
141
|
# number = definitions.each { |definition| puts definition.name }
|
144
142
|
#
|
143
|
+
# @note Don't remove content from this collection while iterating over it with
|
144
|
+
# {#each}. This would change the size of the collection and cause elements to
|
145
|
+
# be skipped as the indices change. Instead copy the current collection to an
|
146
|
+
# array using +to_a+ and then use +each+ on the array, when removing content.
|
147
|
+
#
|
145
148
|
# @return [nil]
|
146
149
|
#
|
147
150
|
# @version SketchUp 6.0
|
@@ -150,6 +153,33 @@ class Sketchup::DefinitionList < Sketchup::Entity
|
|
150
153
|
def each
|
151
154
|
end
|
152
155
|
|
156
|
+
# The {#import} method is used to import a (non-SketchUp) 3d model file as a definition.
|
157
|
+
#
|
158
|
+
# Importers using the C API +SketchUpModelImporterInterface+ interface are supported (those in the +Importers/+ directory).
|
159
|
+
#
|
160
|
+
# See the {file:pages/importer_options.md Importer Options} file for information
|
161
|
+
# on creating a valid hash for the various importers.
|
162
|
+
#
|
163
|
+
# For SketchUp models, instead use {#load}.
|
164
|
+
#
|
165
|
+
# @example
|
166
|
+
# path = "C:/circle.dwg"
|
167
|
+
# definition = Sketchup.active_model.definitions.import(path)
|
168
|
+
#
|
169
|
+
# @param [String] path
|
170
|
+
#
|
171
|
+
# @param [Hash] options
|
172
|
+
#
|
173
|
+
# @raise [IOError] if the file is missing.
|
174
|
+
#
|
175
|
+
# @raise [ArgumentError] if no suitable importer could be found.
|
176
|
+
#
|
177
|
+
# @return [Sketchup::ComponentDefinition]
|
178
|
+
#
|
179
|
+
# @version SketchUp 2021.1
|
180
|
+
def import(path, options = {})
|
181
|
+
end
|
182
|
+
|
153
183
|
# The {#length} method is used to retrieve number of component definitions in
|
154
184
|
# the list.
|
155
185
|
#
|
@@ -166,46 +196,79 @@ class Sketchup::DefinitionList < Sketchup::Entity
|
|
166
196
|
def length
|
167
197
|
end
|
168
198
|
|
169
|
-
# The load method is used to load a component from a file.
|
199
|
+
# The {#load} method is used to load a component from a file.
|
200
|
+
#
|
201
|
+
# @bug In SketchUp versions prior to SketchUp 2019 the application would crash
|
202
|
+
# if you tried to open a newer model instead of raising the expected
|
203
|
+
# +RuntimeError+.
|
170
204
|
#
|
171
205
|
# @example
|
172
|
-
# path=Sketchup.find_support_file
|
173
|
-
# "Components/Components Sampler/"
|
206
|
+
# path = Sketchup.find_support_file("Bed.skp",
|
207
|
+
# "Components/Components Sampler/")
|
174
208
|
# model = Sketchup.active_model
|
175
209
|
# definitions = model.definitions
|
176
|
-
#
|
210
|
+
# definition = definitions.load(path)
|
177
211
|
#
|
178
|
-
# @
|
179
|
-
#
|
212
|
+
# @overload load(path)
|
213
|
+
#
|
214
|
+
# @param [String] path
|
215
|
+
# The path where the component definition file is located.
|
216
|
+
#
|
217
|
+
# @overload load(path, allow_newer: true)
|
180
218
|
#
|
181
|
-
#
|
182
|
-
#
|
219
|
+
# Starting with SketchUp 2021.0 SketchUp attempts to load newer SketchUp
|
220
|
+
# models. If a newer model is loaded some information might have been skipped
|
221
|
+
# and extensions should be careful to not save over the file they loaded from
|
222
|
+
# as information might be lost.
|
223
|
+
#
|
224
|
+
# @version SketchUp 2021.0
|
225
|
+
# @param [String] path
|
226
|
+
# The path where the component definition file is located.
|
227
|
+
# @param [Boolean] allow_newer
|
228
|
+
# Indicate that it is ok to load a model with of a newer version.
|
229
|
+
#
|
230
|
+
# @raise IOError If the file is not a valid SketchUp model.
|
231
|
+
#
|
232
|
+
# @raise RuntimeError If the file is the same as the model being loaded into.
|
233
|
+
#
|
234
|
+
# @raise IOError If the file is an empty component.
|
235
|
+
#
|
236
|
+
# @raise RuntimeError If the file contains only screen text.
|
237
|
+
#
|
238
|
+
# @raise RuntimeError If the file is of a newer file version that the executing
|
239
|
+
# SketchUp version cannot open.
|
183
240
|
#
|
184
241
|
# @return [Sketchup::ComponentDefinition] the loaded ComponentDefinition
|
185
|
-
# object if successful
|
186
242
|
#
|
187
243
|
# @version SketchUp 6.0
|
188
|
-
def load(
|
244
|
+
def load(*args)
|
189
245
|
end
|
190
246
|
|
191
|
-
# The load_from_url method loads a component from a location specified by
|
192
|
-
# string url.
|
193
|
-
# given, or an error occurs during retrieval from url and a
|
194
|
-
# load_handler was not given. Optional second parameter load_handler can be
|
195
|
-
# used to pass in a ruby object that responds to the following methods:
|
247
|
+
# The {#load_from_url} method loads a component from a location specified by
|
248
|
+
# string url.
|
196
249
|
#
|
197
|
-
#
|
198
|
-
#
|
199
|
-
#
|
200
|
-
#
|
250
|
+
# This method throws an exception if an url string is not
|
251
|
+
# given, or an error occurs during retrieval from URL and a
|
252
|
+
# +load_handler+ was not given. Optional second parameter +load_handler+ can be
|
253
|
+
# used to pass in a Ruby object that responds to the following methods:
|
201
254
|
#
|
202
|
-
#
|
203
|
-
#
|
255
|
+
# - +cancelled?+
|
256
|
+
# - +onPercentChange(percent)+
|
257
|
+
# - +onSuccess()+
|
258
|
+
# - +onFailure(message_string)+
|
259
|
+
#
|
260
|
+
# @bug Calling this method from an {UI::HtmlDialog}'s action callback on macOS will cause the
|
261
|
+
# SketchUp application to become unresponsive. To work around this, defer the call from the
|
262
|
+
# action callback with a non-repeating zero-delay timer;
|
263
|
+
# +UI.start_timer(0, false) { method_calling_load_from_url }+
|
204
264
|
#
|
205
|
-
#
|
265
|
+
# @example Download a component using a LoadHandler
|
266
|
+
# class LoadHandler
|
267
|
+
# attr_accessor :error
|
206
268
|
#
|
269
|
+
# # @param [Float] percent
|
207
270
|
# def onPercentChange(percent)
|
208
|
-
# Sketchup::set_status_text("
|
271
|
+
# Sketchup::set_status_text("loading: #{percent.round}%")
|
209
272
|
# end
|
210
273
|
#
|
211
274
|
# def cancelled?
|
@@ -219,34 +282,67 @@ class Sketchup::DefinitionList < Sketchup::Entity
|
|
219
282
|
# Sketchup::set_status_text('')
|
220
283
|
# end
|
221
284
|
#
|
285
|
+
# # @param [String] error_message
|
222
286
|
# def onFailure(error_message)
|
223
287
|
# self.error = error_message
|
224
288
|
# Sketchup::set_status_text('')
|
225
289
|
# end
|
226
|
-
#
|
227
290
|
# end
|
228
291
|
#
|
229
292
|
# # Replace this with a real URL...
|
230
|
-
# url = '
|
293
|
+
# url = 'https://www.sketchup.com/model.skp'
|
231
294
|
# model = Sketchup.active_model
|
295
|
+
# load_handler = LoadHandler.new
|
232
296
|
# definition = model.definitions.load_from_url(url, load_handler)
|
233
297
|
#
|
234
298
|
# if definition.nil?
|
235
299
|
# puts "Error: #{load_handler.error}"
|
236
300
|
# end
|
237
301
|
#
|
238
|
-
# @
|
239
|
-
#
|
302
|
+
# @example Workaround for macOS bug related to HtmlDialog action callbacks
|
303
|
+
# module Example
|
240
304
|
#
|
241
|
-
#
|
242
|
-
#
|
243
|
-
#
|
305
|
+
# def self.open_dialog
|
306
|
+
# @dialog = UI::HtmlDialog.new
|
307
|
+
# @dialog.add_action_callback("say") { |action_context, url|
|
308
|
+
# self.load_component_deferred(url)
|
309
|
+
# }
|
310
|
+
# @dialog.set_file("path/to/file.html")
|
311
|
+
# @dialog.show
|
312
|
+
# end
|
244
313
|
#
|
245
|
-
#
|
246
|
-
#
|
314
|
+
# def load_component_deferred
|
315
|
+
# # The timer delay is enough to avoid .load_from_url from deadlocking.
|
316
|
+
# UI.start_timer(0, false) do
|
317
|
+
# self.load_component(url)
|
318
|
+
# end
|
319
|
+
# end
|
320
|
+
#
|
321
|
+
# def self.load_component(url)
|
322
|
+
# model = Sketchup.active_model
|
323
|
+
# definition = model.definitions.load_from_url(url)
|
324
|
+
# # ...
|
325
|
+
# end
|
326
|
+
#
|
327
|
+
# end
|
328
|
+
#
|
329
|
+
# @overload load_from_url(url)
|
330
|
+
#
|
331
|
+
# @param [String] url
|
332
|
+
# URL to load a .skp file from.
|
333
|
+
#
|
334
|
+
# @overload load_from_url(url, load_handler)
|
335
|
+
#
|
336
|
+
# @param [String] url
|
337
|
+
# URL to load a .skp file from.
|
338
|
+
# @param [Object] load_handler
|
339
|
+
# Ruby object that has methods defined
|
340
|
+
# as described in the +load_from_url+ details above.
|
341
|
+
#
|
342
|
+
# @return [Sketchup::ComponentDefinition]
|
247
343
|
#
|
248
344
|
# @version SketchUp 7.0
|
249
|
-
def load_from_url(
|
345
|
+
def load_from_url(*args)
|
250
346
|
end
|
251
347
|
|
252
348
|
# The purge_unused method is used to remove the unused component definitions.
|
@@ -1,10 +1,12 @@
|
|
1
|
-
# Copyright:: Copyright
|
1
|
+
# Copyright:: Copyright 2021 Trimble Inc.
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
4
|
# This observer interface is implemented to react to component definition
|
5
|
-
# events.
|
6
|
-
#
|
7
|
-
#
|
5
|
+
# events.
|
6
|
+
#
|
7
|
+
# @abstract To implement this observer, create a Ruby class of this type,
|
8
|
+
# override the desired methods, and add an instance of the observer to the
|
9
|
+
# definitions of interests.
|
8
10
|
#
|
9
11
|
# @example
|
10
12
|
# # This is an example of an observer that watches a specific definition
|
@@ -1,10 +1,12 @@
|
|
1
|
-
# Copyright:: Copyright
|
1
|
+
# Copyright:: Copyright 2021 Trimble Inc.
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
4
|
# This observer interface is implemented to react to events on a definitions
|
5
|
-
# collection.
|
6
|
-
#
|
7
|
-
#
|
5
|
+
# collection.
|
6
|
+
#
|
7
|
+
# @abstract To implement this observer, create a Ruby class of this type,
|
8
|
+
# override the desired methods, and add an instance of the observer to the
|
9
|
+
# collection of interest.
|
8
10
|
#
|
9
11
|
# @example
|
10
12
|
# class MyDefinitionsObserver < Sketchup::DefinitionsObserver
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright:: Copyright
|
1
|
+
# Copyright:: Copyright 2021 Trimble Inc.
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
4
|
# The DimensionLinear class represents linear dimensions.
|
@@ -168,17 +168,11 @@ class Sketchup::DimensionLinear < Sketchup::Dimension
|
|
168
168
|
#
|
169
169
|
# @example
|
170
170
|
# dim.offset_vector = Geom::Vector3d.new(0, 0, 10)
|
171
|
-
# # or
|
172
|
-
# dim.offset_vector = [0, 0, 10]
|
173
171
|
#
|
174
|
-
# @param
|
175
|
-
# the offset vector to be set, either a Vector3d or in
|
176
|
-
# array form.
|
177
|
-
#
|
178
|
-
# @return the offset vector that was set
|
172
|
+
# @param [Geom::Vector3d] offset_vector
|
179
173
|
#
|
180
174
|
# @version SketchUp 2014
|
181
|
-
def offset_vector=(
|
175
|
+
def offset_vector=(offset_vector)
|
182
176
|
end
|
183
177
|
|
184
178
|
# The start method returns the point or entity the dimension is referencing at
|
@@ -1,8 +1,12 @@
|
|
1
|
-
# Copyright:: Copyright
|
1
|
+
# Copyright:: Copyright 2021 Trimble Inc.
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
4
|
# This observer interface is implemented to react to changes in dimension text.
|
5
5
|
#
|
6
|
+
# @abstract To implement this observer, create a Ruby class of this type,
|
7
|
+
# override the desired methods, and add an instance of the observer to the
|
8
|
+
# dimensions of interest.
|
9
|
+
#
|
6
10
|
# @example
|
7
11
|
# # This is an example of a DimensionObserver
|
8
12
|
# class MyDimensionObserver < Sketchup::DimensionObserver
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright:: Copyright
|
1
|
+
# Copyright:: Copyright 2021 Trimble Inc.
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
4
|
# Drawingelement is a base class for an item in the model that can be
|
@@ -11,8 +11,14 @@ class Sketchup::Drawingelement < Sketchup::Entity
|
|
11
11
|
|
12
12
|
# Instance Methods
|
13
13
|
|
14
|
-
# The bounds method is used to retrieve the BoundingBox
|
15
|
-
#
|
14
|
+
# The {#bounds} method is used to retrieve the {Geom::BoundingBox} bounding a
|
15
|
+
# {Sketchup::Drawingelement}.
|
16
|
+
#
|
17
|
+
# For a {Sketchup::Edge}, {Sketchup::ComponentInstance} and most other
|
18
|
+
# {Sketchup::Drawingelement}s, the boundingbox follows the coordinate system
|
19
|
+
# the drawing element is placed in.
|
20
|
+
# For {Sketchup::ComponentDefinition}, the box bounds the contents of the
|
21
|
+
# component and follows the component's own internal coordinate system.
|
16
22
|
#
|
17
23
|
# @example
|
18
24
|
# depth = 100
|
@@ -31,7 +37,7 @@ class Sketchup::Drawingelement < Sketchup::Entity
|
|
31
37
|
# # is a sub-class of Drawingelement.
|
32
38
|
# boundingbox = face.bounds
|
33
39
|
#
|
34
|
-
# @return [Geom::BoundingBox]
|
40
|
+
# @return [Geom::BoundingBox]
|
35
41
|
#
|
36
42
|
# @version SketchUp 6.0
|
37
43
|
def bounds
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright:: Copyright
|
1
|
+
# Copyright:: Copyright 2021 Trimble Inc.
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
4
|
# The Edge class contains methods modifying and extracting information for
|
@@ -155,20 +155,13 @@ class Sketchup::Edge < Sketchup::Drawingelement
|
|
155
155
|
def explode_curve
|
156
156
|
end
|
157
157
|
|
158
|
-
# The faces method is used to retrieve all of the faces common to the edge.
|
158
|
+
# The {#faces} method is used to retrieve all of the faces common to the edge.
|
159
159
|
#
|
160
160
|
# @example
|
161
|
-
# edge = Sketchup.active_model.entities.add_line([0,0,0],[100,100,0])
|
161
|
+
# edge = Sketchup.active_model.entities.add_line([0, 0, 0], [100, 100, 0])
|
162
162
|
# faces = edge.faces
|
163
|
-
# if (faces)
|
164
|
-
# # Display the pointer to the first face returned in the array
|
165
|
-
# UI.messagebox faces[0]
|
166
|
-
# else
|
167
|
-
# UI.messagebox "Failure: No Faces Found"
|
168
|
-
# end
|
169
163
|
#
|
170
|
-
# @return [Array<Sketchup::Face>]
|
171
|
-
# if unsuccessful
|
164
|
+
# @return [Array<Sketchup::Face>]
|
172
165
|
#
|
173
166
|
# @version SketchUp 6.0
|
174
167
|
def faces
|
@@ -229,8 +222,9 @@ class Sketchup::Edge < Sketchup::Drawingelement
|
|
229
222
|
#
|
230
223
|
# @overload length(transform)
|
231
224
|
#
|
232
|
-
# @param
|
233
|
-
#
|
225
|
+
# @param [Geom::Transformation] transform
|
226
|
+
# A Transformation object or array that can be interpreted as a
|
227
|
+
# Transformation object.
|
234
228
|
# @return [Length] the length of the edge
|
235
229
|
#
|
236
230
|
# @version SketchUp 6.0
|
@@ -416,7 +410,7 @@ class Sketchup::Edge < Sketchup::Drawingelement
|
|
416
410
|
def soft?
|
417
411
|
end
|
418
412
|
|
419
|
-
# The split method is used to to split an edge into
|
413
|
+
# The split method is used to to split an edge into two or more distinct
|
420
414
|
# edges. If a Point3d is given, it must be a point that is on the Edge.
|
421
415
|
#
|
422
416
|
# If a Float is given, it is a number between 0 and 1 that gives the
|
@@ -1,8 +1,9 @@
|
|
1
|
-
# Copyright:: Copyright
|
1
|
+
# Copyright:: Copyright 2021 Trimble Inc.
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
|
-
# The Entities class is a
|
5
|
-
#
|
4
|
+
# The {Sketchup::Entities} class is a collection of Entity objects, either in a
|
5
|
+
# {Sketchup::ComponentDefinition} or directly in the {Sketchup::Model}. A
|
6
|
+
# {Sketchup::Entities} object corresponds to a drawing context in the GUI.
|
6
7
|
#
|
7
8
|
# @version SketchUp 6.0
|
8
9
|
class Sketchup::Entities
|
@@ -540,8 +541,8 @@ class Sketchup::Entities
|
|
540
541
|
# UI.messagebox "Failure"
|
541
542
|
# end
|
542
543
|
#
|
543
|
-
# @param [String]
|
544
|
-
# A
|
544
|
+
# @param [String] path
|
545
|
+
# A path for the image file.
|
545
546
|
#
|
546
547
|
# @param [Geom::Point3d] point
|
547
548
|
# A Point3d object representing the insertion point of
|
@@ -558,7 +559,7 @@ class Sketchup::Entities
|
|
558
559
|
# @return [Sketchup::Image, nil] an Image object if successful.
|
559
560
|
#
|
560
561
|
# @version SketchUp 6.0
|
561
|
-
def add_image(
|
562
|
+
def add_image(path, point, width, height = 0.0)
|
562
563
|
end
|
563
564
|
|
564
565
|
# The add_instance method adds a component instance to the collection of
|
@@ -806,8 +807,8 @@ class Sketchup::Entities
|
|
806
807
|
def count
|
807
808
|
end
|
808
809
|
|
809
|
-
# The each method is used to iterate through the entities in the collection
|
810
|
-
# entities.
|
810
|
+
# The {#each} method is used to iterate through the entities in the collection
|
811
|
+
# of entities.
|
811
812
|
#
|
812
813
|
# @example
|
813
814
|
# coordinates = [10, 10, 10]
|
@@ -815,7 +816,12 @@ class Sketchup::Entities
|
|
815
816
|
# entities = model.entities
|
816
817
|
# point = Geom::Point3d.new coordinates
|
817
818
|
# text = entities.add_text "This is a Test", point
|
818
|
-
# entities.each { | entity|
|
819
|
+
# entities.each { | entity| puts entity }
|
820
|
+
#
|
821
|
+
# @note Don't remove content from this collection while iterating over it with
|
822
|
+
# {#each}. This would change the size of the collection and cause elements to
|
823
|
+
# be skipped as the indices change. Instead copy the current collection to an
|
824
|
+
# array using +to_a+ and then use +each+ on the array, when removing content.
|
819
825
|
#
|
820
826
|
# @return [nil]
|
821
827
|
#
|
@@ -1045,8 +1051,15 @@ class Sketchup::Entities
|
|
1045
1051
|
# sub-entities all at once.
|
1046
1052
|
#
|
1047
1053
|
# @example
|
1048
|
-
# #
|
1049
|
-
#
|
1054
|
+
# # Raise vertices in selection by their distance to the origin.
|
1055
|
+
# model = Sketchup.active_model
|
1056
|
+
# entities = model.active_entities
|
1057
|
+
# with_vertices = entities.select { |entity| entity.respond_to?(:vertices) }
|
1058
|
+
# vertices = with_vertices.flat_map(&:vertices).uniq
|
1059
|
+
# lengths = vertices.map { |vertex| vertex.position.distance(ORIGIN) }
|
1060
|
+
# vectors = lengths.map { |length| Geom::Vector3d.new(0, 0, length) }
|
1061
|
+
#
|
1062
|
+
# entities.transform_by_vectors(vertices, vectors)
|
1050
1063
|
#
|
1051
1064
|
# @param [Array<Sketchup::Entity>] sub_entities
|
1052
1065
|
# An array of entities to transform.
|
@@ -1063,24 +1076,18 @@ class Sketchup::Entities
|
|
1063
1076
|
# The transform_entities method is used to apply a transform to several
|
1064
1077
|
# sub-entities all at once.
|
1065
1078
|
#
|
1066
|
-
#
|
1067
|
-
#
|
1068
|
-
#
|
1069
|
-
#
|
1070
|
-
# for this by watching the Model.edit_transform and Model.active_path. See
|
1071
|
-
# ModelObserver.onActivePathChanged for more information.
|
1079
|
+
# If you are transforming entities in the active drawing context or any of its
|
1080
|
+
# parent drawing contexts, the transformation will be interpreted as relative
|
1081
|
+
# to the global coordinate system. Otherwise the transformation will be
|
1082
|
+
# interpreted as being on the local coordinate system.
|
1072
1083
|
#
|
1073
1084
|
# @example
|
1074
1085
|
# entities = Sketchup.active_model.entities
|
1075
|
-
# entities.add_line([0,0,0],[100,100,100])
|
1076
|
-
# entities.add_line([0,0,0],[200,-10,-10])
|
1077
|
-
#
|
1078
|
-
# entities_to_transform = []
|
1079
|
-
# entities_to_transform.push(entities[0])
|
1080
|
-
# entities_to_transform.push(entities[1])
|
1086
|
+
# entity1 = entities.add_line([0,0,0],[100,100,100])
|
1087
|
+
# entity2 = entities.add_line([0,0,0],[200,-10,-10])
|
1081
1088
|
#
|
1082
|
-
#
|
1083
|
-
# entities.transform_entities(
|
1089
|
+
# transformation = Geom::Transformation.new([100,0,0])
|
1090
|
+
# entities.transform_entities(transformation, [entity1, entity2])
|
1084
1091
|
#
|
1085
1092
|
# @param [Geom::Transformation] transform
|
1086
1093
|
# The Transformation to apply.
|
@@ -1088,10 +1095,32 @@ class Sketchup::Entities
|
|
1088
1095
|
# @param [Array<Sketchup::Entity>] entities
|
1089
1096
|
# An array or series of entities to transform.
|
1090
1097
|
#
|
1091
|
-
# @return [Boolean]
|
1098
|
+
# @return [Boolean] +false+ if the entities array was empty.
|
1092
1099
|
#
|
1093
1100
|
# @version SketchUp 6.0
|
1094
1101
|
def transform_entities(transform, entities)
|
1095
1102
|
end
|
1096
1103
|
|
1104
|
+
# The {#weld} method takes a set of edges and find all possible chains of edges
|
1105
|
+
# and connect them with a {Sketchup::Curve}.
|
1106
|
+
#
|
1107
|
+
# A curve will not cross another curve. They will split where multiple curves
|
1108
|
+
# meet.
|
1109
|
+
#
|
1110
|
+
# @example
|
1111
|
+
# model = Sketchup.active_model
|
1112
|
+
# edges = model.selection.grep(Sketchup::Edge)
|
1113
|
+
# curves = model.active_entities.weld(edges)
|
1114
|
+
#
|
1115
|
+
# @param [Array<Sketchup::Edge>] edges
|
1116
|
+
#
|
1117
|
+
# @raise [ArgumentError] if the given entities are not part of the same
|
1118
|
+
# {Sketchup::Entities} collection.
|
1119
|
+
#
|
1120
|
+
# @return [Array<Sketchup::Curve>]
|
1121
|
+
#
|
1122
|
+
# @version SketchUp 2020.1
|
1123
|
+
def weld(edges)
|
1124
|
+
end
|
1125
|
+
|
1097
1126
|
end
|