sketchup-api-stubs 0.7.0 → 0.7.5
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 +2 -0
- data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +14 -10
- data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +4 -4
- data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +4 -4
- data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +4 -5
- data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +17 -17
- data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +6 -0
- data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +1 -2
- data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +3 -3
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +4 -0
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +6 -13
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +60 -4
- data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +6 -13
- data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +188 -0
- data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +8 -3
- data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +1 -2
- data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +6 -13
- data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +5 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +6 -13
- data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +147 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +4 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +3 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +5 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +31 -57
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +109 -208
- data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +23 -10
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +22 -7
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +23 -12
- data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +15 -8
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +60 -27
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +5 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +5 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +2 -8
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +4 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +9 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +7 -13
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +54 -25
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +5 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +19 -14
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +5 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +8 -7
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +8 -7
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +46 -44
- data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +8 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +46 -6
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +10 -11
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +32 -20
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +5 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +4 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +112 -69
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +422 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +224 -28
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +117 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +1 -12
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +7 -9
- data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +14 -7
- data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +5 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +8 -10
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +122 -72
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +4 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +1 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +6 -6
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +3 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +142 -39
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +21 -11
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +5 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +36 -14
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +4 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +9 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +19 -19
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +4 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +5 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +8 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +13 -21
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +30 -24
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +5 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +31 -21
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +72 -66
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +5 -3
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +12 -5
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +34 -3
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +36 -10
- data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +2 -0
- data/lib/sketchup-api-stubs/stubs/geom.rb +3 -0
- data/lib/sketchup-api-stubs/stubs/sketchup.rb +54 -22
- data/lib/sketchup-api-stubs/stubs/ui.rb +9 -8
- metadata +4 -16
@@ -1,10 +1,11 @@
|
|
1
1
|
# Copyright:: Copyright 2020 Trimble Inc.
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
|
-
# This observer interface is implemented to react to layers events.
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
4
|
+
# This observer interface is implemented to react to layers events.
|
5
|
+
#
|
6
|
+
# @abstract To implement this observer, create a Ruby class of this type, override the
|
7
|
+
# desired methods, and add an instance of the observer to the objects of
|
8
|
+
# interests.
|
8
9
|
#
|
9
10
|
# @example
|
10
11
|
# class MyLayersObserver < Sketchup::LayersObserver
|
@@ -88,6 +89,87 @@ class Sketchup::LayersObserver
|
|
88
89
|
def onLayerChanged(layers, layer)
|
89
90
|
end
|
90
91
|
|
92
|
+
# The {#onLayerFolderAdded} method is called when a layer folder is added
|
93
|
+
# to a model.
|
94
|
+
#
|
95
|
+
# @api TagFolder
|
96
|
+
#
|
97
|
+
# @example
|
98
|
+
# class MyLayersObserver < Sketchup::LayersObserver
|
99
|
+
# def onLayerFolderAdded(layers, layer_folder)
|
100
|
+
# puts "onLayerFolderAdded: #{layer_folder.name}"
|
101
|
+
# end
|
102
|
+
# end
|
103
|
+
#
|
104
|
+
# model = Sketchup.active_model
|
105
|
+
# model.layers.add_observer(MyLayersObserver.new)
|
106
|
+
# folder = model.layers.add_folder("Hello World")
|
107
|
+
#
|
108
|
+
# @param [Sketchup::Layers] layers
|
109
|
+
#
|
110
|
+
# @param [Sketchup::LayerFolder] layer_folder
|
111
|
+
#
|
112
|
+
# @return [nil]
|
113
|
+
#
|
114
|
+
# @version SketchUp 2021.0
|
115
|
+
def onLayerFolderAdded(layers, layer_folder)
|
116
|
+
end
|
117
|
+
|
118
|
+
# The {#onLayerFolderChanged} method is called when a layer folder changes
|
119
|
+
# one of its properties.
|
120
|
+
#
|
121
|
+
# @api TagFolder
|
122
|
+
#
|
123
|
+
# @example
|
124
|
+
# class MyLayersObserver < Sketchup::LayersObserver
|
125
|
+
# def onLayerFolderChanged(layers, layer_folder)
|
126
|
+
# puts "onLayerFolderChanged: #{layer_folder.name}"
|
127
|
+
# end
|
128
|
+
# end
|
129
|
+
#
|
130
|
+
# model = Sketchup.active_model
|
131
|
+
# model.layers.add_observer(MyLayersObserver.new)
|
132
|
+
# folder = model.layers.add_folder("Hello World")
|
133
|
+
# folder.name = "Hello Universe"
|
134
|
+
# folder.visible = false
|
135
|
+
#
|
136
|
+
# @param [Sketchup::Layers] layers
|
137
|
+
#
|
138
|
+
# @param [Sketchup::LayerFolder] layer_folder
|
139
|
+
#
|
140
|
+
# @return [nil]
|
141
|
+
#
|
142
|
+
# @version SketchUp 2021.0
|
143
|
+
def onLayerFolderChanged(layers, layer_folder)
|
144
|
+
end
|
145
|
+
|
146
|
+
# The {#onLayerFolderRemoved} method is called when a layer folder is removed
|
147
|
+
# from a model.
|
148
|
+
#
|
149
|
+
# @api TagFolder
|
150
|
+
#
|
151
|
+
# @example
|
152
|
+
# class MyLayersObserver < Sketchup::LayersObserver
|
153
|
+
# def onLayerFolderRemoved(layers, layer_folder)
|
154
|
+
# puts "onLayerRemoved: #{layer_folder.name}"
|
155
|
+
# end
|
156
|
+
# end
|
157
|
+
#
|
158
|
+
# model = Sketchup.active_model
|
159
|
+
# model.layers.add_observer(MyLayersObserver.new)
|
160
|
+
# folder = model.layers.add_folder("Hello World")
|
161
|
+
# model.layers.remove_folder(folder)
|
162
|
+
#
|
163
|
+
# @param [Sketchup::Layers] layers
|
164
|
+
#
|
165
|
+
# @param [Sketchup::LayerFolder] layer_folder
|
166
|
+
#
|
167
|
+
# @return [nil]
|
168
|
+
#
|
169
|
+
# @version SketchUp 2021.0
|
170
|
+
def onLayerFolderRemoved(layers, layer_folder)
|
171
|
+
end
|
172
|
+
|
91
173
|
# The {#onLayerRemoved} method is called when a layer is removed from a model.
|
92
174
|
#
|
93
175
|
# @example
|
@@ -111,6 +193,37 @@ class Sketchup::LayersObserver
|
|
111
193
|
def onLayerRemoved(layers, layer)
|
112
194
|
end
|
113
195
|
|
196
|
+
# The {#onParentFolderChanged} method is called when a layer changes parent
|
197
|
+
# folder.
|
198
|
+
#
|
199
|
+
# @api TagFolder
|
200
|
+
#
|
201
|
+
# @example
|
202
|
+
# class MyLayersObserver < Sketchup::LayersObserver
|
203
|
+
# def onParentFolderChanged(layers, layer)
|
204
|
+
# puts "onParentFolderChange: #{layer.name}"
|
205
|
+
# end
|
206
|
+
# end
|
207
|
+
#
|
208
|
+
# model = Sketchup.active_model
|
209
|
+
# model.layers.add_observer(MyLayersObserver.new)
|
210
|
+
# layer = model.layers.add_layer("World")
|
211
|
+
# folder = model.layers.add_folder("Hello")
|
212
|
+
# layer.folder = folder
|
213
|
+
#
|
214
|
+
# @note When a folder changes parent {#onLayerFolderRemoved} and
|
215
|
+
# {#onLayerFolderAdded} triggers.
|
216
|
+
#
|
217
|
+
# @param [Sketchup::Layers] layers
|
218
|
+
#
|
219
|
+
# @param [Sketchup::Layer] layer
|
220
|
+
#
|
221
|
+
# @return [nil]
|
222
|
+
#
|
223
|
+
# @version SketchUp 2021.0
|
224
|
+
def onParentFolderChanged(layers, layer)
|
225
|
+
end
|
226
|
+
|
114
227
|
# The {#onRemoveAllLayers} method is called when all layer are removed from a
|
115
228
|
# model.
|
116
229
|
#
|
@@ -74,18 +74,6 @@ class Sketchup::LineStyles < Sketchup::Entity
|
|
74
74
|
def each
|
75
75
|
end
|
76
76
|
|
77
|
-
# The {#size} method returns the number of line styles that SketchUp supports.
|
78
|
-
#
|
79
|
-
# @example
|
80
|
-
# line_styles = Sketchup.active_model.line_styles
|
81
|
-
# line_styles.size
|
82
|
-
#
|
83
|
-
# @return [Integer] The count of line styles.
|
84
|
-
#
|
85
|
-
# @version SketchUp 2019
|
86
|
-
def length
|
87
|
-
end
|
88
|
-
|
89
77
|
# The {#names} method return the support line styles as strings.
|
90
78
|
#
|
91
79
|
# @example
|
@@ -108,6 +96,7 @@ class Sketchup::LineStyles < Sketchup::Entity
|
|
108
96
|
# @version SketchUp 2019
|
109
97
|
def size
|
110
98
|
end
|
99
|
+
alias_method :length, :size
|
111
100
|
|
112
101
|
# The {#to_a} method returns an array of all the line styles.
|
113
102
|
#
|
@@ -358,20 +358,18 @@ class Sketchup::Material < Sketchup::Entity
|
|
358
358
|
#
|
359
359
|
# @overload texture=(filename)
|
360
360
|
#
|
361
|
-
# @param
|
362
|
-
#
|
361
|
+
# @param [String] filename
|
362
|
+
# The file path to the texture the material should use.
|
363
363
|
#
|
364
364
|
# @overload texture=(properties)
|
365
365
|
#
|
366
|
-
# @param
|
367
|
-
# texture
|
368
|
-
# @return [Array(String, Integer, Integer)]
|
366
|
+
# @param [Array(String, Length, Length)] properties
|
367
|
+
# An array with the texture file path and optionally the width and height.
|
369
368
|
#
|
370
369
|
# @overload texture=(image_rep)
|
371
370
|
#
|
372
371
|
# @param [Sketchup::ImageRep] image_rep The pixel data representing the
|
373
372
|
# texture. (Added in SketchUp 2018)
|
374
|
-
# @return [Sketchup::ImageRep]
|
375
373
|
#
|
376
374
|
# @version SketchUp 6.0
|
377
375
|
def texture=(arg)
|
@@ -401,8 +399,8 @@ class Sketchup::Material < Sketchup::Entity
|
|
401
399
|
# material.write_thumbnail(thumbnail_file, 128)
|
402
400
|
# }
|
403
401
|
#
|
404
|
-
# @param [String]
|
405
|
-
# The file
|
402
|
+
# @param [String] path
|
403
|
+
# The file path for the thumbnail.
|
406
404
|
#
|
407
405
|
# @param [Integer] resolution
|
408
406
|
# The resolution of the thumbnail.
|
@@ -410,7 +408,7 @@ class Sketchup::Material < Sketchup::Entity
|
|
410
408
|
# @return [Boolean] true if successful, false if unsuccessful.
|
411
409
|
#
|
412
410
|
# @version SketchUp 8.0 M1
|
413
|
-
def write_thumbnail(
|
411
|
+
def write_thumbnail(path, resolution)
|
414
412
|
end
|
415
413
|
|
416
414
|
end
|
@@ -29,13 +29,14 @@ class Sketchup::Materials < Sketchup::Entity
|
|
29
29
|
#
|
30
30
|
# @overload [](index)
|
31
31
|
#
|
32
|
-
# @param
|
33
|
-
#
|
32
|
+
# @param [Integer] index
|
33
|
+
# A number representing the material's index in an array of Material
|
34
|
+
# objects.
|
34
35
|
# @return [Sketchup::Material, nil] a Material object on success, Nil on failure
|
35
36
|
#
|
36
37
|
# @overload [](name)
|
37
38
|
#
|
38
|
-
# @param
|
39
|
+
# @param [String] name The name of the material.
|
39
40
|
# @return [Sketchup::Material, nil] a Material object on success, Nil on failure
|
40
41
|
#
|
41
42
|
# @version SketchUp 6.0
|
@@ -89,13 +90,14 @@ class Sketchup::Materials < Sketchup::Entity
|
|
89
90
|
#
|
90
91
|
# @overload [](index)
|
91
92
|
#
|
92
|
-
# @param
|
93
|
-
#
|
93
|
+
# @param [Integer] index
|
94
|
+
# A number representing the material's index in an array of Material
|
95
|
+
# objects.
|
94
96
|
# @return [Sketchup::Material, nil] a Material object on success, Nil on failure
|
95
97
|
#
|
96
98
|
# @overload [](name)
|
97
99
|
#
|
98
|
-
# @param
|
100
|
+
# @param [String] name The name of the material.
|
99
101
|
# @return [Sketchup::Material, nil] a Material object on success, Nil on failure
|
100
102
|
#
|
101
103
|
# @version SketchUp 6.0
|
@@ -147,7 +149,7 @@ class Sketchup::Materials < Sketchup::Entity
|
|
147
149
|
def current=(material)
|
148
150
|
end
|
149
151
|
|
150
|
-
# The each method is used to iterate through all of the materials.
|
152
|
+
# The {#each} method is used to iterate through all of the materials.
|
151
153
|
#
|
152
154
|
# @example
|
153
155
|
# model = Sketchup.active_model
|
@@ -155,6 +157,11 @@ class Sketchup::Materials < Sketchup::Entity
|
|
155
157
|
# puts material.display_name
|
156
158
|
# }
|
157
159
|
#
|
160
|
+
# @note Don't remove content from this collection while iterating over it with
|
161
|
+
# {#each}. This would change the size of the collection and cause elements to
|
162
|
+
# be skipped as the indices change. Instead copy the current collection to an
|
163
|
+
# array using +to_a+ and then use +each+ on the array, when removing content.
|
164
|
+
#
|
158
165
|
# @return [nil]
|
159
166
|
#
|
160
167
|
# @version SketchUp 6.0
|
@@ -1,10 +1,11 @@
|
|
1
1
|
# Copyright:: Copyright 2020 Trimble Inc.
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
|
-
# This observer interface is implemented to react to materials events.
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
4
|
+
# This observer interface is implemented to react to materials events.
|
5
|
+
#
|
6
|
+
# @abstract To implement this observer, create a Ruby class of this type, override the
|
7
|
+
# desired methods, and add an instance of the observer to the objects of
|
8
|
+
# interests.
|
8
9
|
#
|
9
10
|
# @example
|
10
11
|
# class MyMaterialsObserver < Sketchup::MaterialsObserver
|
@@ -20,9 +20,9 @@ class Sketchup::Menu
|
|
20
20
|
# menu = UI.menu('Plugins')
|
21
21
|
# menu.add_item("Test") { puts 'Hello World' }
|
22
22
|
#
|
23
|
-
# @overload add_item(
|
23
|
+
# @overload add_item(title, &block)
|
24
24
|
#
|
25
|
-
# @param [String]
|
25
|
+
# @param [String] title
|
26
26
|
# @yield A block that will be invoked when the menu item is selected.
|
27
27
|
# @return [Integer] A unique integer id for the added menu item.
|
28
28
|
#
|
@@ -35,7 +35,7 @@ class Sketchup::Menu
|
|
35
35
|
def add_item(*args)
|
36
36
|
end
|
37
37
|
|
38
|
-
# The add_separator method is used to add a menu separator to a menu.
|
38
|
+
# The {#add_separator} method is used to add a menu separator to a menu.
|
39
39
|
#
|
40
40
|
# @example
|
41
41
|
# plugins_menu = UI.menu("Plugins")
|
@@ -47,7 +47,7 @@ class Sketchup::Menu
|
|
47
47
|
def add_separator
|
48
48
|
end
|
49
49
|
|
50
|
-
# The add_submenu method is used to add a sub-menu to a menu.
|
50
|
+
# The {#add_submenu} method is used to add a sub-menu to a menu.
|
51
51
|
#
|
52
52
|
# @example
|
53
53
|
# plugins_menu = UI.menu("Plugins")
|
@@ -65,7 +65,7 @@ class Sketchup::Menu
|
|
65
65
|
def add_submenu(title)
|
66
66
|
end
|
67
67
|
|
68
|
-
# The set_validation_proc method is used to
|
68
|
+
# The {#set_validation_proc} method is used to specify the menu validation
|
69
69
|
# procedure. Your procedure should return either MF_ENABLED, MF_DISABLED,
|
70
70
|
# MF_CHECKED, MF_UNCHECKED, or MF_GRAYED.
|
71
71
|
#
|
@@ -80,16 +80,14 @@ class Sketchup::Menu
|
|
80
80
|
# end
|
81
81
|
# }
|
82
82
|
#
|
83
|
-
# @param [
|
84
|
-
#
|
85
|
-
#
|
86
|
-
# @return [Integer] a unique numerical item id for the menu
|
83
|
+
# @param [Integer] item
|
84
|
+
# The numerical identifier for the menu item.
|
87
85
|
#
|
88
86
|
# @version SketchUp 6.0
|
89
87
|
#
|
90
88
|
# @yield A method that will be invoked when the menu item is
|
91
89
|
# selected.
|
92
|
-
def set_validation_proc(
|
90
|
+
def set_validation_proc(item, &block)
|
93
91
|
end
|
94
92
|
|
95
93
|
end
|
@@ -44,6 +44,9 @@ class Sketchup::Model
|
|
44
44
|
|
45
45
|
# Constants
|
46
46
|
|
47
|
+
LOAD_STATUS_SUCCESS = nil # Stub value.
|
48
|
+
LOAD_STATUS_SUCCESS_MORE_RECENT = nil # Stub value.
|
49
|
+
|
47
50
|
Make = nil # Stub value.
|
48
51
|
MakeTrial = nil # Stub value.
|
49
52
|
ProLicensed = nil # Stub value.
|
@@ -57,6 +60,7 @@ class Sketchup::Model
|
|
57
60
|
VERSION_2018 = nil # Stub value.
|
58
61
|
VERSION_2019 = nil # Stub value.
|
59
62
|
VERSION_2020 = nil # Stub value.
|
63
|
+
VERSION_2021 = nil # Stub value.
|
60
64
|
VERSION_3 = nil # Stub value.
|
61
65
|
VERSION_4 = nil # Stub value.
|
62
66
|
VERSION_5 = nil # Stub value.
|
@@ -66,15 +70,19 @@ class Sketchup::Model
|
|
66
70
|
|
67
71
|
# Instance Methods
|
68
72
|
|
69
|
-
# The abort_operation method aborts the current operation started with the
|
73
|
+
# The {#abort_operation} method aborts the current operation started with the
|
70
74
|
# start_operation method.
|
71
75
|
#
|
72
|
-
# The abort_operation method is normally called from inside of a rescue
|
73
|
-
# to cancel an operation if something goes wrong.
|
76
|
+
# The {#abort_operation} method is normally called from inside of a rescue
|
77
|
+
# clause to cancel an operation if something goes wrong.
|
74
78
|
#
|
75
79
|
# @example
|
76
80
|
# status = model.abort_operation
|
77
81
|
#
|
82
|
+
# @note Never abort a transparent operation. Doing so would abort the operation
|
83
|
+
# it chains to. Instead, try to clean up and simply commit in order to make
|
84
|
+
# sure the operation is closed.
|
85
|
+
#
|
78
86
|
# @return [Boolean] true if successful, false if unsuccessful
|
79
87
|
#
|
80
88
|
# @version SketchUp 6.0
|
@@ -155,37 +163,6 @@ class Sketchup::Model
|
|
155
163
|
|
156
164
|
# The {#active_path=} method is used to open a given instance path for editing.
|
157
165
|
#
|
158
|
-
# It is expected that no entities are modified in an operation that
|
159
|
-
# opens/closes instances.
|
160
|
-
#
|
161
|
-
# To ensure that undo/redo is done correctly this method breaks up any open
|
162
|
-
# Ruby operations into a set of chained operations:
|
163
|
-
#
|
164
|
-
# If the API user tries to do this:
|
165
|
-
#
|
166
|
-
# model.start_operation('...', true)
|
167
|
-
# model.entities.add_face(...)
|
168
|
-
# model.active_path = instance_path
|
169
|
-
# model.entities.add_face(...)
|
170
|
-
# model.commit_operation
|
171
|
-
#
|
172
|
-
# Then the method will break it up to something like this:
|
173
|
-
#
|
174
|
-
# model.start_operation('...', true)
|
175
|
-
# model.entities.add_face(...)
|
176
|
-
# model.commit_operation
|
177
|
-
#
|
178
|
-
# model.start_operation('...', true, false, true)
|
179
|
-
# model.active_path = instance_path
|
180
|
-
# model.commit_operation
|
181
|
-
#
|
182
|
-
# model.start_operation('...', true, false, true)
|
183
|
-
# model.entities.add_face(...)
|
184
|
-
# model.commit_operation
|
185
|
-
#
|
186
|
-
# For the end user this will be experienced as a single operation.
|
187
|
-
# For the API user the side-effect is multiple transaction notifications.
|
188
|
-
#
|
189
166
|
# @example Open an instance
|
190
167
|
# model = Sketchup.active_model
|
191
168
|
# instance = model.active_entities.grep(Sketchup::ComponentInstance).first
|
@@ -201,8 +178,37 @@ class Sketchup::Model
|
|
201
178
|
# on the given path. A definition cannot be edited if any of its instances
|
202
179
|
# are locked.
|
203
180
|
#
|
204
|
-
# @note
|
205
|
-
# be
|
181
|
+
# @note Since changing the active entities in SketchUp also changes what
|
182
|
+
# coordinate system is used, entities can't be modified in the same operation
|
183
|
+
# as the active entities changes. The API handles this automatically by
|
184
|
+
# starting and committing transparent operations as needed.
|
185
|
+
#
|
186
|
+
# If the API user tries to do this:
|
187
|
+
#
|
188
|
+
# model.start_operation('...', true)
|
189
|
+
# model.entities.add_face(...)
|
190
|
+
# model.active_path = instance_path
|
191
|
+
# model.entities.add_face(...)
|
192
|
+
# model.commit_operation
|
193
|
+
#
|
194
|
+
# Then SketchUp will automatically break it up to something like to this:
|
195
|
+
#
|
196
|
+
# model.start_operation('...', true)
|
197
|
+
# model.entities.add_face(...)
|
198
|
+
# model.commit_operation
|
199
|
+
#
|
200
|
+
# model.start_operation('...', true, false, true)
|
201
|
+
# model.active_path = instance_path
|
202
|
+
# model.commit_operation
|
203
|
+
#
|
204
|
+
# model.start_operation('...', true, false, true)
|
205
|
+
# model.entities.add_face(...)
|
206
|
+
# model.commit_operation
|
207
|
+
#
|
208
|
+
# For the end user this will be experienced as a single operation.
|
209
|
+
#
|
210
|
+
# For the API user the side-effect is multiple transaction notifications to
|
211
|
+
# {Sketchup::ModelObserver}s.
|
206
212
|
#
|
207
213
|
# @param [Sketchup::InstancePath, Array<Sketchup::ComponentInstance, Sketchup::Group>, nil] instance_path
|
208
214
|
# Passing +nil+ or an empty array will close all open instances.
|
@@ -214,6 +220,8 @@ class Sketchup::Model
|
|
214
220
|
# @raise [ArgumentError] if the instance path contains instances who's
|
215
221
|
# siblings are locked.
|
216
222
|
#
|
223
|
+
# @raise [ArgumentError] if the instance path contains Live Components.
|
224
|
+
#
|
217
225
|
# @return [Sketchup::Model]
|
218
226
|
#
|
219
227
|
# @version SketchUp 2020.0
|
@@ -360,13 +368,14 @@ class Sketchup::Model
|
|
360
368
|
def behavior
|
361
369
|
end
|
362
370
|
|
363
|
-
# The {#bounds} method
|
371
|
+
# The {#bounds} method is used to retrieve the {Geom::BoundingBox} bounding the
|
372
|
+
# contents of a {Sketchup::Model}.
|
364
373
|
#
|
365
374
|
# @example
|
366
375
|
# model = Sketchup.active_model
|
367
376
|
# bounds = model.bounds
|
368
377
|
#
|
369
|
-
# @return [Geom::BoundingBox]
|
378
|
+
# @return [Geom::BoundingBox]
|
370
379
|
#
|
371
380
|
# @version SketchUp 6.0
|
372
381
|
def bounds
|
@@ -614,15 +623,15 @@ class Sketchup::Model
|
|
614
623
|
# :ifc_types => ['IfcBuilding', 'IfcDoor']}
|
615
624
|
# status = model.export('c:/my_export.ifc', options_hash)
|
616
625
|
#
|
617
|
-
# @overload export(
|
626
|
+
# @overload export(path, show_summary = false)
|
618
627
|
#
|
619
|
-
# @param [String]
|
628
|
+
# @param [String] path The name of the file to export.
|
620
629
|
# @param [Boolean] show_summary Boolean to show summary dialog.
|
621
630
|
# @return [Boolean]
|
622
631
|
#
|
623
|
-
# @overload export(
|
632
|
+
# @overload export(path, options)
|
624
633
|
#
|
625
|
-
# @param [String]
|
634
|
+
# @param [String] path The path to save the export at.
|
626
635
|
# @param [Hash] options
|
627
636
|
# @return [Boolean]
|
628
637
|
#
|
@@ -689,15 +698,54 @@ class Sketchup::Model
|
|
689
698
|
# entities = model.find_entity_by_persistent_id(id1, id2, id3)
|
690
699
|
# entities = model.find_entity_by_persistent_id([id1, id2, id3])
|
691
700
|
#
|
692
|
-
# @
|
693
|
-
#
|
694
|
-
#
|
695
|
-
#
|
696
|
-
#
|
697
|
-
#
|
701
|
+
# @example Limit search by scope
|
702
|
+
# model = Sketchup.active_model
|
703
|
+
# edge_pid = model.entities.add_line([0,0,0], [9,9,9]).persistent_id
|
704
|
+
# layer_pid = model.layers.add('Hello World').persistent_id
|
705
|
+
#
|
706
|
+
# # Search in all scopes:
|
707
|
+
# entities = model.find_entity_by_persistent_id(edge_pid, layer_pid)
|
708
|
+
# # => [#<Sketchup::Edge:0x000002567da4a8f0>, #<Sketchup::Layer:0x000002567da49e50>]
|
709
|
+
#
|
710
|
+
# # Search in layer scope:
|
711
|
+
# entities = model.find_entity_by_persistent_id(edge_pid, layer_pid, layers: true)
|
712
|
+
# # => [nil, #<Sketchup::Layer:0x000002567da49e50>]
|
713
|
+
#
|
714
|
+
# @overload find_entity_by_persistent_id(ids_or_array)
|
715
|
+
#
|
716
|
+
# @param [Array<Integer>] ids_or_array Pass either a series of ids or a
|
717
|
+
# single array containing persistent ids.
|
718
|
+
#
|
719
|
+
# @return [Array<Sketchup::Entity, nil>] Returns an array with
|
720
|
+
# {Sketchup::Entity} objects for each id found and nil otherwise.
|
721
|
+
#
|
722
|
+
# @overload find_entity_by_persistent_id(ids_or_array, **scope)
|
723
|
+
#
|
724
|
+
# @version SketchUp 2020.2
|
725
|
+
# @param [Array<Integer>] ids_or_array Pass either a series of ids or a
|
726
|
+
# single array containing persistent ids.
|
727
|
+
# @param [Hash<Symbol, Boolean>] scope Limit the scope of the search to the
|
728
|
+
# given scope categories.
|
729
|
+
# @option [Boolean] scope :entities Search entities parent to
|
730
|
+
# {Sketchup::Entities}.
|
731
|
+
# @option [Boolean] scope :layers Search {Sketchup::Layers} for
|
732
|
+
# {Sketchup::Layer} entities.
|
733
|
+
# @option [Boolean] scope :layer_folders Search {Sketchup::Layers} for
|
734
|
+
# {Sketchup::LayerFolder} entities.
|
735
|
+
# @option [Boolean] scope :materials Search {Sketchup::Materials} for
|
736
|
+
# {Sketchup::Material} entities.
|
737
|
+
# @option [Boolean] scope :pages Search {Sketchup::Pages} for
|
738
|
+
# {Sketchup::Page} entities.
|
739
|
+
# @option [Boolean] scope :styles Search {Sketchup::Styles} for
|
740
|
+
# {Sketchup::Style} entities.
|
741
|
+
# @option [Boolean] scope :definitions Search {Sketchup::DefinitionList} for
|
742
|
+
# {Sketchup::ComponentDefinition} entities.
|
743
|
+
#
|
744
|
+
# @return [Array<Sketchup::Entity, nil>] Returns an array with
|
745
|
+
# {Sketchup::Entity} objects for each id found and nil otherwise.
|
698
746
|
#
|
699
747
|
# @version SketchUp 2017
|
700
|
-
def find_entity_by_persistent_id(
|
748
|
+
def find_entity_by_persistent_id(*args)
|
701
749
|
end
|
702
750
|
|
703
751
|
# This methods determines if the model is georeferenced.
|
@@ -820,16 +868,16 @@ class Sketchup::Model
|
|
820
868
|
# :show_summary => true }
|
821
869
|
# status = model.import("filename", options)
|
822
870
|
#
|
823
|
-
# @overload import(
|
871
|
+
# @overload import(path, options)
|
824
872
|
#
|
825
|
-
# @param [String]
|
873
|
+
# @param [String] path The input file path.
|
826
874
|
# @param [Hash] options The options.
|
827
875
|
# @return [Boolean]
|
828
876
|
#
|
829
|
-
# @overload import(
|
877
|
+
# @overload import(path, show_summary = false)
|
830
878
|
#
|
831
879
|
# @note This variant is for SketchUp 2017 and earlier.
|
832
|
-
# @param [String]
|
880
|
+
# @param [String] path The input file path.
|
833
881
|
# @param [Boolean] show_summary Show the summary dialog.
|
834
882
|
# @return [Boolean]
|
835
883
|
#
|
@@ -1031,7 +1079,7 @@ class Sketchup::Model
|
|
1031
1079
|
# @example
|
1032
1080
|
# # Output all options available.
|
1033
1081
|
# options_manager = Sketchup.active_model.options
|
1034
|
-
# options_manager.
|
1082
|
+
# options_manager.each { |options_provider|
|
1035
1083
|
# puts options_provider.name
|
1036
1084
|
# options_provider.each { |key, value|
|
1037
1085
|
# puts "> #{key} - #{value}"
|
@@ -1214,15 +1262,15 @@ class Sketchup::Model
|
|
1214
1262
|
# @example
|
1215
1263
|
# model = Sketchup.active_model
|
1216
1264
|
# # Save the model using the current SketchUp format
|
1217
|
-
#
|
1218
|
-
# status = model.save(
|
1265
|
+
# path = File.join(ENV['HOME'], 'Desktop', 'mysketchup.skp')
|
1266
|
+
# status = model.save(path)
|
1219
1267
|
# # Save the model to the current file using the current SketchUp format
|
1220
1268
|
# status = model.save
|
1221
1269
|
# # Save the model to the current file in SketchUp 8 format
|
1222
1270
|
# status = model.save("", Sketchup::Model::VERSION_8)
|
1223
1271
|
# # Save the model in SketchUp 8 format
|
1224
|
-
#
|
1225
|
-
# status = model.save(
|
1272
|
+
# path = File.join(ENV['Home'], 'Desktop', 'mysketchup_v8.skp')
|
1273
|
+
# status = model.save(path, Sketchup::Model::VERSION_8)
|
1226
1274
|
#
|
1227
1275
|
# @note A bug in SketchUp 2016 and older caused the +.skb+ backup file
|
1228
1276
|
# written during save to be empty. The +.skp+ file was however valid.
|
@@ -1234,19 +1282,19 @@ class Sketchup::Model
|
|
1234
1282
|
# will be saved to the file to which it is associated. It must have
|
1235
1283
|
# already been saved to a file.
|
1236
1284
|
#
|
1237
|
-
# @overload save(
|
1285
|
+
# @overload save(path)
|
1238
1286
|
#
|
1239
|
-
# @param [String]
|
1287
|
+
# @param [String] path
|
1240
1288
|
# The name of the file to save.
|
1241
1289
|
# Starting with SketchUp 2014, this parameter is optional.
|
1242
1290
|
# If not provided or an empty string, model will be saved
|
1243
1291
|
# to the file to which it is associated. It must have
|
1244
1292
|
# already been saved to a file.
|
1245
1293
|
#
|
1246
|
-
# @overload save(
|
1294
|
+
# @overload save(path, version)
|
1247
1295
|
#
|
1248
|
-
# @param [String]
|
1249
|
-
# The
|
1296
|
+
# @param [String] path
|
1297
|
+
# The path of the file to save to.
|
1250
1298
|
# Starting with SketchUp 2014, this parameter is optional.
|
1251
1299
|
# If not provided or an empty string, model will be saved
|
1252
1300
|
# to the file to which it is associated. It must have
|
@@ -1267,7 +1315,8 @@ class Sketchup::Model
|
|
1267
1315
|
# Sketchup::Model::VERSION_2017,
|
1268
1316
|
# Sketchup::Model::VERSION_2018,
|
1269
1317
|
# Sketchup::Model::VERSION_2019,
|
1270
|
-
# Sketchup::Model::VERSION_2020
|
1318
|
+
# Sketchup::Model::VERSION_2020,
|
1319
|
+
# Sketchup::Model::VERSION_2021
|
1271
1320
|
#
|
1272
1321
|
# @return [Boolean] true if successful, false if unsuccessful
|
1273
1322
|
#
|
@@ -1280,14 +1329,14 @@ class Sketchup::Model
|
|
1280
1329
|
# @example
|
1281
1330
|
# model = Sketchup.active_model
|
1282
1331
|
# # Save copy of the model using the current SketchUp format
|
1283
|
-
#
|
1284
|
-
# status = model.save_copy(
|
1332
|
+
# path = File.join(ENV['Home'], 'Desktop', 'myModelCopy.skp')
|
1333
|
+
# status = model.save_copy(path)
|
1285
1334
|
# # Save copy of the model in SketchUp 8 format
|
1286
|
-
#
|
1287
|
-
# status = model.save_copy(
|
1335
|
+
# path = File.join(ENV['Home'], 'Desktop', 'mysketchupcopy_v8.skp')
|
1336
|
+
# status = model.save_copy(path, Sketchup::Model::VERSION_8)
|
1288
1337
|
#
|
1289
|
-
# @param [String]
|
1290
|
-
# The
|
1338
|
+
# @param [String] path
|
1339
|
+
# The path of the file to save the model copy to.
|
1291
1340
|
#
|
1292
1341
|
# @param [Integer] version
|
1293
1342
|
# (SketchUp 2014+)
|
@@ -1304,12 +1353,13 @@ class Sketchup::Model
|
|
1304
1353
|
# Sketchup::Model::VERSION_2017,
|
1305
1354
|
# Sketchup::Model::VERSION_2018,
|
1306
1355
|
# Sketchup::Model::VERSION_2019,
|
1307
|
-
# Sketchup::Model::VERSION_2020
|
1356
|
+
# Sketchup::Model::VERSION_2020,
|
1357
|
+
# Sketchup::Model::VERSION_2021
|
1308
1358
|
#
|
1309
1359
|
# @return [Boolean] true if successful, false if unsuccessful
|
1310
1360
|
#
|
1311
1361
|
# @version SketchUp 2014
|
1312
|
-
def save_copy(
|
1362
|
+
def save_copy(path, version)
|
1313
1363
|
end
|
1314
1364
|
|
1315
1365
|
# The save_thumbnail method is used to save a thumbnail image to a file.
|