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
|
# The Color class is used to create and manipulate colors within SketchUp
|
@@ -78,10 +78,10 @@ class Sketchup::Color
|
|
78
78
|
# color = Sketchup::Color.new "AliceBlue"
|
79
79
|
# alpha = color.alpha = 255
|
80
80
|
#
|
81
|
-
# @param [Integer] alpha
|
81
|
+
# @param [Integer, Float] alpha
|
82
82
|
# The new opacity value.
|
83
83
|
#
|
84
|
-
# @return [Integer]
|
84
|
+
# @return [Integer, Float]
|
85
85
|
#
|
86
86
|
# @version SketchUp 8.0 M1
|
87
87
|
def alpha=(alpha)
|
@@ -133,10 +133,10 @@ class Sketchup::Color
|
|
133
133
|
# color = Sketchup::Color.new "AliceBlue"
|
134
134
|
# blue = color.blue = 200
|
135
135
|
#
|
136
|
-
# @param [Integer] blue
|
136
|
+
# @param [Integer, Float] blue
|
137
137
|
# The blue value for the color.
|
138
138
|
#
|
139
|
-
# @return [Integer]
|
139
|
+
# @return [Integer, Float]
|
140
140
|
#
|
141
141
|
# @version SketchUp 6.0
|
142
142
|
def blue=(blue)
|
@@ -164,10 +164,10 @@ class Sketchup::Color
|
|
164
164
|
# color = Sketchup::Color.new "AliceBlue"
|
165
165
|
# green = color.green = 200
|
166
166
|
#
|
167
|
-
# @param [Integer] green
|
167
|
+
# @param [Integer, Float] green
|
168
168
|
# The green value for the color.
|
169
169
|
#
|
170
|
-
# @return [Integer]
|
170
|
+
# @return [Integer, Float]
|
171
171
|
#
|
172
172
|
# @version SketchUp 6.0
|
173
173
|
def green=(green)
|
@@ -188,8 +188,6 @@ class Sketchup::Color
|
|
188
188
|
# face.material = color_from_rgba
|
189
189
|
# face.material.alpha = 0.5
|
190
190
|
#
|
191
|
-
# @note When assigning colors via a hexadecimal, R and B will be flipped.
|
192
|
-
#
|
193
191
|
# @overload initialize(red, green, blue, alpha = 255)
|
194
192
|
#
|
195
193
|
# @param [Integer] red A red value between 0 and 255.
|
@@ -198,6 +196,14 @@ class Sketchup::Color
|
|
198
196
|
# @param [Integer] alpha A alpha value between 0 and 255.
|
199
197
|
# @return [Sketchup::Color]
|
200
198
|
#
|
199
|
+
# @overload initialize(red, green, blue, alpha = 1.0)
|
200
|
+
#
|
201
|
+
# @param [Float] red A red value between 0.0 and 1.0.
|
202
|
+
# @param [Float] green A green value between 0.0 and 1.0.
|
203
|
+
# @param [Float] blue A blue value between 0.0 and 1.0.
|
204
|
+
# @param [Float] alpha A alpha value between 0.0 and 1.0.
|
205
|
+
# @return [Sketchup::Color]
|
206
|
+
#
|
201
207
|
# @overload initialize(name)
|
202
208
|
#
|
203
209
|
# @param [String] name A string name of a color that currently exists in
|
@@ -205,6 +211,13 @@ class Sketchup::Color
|
|
205
211
|
# info.
|
206
212
|
# @return [Sketchup::Color]
|
207
213
|
#
|
214
|
+
# @overload initialize(hex)
|
215
|
+
#
|
216
|
+
# @param [Integer] hex A hexadecimal color code.
|
217
|
+
# @return [Sketchup::Color]
|
218
|
+
# @note When assigning colors via a hexadecimal, R and B will be flipped.
|
219
|
+
# @note When assigning colors via a hexadecimal, Alpha is not supported.
|
220
|
+
#
|
208
221
|
# @version SketchUp 6.0
|
209
222
|
def initialize(*args)
|
210
223
|
end
|
@@ -231,10 +244,10 @@ class Sketchup::Color
|
|
231
244
|
# color = Sketchup::Color.new "AliceBlue"
|
232
245
|
# red = color.red=200
|
233
246
|
#
|
234
|
-
# @param [Integer] red
|
247
|
+
# @param [Integer, Float] red
|
235
248
|
# The red value for the color.
|
236
249
|
#
|
237
|
-
# @return [Integer]
|
250
|
+
# @return [Integer, Float]
|
238
251
|
#
|
239
252
|
# @version SketchUp 6.0
|
240
253
|
def red=(red)
|
@@ -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 {Sketchup::ComponentDefinition} class is used to define the contents for
|
@@ -20,7 +20,7 @@
|
|
20
20
|
# will be raised. The key/value pairs in the dictionary can be deleted safely.
|
21
21
|
#
|
22
22
|
# @version SketchUp 6.0
|
23
|
-
class Sketchup::ComponentDefinition <
|
23
|
+
class Sketchup::ComponentDefinition < DrawingElement
|
24
24
|
|
25
25
|
# Includes
|
26
26
|
|
@@ -389,6 +389,25 @@ class Sketchup::ComponentDefinition < Sketchup::Drawingelement
|
|
389
389
|
def invalidate_bounds
|
390
390
|
end
|
391
391
|
|
392
|
+
# The {#live_component?} method is used to identify Live Components and
|
393
|
+
# sub-definitions of Live Components.
|
394
|
+
#
|
395
|
+
# @example Skipping Live Components
|
396
|
+
# model = Sketchup.active_model
|
397
|
+
# model.definitions.each { |definition|
|
398
|
+
# next if definition.live_component?
|
399
|
+
# puts definition.name
|
400
|
+
# }
|
401
|
+
#
|
402
|
+
# @note These components are parametrically generated and API users should not
|
403
|
+
# modify them.
|
404
|
+
#
|
405
|
+
# @return [Boolean]
|
406
|
+
#
|
407
|
+
# @version SketchUp 2021.0
|
408
|
+
def live_component?
|
409
|
+
end
|
410
|
+
|
392
411
|
# The name method retrieves the name of the component definition.
|
393
412
|
#
|
394
413
|
# @example
|
@@ -426,18 +445,14 @@ class Sketchup::ComponentDefinition < Sketchup::Drawingelement
|
|
426
445
|
|
427
446
|
# The path method is used to retrieve the path where the component was loaded.
|
428
447
|
#
|
429
|
-
# Returns nil if it is an internal component.
|
430
|
-
#
|
431
448
|
# @example
|
432
|
-
# path = Sketchup.find_support_file
|
433
|
-
# "Components/Components Sampler/"
|
449
|
+
# path = Sketchup.find_support_file("Bed.skp", "Components/Components Sampler/")
|
434
450
|
# model = Sketchup.active_model
|
435
451
|
# definitions = model.definitions
|
436
|
-
# componentdefinition = definitions.load
|
452
|
+
# componentdefinition = definitions.load(path)
|
437
453
|
# path = componentdefinition.path
|
438
454
|
#
|
439
|
-
# @return [String
|
440
|
-
# unsuccessful
|
455
|
+
# @return [String] Returns empty string if it is an internal component.
|
441
456
|
#
|
442
457
|
# @version SketchUp 6.0
|
443
458
|
def path
|
@@ -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 {Sketchup::ComponentInstance} class is used to represent component
|
@@ -123,73 +123,63 @@ class Sketchup::ComponentInstance < Sketchup::Drawingelement
|
|
123
123
|
def explode
|
124
124
|
end
|
125
125
|
|
126
|
-
# The glued_to method is used to retrieve the entity that this instance is
|
126
|
+
# The {#glued_to} method is used to retrieve the entity that this instance is
|
127
127
|
# glued to.
|
128
128
|
#
|
129
|
-
# Returns nil if it is not glued to anything.
|
130
|
-
#
|
131
129
|
# @example
|
132
|
-
# point = Geom::Point3d.new
|
133
|
-
# transform = Geom::Transformation.new
|
130
|
+
# point = Geom::Point3d.new(10, 20, 30)
|
131
|
+
# transform = Geom::Transformation.new(point)
|
134
132
|
# model = Sketchup.active_model
|
135
133
|
# entities = model.active_entities
|
136
|
-
# path = Sketchup.find_support_file
|
137
|
-
# "Components/Components Sampler/"
|
134
|
+
# path = Sketchup.find_support_file("Bed.skp", "Components/Components Sampler/")
|
138
135
|
# definitions = model.definitions
|
139
|
-
# componentdefinition = definitions.load
|
140
|
-
# instance = entities.add_instance
|
136
|
+
# componentdefinition = definitions.load(path)
|
137
|
+
# instance = entities.add_instance(componentdefinition, transform)
|
141
138
|
# status = instance.glued_to
|
142
139
|
#
|
143
|
-
# @return [Sketchup::Face,
|
144
|
-
# to (if successful)
|
140
|
+
# @return [Sketchup::Face, Sketchup::Group, Sketchup::ComponentInstance, Sketchup::Image, nil]
|
145
141
|
#
|
146
142
|
# @version SketchUp 6.0
|
147
143
|
def glued_to
|
148
144
|
end
|
149
145
|
|
150
|
-
# The glued_to= method glues this instance to a
|
146
|
+
# The {glued_to=} method glues this instance to a drawing element.
|
147
|
+
# When moving this other drawing elment with the Move tool, the glued instance moves with it.
|
151
148
|
#
|
152
|
-
#
|
153
|
-
#
|
154
|
-
# doesn't support gluing or if the alignment is wrong.
|
149
|
+
# In SketchUp 2021.1 support for passing {Sketchup::Group}, {Sketchup::ComponentInstance} and
|
150
|
+
# {Sketchup::Image} was added.
|
155
151
|
#
|
156
152
|
# @example
|
157
|
-
# depth = 100
|
158
|
-
# width = 100
|
159
|
-
# path=Sketchup.find_support_file "Bed.skp",
|
160
|
-
# "Components/Components Sampler/"
|
161
153
|
# model = Sketchup.active_model
|
162
154
|
# entities = model.active_entities
|
163
|
-
#
|
164
|
-
#
|
165
|
-
#
|
166
|
-
#
|
167
|
-
#
|
168
|
-
#
|
169
|
-
#
|
170
|
-
#
|
171
|
-
# transform = Geom::Transformation.new point
|
155
|
+
#
|
156
|
+
# # Create a face
|
157
|
+
# face = entities.add_face([[0, 0, 0], [100, 0, 0], [100, 100, 0], [0, 100, 0]])
|
158
|
+
#
|
159
|
+
# # Add component
|
160
|
+
# path = Sketchup.find_support_file("Bed.skp", "Components/Components Sampler/")
|
161
|
+
# point = Geom::Point3d.new(10, 10, 0)
|
162
|
+
# transformation = Geom::Transformation.new(point)
|
172
163
|
# definitions = model.definitions
|
173
|
-
#
|
174
|
-
# instance = entities.add_instance
|
175
|
-
# begin
|
176
|
-
# status = instance.glued_to = face
|
177
|
-
# rescue
|
178
|
-
# UI.messagebox $!.message
|
179
|
-
# end
|
180
|
-
# if (status)
|
181
|
-
# UI.messagebox status.to_s
|
182
|
-
# else
|
183
|
-
# UI.messagebox "Failure"
|
184
|
-
# end
|
164
|
+
# definition = definitions.load(path)
|
165
|
+
# instance = entities.add_instance(definition, transformation)
|
185
166
|
#
|
186
|
-
#
|
167
|
+
# # Make component "gluable"
|
168
|
+
# definition.behavior.is2d = true
|
187
169
|
#
|
188
|
-
#
|
189
|
-
#
|
170
|
+
# # Glue the component to the face.
|
171
|
+
# # If you now move the face, the component will follow.
|
172
|
+
# instance.glued_to = face
|
173
|
+
#
|
174
|
+
# @param [Sketchup::Face, Sketchup::Group, Sketchup::ComponentInstance, Sketchup::Image, nil] drawing_element
|
175
|
+
#
|
176
|
+
# @raise ArgumentError if the {Sketchup::Behavior} for this component doesn't allow gluing,
|
177
|
+
# if the alignment is wrong, or if this would lead to cyclic gluing.
|
178
|
+
#
|
179
|
+
# @return [Sketchup::Face, Sketchup::Group, Sketchup::ComponentInstance, Sketchup::Image, nil] the entity the instance was glued to.
|
190
180
|
#
|
191
181
|
# @version SketchUp 6.0
|
192
|
-
def glued_to=(
|
182
|
+
def glued_to=(drawing_element)
|
193
183
|
end
|
194
184
|
|
195
185
|
# The guid method is used to get the base 64 encoded unique id
|
@@ -218,6 +208,8 @@ class Sketchup::ComponentInstance < Sketchup::Drawingelement
|
|
218
208
|
# instance2 = entities[1]
|
219
209
|
# result = instance1.intersect(instance2)
|
220
210
|
#
|
211
|
+
# @note This method is not available in SketchUp Make.
|
212
|
+
#
|
221
213
|
# @param [Sketchup::ComponentInstance] instance
|
222
214
|
# The instance to intersect this instance with.
|
223
215
|
#
|
@@ -263,7 +255,8 @@ class Sketchup::ComponentInstance < Sketchup::Drawingelement
|
|
263
255
|
end
|
264
256
|
|
265
257
|
# The {#make_unique} method is used to create a component definition for this
|
266
|
-
# instance that is not used by any other instances.
|
258
|
+
# instance that is not used by any other instances. If the component is already
|
259
|
+
# unique in the model, nothing happens.
|
267
260
|
#
|
268
261
|
# @example
|
269
262
|
# point = Geom::Point3d.new(10,20,30)
|
@@ -300,8 +293,9 @@ class Sketchup::ComponentInstance < Sketchup::Drawingelement
|
|
300
293
|
def manifold?
|
301
294
|
end
|
302
295
|
|
303
|
-
# The move! method is
|
304
|
-
#
|
296
|
+
# The {#move!} method is used to set the transformation of this component
|
297
|
+
# instance, similarly to {#transformation=} but without recording to the undo
|
298
|
+
# stack.
|
305
299
|
#
|
306
300
|
# This method is useful for moving entities inside of an animation or page
|
307
301
|
# transition.
|
@@ -312,15 +306,17 @@ class Sketchup::ComponentInstance < Sketchup::Drawingelement
|
|
312
306
|
# transformation = Geom::Transformation.new([0,0,0])
|
313
307
|
# componentinstance = entities.add_instance(definition, transformation)
|
314
308
|
# new_transformation = Geom::Transformation.new([100,0,0])
|
315
|
-
# componentinstance.move!
|
309
|
+
# componentinstance.move!(new_transformation)
|
316
310
|
#
|
317
|
-
# @
|
318
|
-
#
|
311
|
+
# @note Despite the name being similar to {#transform!}, this method closer
|
312
|
+
# corresponds to {#transformation=}.
|
313
|
+
#
|
314
|
+
# @param [Geom::Transformation] transformation
|
319
315
|
#
|
320
316
|
# @return [Boolean] true if successful, false if unsuccessful
|
321
317
|
#
|
322
318
|
# @version SketchUp 6.0
|
323
|
-
def move!(
|
319
|
+
def move!(transformation)
|
324
320
|
end
|
325
321
|
|
326
322
|
# The name method is used to get the name of this instance.
|
@@ -438,6 +434,8 @@ class Sketchup::ComponentInstance < Sketchup::Drawingelement
|
|
438
434
|
# instance2 = entities[1]
|
439
435
|
# result = instance1.split(instance2)
|
440
436
|
#
|
437
|
+
# @note This method is not available in SketchUp Make.
|
438
|
+
#
|
441
439
|
# @param [Sketchup::ComponentInstance, nil] instance
|
442
440
|
# The instance to split this instance with.
|
443
441
|
#
|
@@ -463,6 +461,8 @@ class Sketchup::ComponentInstance < Sketchup::Drawingelement
|
|
463
461
|
# instance2 = entities[1]
|
464
462
|
# result = instance1.subtract(instance2)
|
465
463
|
#
|
464
|
+
# @note This method is not available in SketchUp Make.
|
465
|
+
#
|
466
466
|
# @param [Sketchup::ComponentInstance] instance
|
467
467
|
# The instance to subtract this instance from.
|
468
468
|
#
|
@@ -509,8 +509,8 @@ class Sketchup::ComponentInstance < Sketchup::Drawingelement
|
|
509
509
|
def transformation
|
510
510
|
end
|
511
511
|
|
512
|
-
# The transformation= method is used to set the transformation
|
513
|
-
# instance.
|
512
|
+
# The {#transformation=} method is used to set the transformation of this
|
513
|
+
# component instance.
|
514
514
|
#
|
515
515
|
# @example
|
516
516
|
# entities = Sketchup.active_model.entities
|
@@ -521,9 +521,6 @@ class Sketchup::ComponentInstance < Sketchup::Drawingelement
|
|
521
521
|
# componentinstance.transformation = new_transformation
|
522
522
|
#
|
523
523
|
# @param [Geom::Transformation] transformation
|
524
|
-
# A Transformation object to apply.
|
525
|
-
#
|
526
|
-
# @return [Sketchup::ComponentInstance] the transformed ComponentInstance
|
527
524
|
#
|
528
525
|
# @version SketchUp 6.0
|
529
526
|
def transformation=(transformation)
|
@@ -540,6 +537,8 @@ class Sketchup::ComponentInstance < Sketchup::Drawingelement
|
|
540
537
|
# instance2 = entities[1]
|
541
538
|
# result = instance1.trim(instance2)
|
542
539
|
#
|
540
|
+
# @note This method is not available in SketchUp Make.
|
541
|
+
#
|
543
542
|
# @param [Sketchup::ComponentInstance] instance
|
544
543
|
# The instance to trim this instance against.
|
545
544
|
#
|
@@ -561,6 +560,8 @@ class Sketchup::ComponentInstance < Sketchup::Drawingelement
|
|
561
560
|
# instance2 = entities[1]
|
562
561
|
# result = instance1.union(instance2)
|
563
562
|
#
|
563
|
+
# @note This method is not available in SketchUp Make.
|
564
|
+
#
|
564
565
|
# @param [Sketchup::ComponentInstance] instance
|
565
566
|
# The instance to union this instance with.
|
566
567
|
#
|
@@ -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 Curve class is used by SketchUp to unite a series of Edge objects into
|
@@ -50,7 +50,7 @@ class Sketchup::Curve < Sketchup::Entity
|
|
50
50
|
# edgearray = entities.add_circle centerpoint, vector2, 10
|
51
51
|
# edge = edgearray[0]
|
52
52
|
# curve = edge.curve
|
53
|
-
# curve.each_edge {|
|
53
|
+
# curve.each_edge {|edge| puts "Edge {edge.entityID}: {edge.length}" }
|
54
54
|
#
|
55
55
|
# @return edge - a variable that will hold each Edge object as
|
56
56
|
# they are found.
|
@@ -150,22 +150,29 @@ class Sketchup::Curve < Sketchup::Entity
|
|
150
150
|
# curve = edge.curve
|
151
151
|
# length = curve.length
|
152
152
|
#
|
153
|
-
# @return
|
154
|
-
# successful
|
153
|
+
# @return [Length]
|
155
154
|
#
|
156
155
|
# @version SketchUp 6.0
|
157
156
|
def length
|
158
157
|
end
|
159
158
|
|
160
|
-
# The
|
159
|
+
# The {#move_vertices} method moves the vertices in the curve to points.
|
161
160
|
#
|
162
161
|
# @example
|
163
|
-
#
|
162
|
+
# model = Sketchup.active_model
|
163
|
+
# entities = model.entities
|
164
|
+
# new_edges = entities.add_arc(ORIGIN, X_AXIS, Z_AXIS, 20.cm, 0, 270.degrees, 32)
|
165
|
+
# curve = new_edges.first.curve
|
166
|
+
# points = curve.vertices.map(&:position)
|
167
|
+
# points.each_with_index { |pt, i| pt.z = i * 1.cm }
|
168
|
+
# curve.move_vertices(points)
|
169
|
+
#
|
170
|
+
# @param [Array<Geom::Point3d>] point_array
|
164
171
|
#
|
165
|
-
# @
|
166
|
-
#
|
172
|
+
# @raise ArgumentError if the number of points doesn't match number of vertices
|
173
|
+
# in curve
|
167
174
|
#
|
168
|
-
# @return
|
175
|
+
# @return [Boolean]
|
169
176
|
#
|
170
177
|
# @version SketchUp 6.0
|
171
178
|
def move_vertices(point_array)
|