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 pages events.
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
4
|
+
# This observer interface is implemented to react to pages 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
|
# # This is an example of an observer that watches the pages for new ones.
|
@@ -1,15 +1,26 @@
|
|
1
1
|
# Copyright:: Copyright 2020 Trimble Inc.
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
|
-
# The PickHelper class is used to pick entities that reside under
|
5
|
-
# cursor location
|
6
|
-
#
|
7
|
-
#
|
4
|
+
# The {Sketchup::PickHelper} class is used to pick entities that reside under
|
5
|
+
# the current cursor location, similar to native Select tool. Unlike
|
6
|
+
# {Sketchup::InputPoint}, {Sketchup::PickHelper} uses no inference.
|
7
|
+
#
|
8
|
+
# Only {Sketchup::Tool}s react to cursor location and most of these methods are
|
9
|
+
# only useful in the context of a tool. For example, if you want to determine
|
10
|
+
# the entity you just clicked, you would use {#do_pick} from within your
|
11
|
+
# {Sketchup::Tool#onLButtonDown} method.
|
12
|
+
#
|
13
|
+
# You can retrieve a PickHelper object using the {Sketchup::View#pick_helper}
|
14
|
+
# method.
|
8
15
|
#
|
9
16
|
# Entities that are picked (found under the
|
10
17
|
# cursor when a mouse or keyboard event occurs), are called Pick Records and
|
11
18
|
# are placed in an indexed list.
|
12
19
|
#
|
20
|
+
# @note The same {Sketchup::Pickhelper} instance is being reused by SketchUp.
|
21
|
+
# Don't extend, add methods or redefine methods on this object as it can
|
22
|
+
# clash with other extensions.
|
23
|
+
#
|
13
24
|
# @version SketchUp 6.0
|
14
25
|
class Sketchup::PickHelper
|
15
26
|
|
@@ -110,8 +121,8 @@ class Sketchup::PickHelper
|
|
110
121
|
# entities in the list of pick records.
|
111
122
|
#
|
112
123
|
# @example
|
113
|
-
#
|
114
|
-
#
|
124
|
+
# pickhelper = view.pick_helper
|
125
|
+
# pickhelper.do_pick(x, y)
|
115
126
|
# # Iterate all pick-routes:
|
116
127
|
# pickhelper.count.times { |pick_path_index|
|
117
128
|
# puts pickhelper.depth_at(pick_path_index)
|
@@ -156,8 +167,8 @@ class Sketchup::PickHelper
|
|
156
167
|
# Use count() to get the number of possible pick paths.
|
157
168
|
#
|
158
169
|
# @example
|
159
|
-
#
|
160
|
-
#
|
170
|
+
# pickhelper = view.pick_helper
|
171
|
+
# pickhelper.do_pick(x, y)
|
161
172
|
# # Iterate all pick-routes:
|
162
173
|
# pickhelper.count.times { |pick_path_index|
|
163
174
|
# puts pickhelper.element_at(pick_path_index)
|
@@ -212,8 +223,8 @@ class Sketchup::PickHelper
|
|
212
223
|
# Use count() to get the number of possible pick paths.
|
213
224
|
#
|
214
225
|
# @example
|
215
|
-
#
|
216
|
-
#
|
226
|
+
# pickhelper = view.pick_helper
|
227
|
+
# pickhelper.do_pick(x, y)
|
217
228
|
# # Iterate all pick-routes:
|
218
229
|
# pickhelper.count.times { |pick_path_index|
|
219
230
|
# p pickhelper.leaf_at(pick_path_index)
|
@@ -239,8 +250,8 @@ class Sketchup::PickHelper
|
|
239
250
|
# item will be a drawing element that is not a group, component or image.
|
240
251
|
#
|
241
252
|
# @example
|
242
|
-
#
|
243
|
-
#
|
253
|
+
# pickhelper = view.pick_helper
|
254
|
+
# pickhelper.do_pick(x, y)
|
244
255
|
# # Iterate all pick-routes:
|
245
256
|
# pickhelper.count.times { |pick_path_index|
|
246
257
|
# p pickhelper.path_at(pick_path_index)
|
@@ -399,13 +410,24 @@ class Sketchup::PickHelper
|
|
399
410
|
# coordinates of the leaf entity into the coordinates of the active entities.
|
400
411
|
#
|
401
412
|
# @example
|
402
|
-
#
|
403
|
-
#
|
413
|
+
# pickhelper = view.pick_helper
|
414
|
+
# pickhelper.do_pick(x, y)
|
404
415
|
# # Iterate all pick-routes:
|
405
416
|
# pickhelper.count.times { |pick_path_index|
|
406
417
|
# puts pickhelper.transformation_at(pick_path_index)
|
407
418
|
# }
|
408
419
|
#
|
420
|
+
# @example Get transformation for specific picked element
|
421
|
+
# pickhelper = view.pick_helper
|
422
|
+
# pickhelper.do_pick(x, y)
|
423
|
+
# face = pickhelper.picked_face # Face may be inside a group or component.
|
424
|
+
#
|
425
|
+
# index = pickhelper.count.times.find { |i| pickhelper.leaf_at(i) == face }
|
426
|
+
# transformation = index ? pickhelper.transformation_at(index) : IDENTITY
|
427
|
+
#
|
428
|
+
# # Face#area is one method that may need a transformation.
|
429
|
+
# area = face.area(transformation)
|
430
|
+
#
|
409
431
|
# @param index
|
410
432
|
# The index where the transformation should be retrieved.
|
411
433
|
#
|
@@ -2,9 +2,10 @@
|
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
4
|
# This observer interface is implemented to react to rendering options events.
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
5
|
+
#
|
6
|
+
# @abstract To implement this observer, create a Ruby class of this type, implement the
|
7
|
+
# desired methods, and add an instance of the observer to the objects of
|
8
|
+
# interests.
|
8
9
|
#
|
9
10
|
# @example
|
10
11
|
# # This is an example of an observer that watches the rendering options
|
@@ -38,7 +38,7 @@ class Sketchup::Selection
|
|
38
38
|
# @param [Integer] index
|
39
39
|
# The index of the Entity object to retrieve.
|
40
40
|
#
|
41
|
-
# @return [Sketchup::
|
41
|
+
# @return [Sketchup::Entity, nil]
|
42
42
|
#
|
43
43
|
# @see #at
|
44
44
|
#
|
@@ -108,7 +108,7 @@ class Sketchup::Selection
|
|
108
108
|
# @param [Integer] index
|
109
109
|
# The index of the Entity object to retrieve.
|
110
110
|
#
|
111
|
-
# @return [Sketchup::
|
111
|
+
# @return [Sketchup::Entity, nil]
|
112
112
|
#
|
113
113
|
# @see #[]
|
114
114
|
#
|
@@ -172,7 +172,12 @@ class Sketchup::Selection
|
|
172
172
|
# efficient than using [].
|
173
173
|
#
|
174
174
|
# @example
|
175
|
-
# selection.each { |entity|
|
175
|
+
# selection.each { |entity| puts entity }
|
176
|
+
#
|
177
|
+
# @note Don't remove content from this collection while iterating over it with
|
178
|
+
# {#each}. This would change the size of the collection and cause elemnts to
|
179
|
+
# be skipped as the indices change. Instead copy the current collection to an
|
180
|
+
# array using +to_a+ and then use +each+ on the array, when removing content.
|
176
181
|
#
|
177
182
|
# @return [nil]
|
178
183
|
#
|
@@ -232,7 +237,7 @@ class Sketchup::Selection
|
|
232
237
|
def include?(entity)
|
233
238
|
end
|
234
239
|
|
235
|
-
# The #
|
240
|
+
# The {#invert} method is used to invert the selection.
|
236
241
|
#
|
237
242
|
# @example
|
238
243
|
# model = Sketchup.active_model
|
@@ -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 selection events.
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
4
|
+
# This observer interface is implemented to react to selection 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
|
# # This is an example of an observer that watches the selection for
|
@@ -30,7 +31,7 @@ class Sketchup::SelectionObserver
|
|
30
31
|
# end
|
31
32
|
#
|
32
33
|
# @note This event might not trigger even if a single element is selected. For
|
33
|
-
# instance the Selection tool will trigger #onSelectionBulkChange regardless.
|
34
|
+
# instance the Selection tool will trigger {#onSelectionBulkChange} regardless.
|
34
35
|
#
|
35
36
|
# @param [Sketchup::Selection] selection
|
36
37
|
#
|
@@ -53,7 +54,7 @@ class Sketchup::SelectionObserver
|
|
53
54
|
#
|
54
55
|
# @example
|
55
56
|
# def onSelectionBulkChange(selection)
|
56
|
-
# puts "
|
57
|
+
# puts "onSelectionBulkChange: #{selection}"
|
57
58
|
# end
|
58
59
|
#
|
59
60
|
# @param [Sketchup::Selection] selection
|
@@ -80,27 +81,26 @@ class Sketchup::SelectionObserver
|
|
80
81
|
def onSelectionCleared(selection)
|
81
82
|
end
|
82
83
|
|
84
|
+
#
|
85
|
+
# @bug Due to a bug in SketchUp this event doesn't trigger. Instead
|
86
|
+
# +onSelectedRemoved+ is called.
|
83
87
|
#
|
84
88
|
# @example
|
85
89
|
# class MySelectionObserver < Sketchup::SelectionObserver
|
86
|
-
#
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
#
|
92
|
-
# # fixed:
|
93
|
-
# def onSelectedRemoved(selection, entity)
|
94
|
-
# # You can forward it to the correct event to be future compatible.
|
95
|
-
# onSelectionRemoved(selection, entity)
|
96
|
-
# end
|
90
|
+
# def onSelectionRemoved(selection, entity)
|
91
|
+
# puts "onSelectionRemoved: #{entity}"
|
92
|
+
# end
|
93
|
+
#
|
94
|
+
# # Due to a SketchUp bug, this method is called by the wrong name.
|
95
|
+
# alias_method :onSelectedRemoved, :onSelectionRemoved
|
97
96
|
# end
|
98
97
|
#
|
99
98
|
# # Attach the observer.
|
100
99
|
# Sketchup.active_model.selection.add_observer(MySelectionObserver.new)
|
101
100
|
#
|
102
|
-
# @note
|
103
|
-
#
|
101
|
+
# @note This event might not trigger even if a single element is deselected.
|
102
|
+
# For instance the Selection tool will trigger {#onSelectionBulkChange}
|
103
|
+
# regardless.
|
104
104
|
#
|
105
105
|
# @param [Sketchup::Selection] selection
|
106
106
|
#
|
@@ -20,7 +20,7 @@
|
|
20
20
|
# - +Latitude+ (in Model Info > Geo-location > Set Manual Location...)
|
21
21
|
# - +Light+ (in Window > Shadows)
|
22
22
|
# - +Longitude+ (in Model Info > Geo-location > Set Manual Location...)
|
23
|
-
# - +
|
23
|
+
# - +NorthAngle+ (in View > Toolbars > Solar North) Note that 'Toolbar' is called 'Tool Palettes' on Mac
|
24
24
|
# - +ShadowTime+ (in Window > Shadows)
|
25
25
|
# - +ShadowTime_time_t+ (ShadowTime in Epoch time)
|
26
26
|
# - +SunDirection+ (Generated based on ShadowTime)
|
@@ -50,7 +50,7 @@ class Sketchup::ShadowInfo < Sketchup::Entity
|
|
50
50
|
# The each_key method iterates through all of the shadow information keys.
|
51
51
|
#
|
52
52
|
# @example
|
53
|
-
# shadowinfo.each_key { |key|
|
53
|
+
# shadowinfo.each_key { |key| puts key }
|
54
54
|
#
|
55
55
|
# @return [nil]
|
56
56
|
#
|
@@ -165,7 +165,7 @@ class Sketchup::ShadowInfo < Sketchup::Entity
|
|
165
165
|
# The each_key method iterates through all of the shadow information keys.
|
166
166
|
#
|
167
167
|
# @example
|
168
|
-
# shadowinfo.each_key { |key|
|
168
|
+
# shadowinfo.each_key { |key| puts key }
|
169
169
|
#
|
170
170
|
# @return [nil]
|
171
171
|
#
|
@@ -175,7 +175,7 @@ class Sketchup::ShadowInfo < Sketchup::Entity
|
|
175
175
|
def each_key
|
176
176
|
end
|
177
177
|
|
178
|
-
# The #
|
178
|
+
# The {#each_pair} method is an alias for {#each}.
|
179
179
|
#
|
180
180
|
# @example
|
181
181
|
# model = Sketchup.active_model
|
@@ -2,9 +2,11 @@
|
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
4
|
# This observer interface is implemented to react to changes to the shadow
|
5
|
-
# settings.
|
6
|
-
#
|
7
|
-
#
|
5
|
+
# settings.
|
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
|
+
# {Sketchup::ShadowInfo} object.
|
8
10
|
#
|
9
11
|
# @example
|
10
12
|
# # This is an example of an observer that watches the selection for
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Copyright:: Copyright 2020 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The {Sketchup::Skp} module is used to read metadata from external SketchUp
|
5
|
+
# files without loading the whole file.
|
6
|
+
#
|
7
|
+
# @version SketchUp 2021.0
|
8
|
+
module Sketchup::Skp
|
9
|
+
|
10
|
+
# Class Methods
|
11
|
+
|
12
|
+
# The {.read_guid} method is used to read the GUID, globally unique identifier,
|
13
|
+
# for an external model.
|
14
|
+
#
|
15
|
+
# In SketchUp, GUIDs are used to test if {Sketchup::ComponentDefinition}s and
|
16
|
+
# {Sketchup::Model}s match (a component being an embedded model).
|
17
|
+
# When you insert a component to a model, its GUID is compared to existing
|
18
|
+
# component definitions in that model, and if there is a match the existing
|
19
|
+
# component definition is re-used rather than a duplicate being added.
|
20
|
+
# When a component definition is modified or a model is saved, their GUIDs are
|
21
|
+
# renewed.
|
22
|
+
#
|
23
|
+
# @example
|
24
|
+
# model = Sketchup.active_model
|
25
|
+
# definitions = model.definitions
|
26
|
+
# definition = definitions.find { |definition| !definition.internal? }
|
27
|
+
# # true if component matches its external file.
|
28
|
+
# definition.guid == Sketchup::Skp.read_guid(definition.path)
|
29
|
+
#
|
30
|
+
# @param [String] filepath
|
31
|
+
#
|
32
|
+
# @raise [ArgumentError] if the file is missing or is not a SketchUp model.
|
33
|
+
#
|
34
|
+
# @return [String]
|
35
|
+
#
|
36
|
+
# @version SketchUp 2021.0
|
37
|
+
def self.read_guid(filepath)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -38,7 +38,12 @@ class Sketchup::Styles < Sketchup::Entity
|
|
38
38
|
def [](arg)
|
39
39
|
end
|
40
40
|
|
41
|
-
# The #
|
41
|
+
# The {#active_style} method is used to retrieve the active style.
|
42
|
+
#
|
43
|
+
# While {#selected_style} is the style being selected in the Style Browser,
|
44
|
+
# the #{active_style} is a different object also including any unsaved style
|
45
|
+
# changes. These changes are silently dropped once a new style is selected.
|
46
|
+
# To save these changes to the selected style, call #{update_selected_style}.
|
42
47
|
#
|
43
48
|
# @example
|
44
49
|
# styles = Sketchup.active_model.styles
|
@@ -152,7 +157,8 @@ class Sketchup::Styles < Sketchup::Entity
|
|
152
157
|
def purge_unused
|
153
158
|
end
|
154
159
|
|
155
|
-
# The {#selected_style} method is used to retrieve the currently
|
160
|
+
# The {#selected_style} method is used to retrieve the style currently
|
161
|
+
# selected in the Styles Browser.
|
156
162
|
#
|
157
163
|
# @example
|
158
164
|
# styles = Sketchup.active_model.styles
|
@@ -41,27 +41,19 @@ class Sketchup::Texture < Sketchup::Entity
|
|
41
41
|
def average_color
|
42
42
|
end
|
43
43
|
|
44
|
-
# The filename method retrieves the entire path, including the file, for a
|
44
|
+
# The {#filename} method retrieves the entire path, including the file, for a
|
45
45
|
# texture object.
|
46
46
|
#
|
47
47
|
# @example
|
48
48
|
# model = Sketchup.active_model
|
49
|
-
# materials=model.materials
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
# # Returns nil if not successful, path if successful
|
54
|
-
# m.texture = "c:\\Materials\\Carpet.jpg"
|
55
|
-
# rescue
|
56
|
-
# UI.messagebox $!.message
|
57
|
-
# end
|
58
|
-
# texture = m.texture
|
49
|
+
# materials = model.materials
|
50
|
+
# material = materials.add("Test Color")
|
51
|
+
# material.texture = "c:\\Materials\\Carpet.jpg"
|
52
|
+
# texture = material.texture
|
59
53
|
# filename = texture.filename
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
# UI.messagebox "Failure"
|
64
|
-
# end
|
54
|
+
#
|
55
|
+
# @note Since SketchUp 2021.0 this method will append a file extension matching
|
56
|
+
# the image format if the file extension is missing from stored filepath.
|
65
57
|
#
|
66
58
|
# @return [String] a string representation of the path and
|
67
59
|
# filename used for the texture.
|
@@ -206,11 +198,11 @@ class Sketchup::Texture < Sketchup::Entity
|
|
206
198
|
# @example
|
207
199
|
# material = Sketchup.active_model.materials[0]
|
208
200
|
# basename = File.basename(material.texture.filename)
|
209
|
-
#
|
210
|
-
# material.texture.write(
|
201
|
+
# path = File.join(Sketchup.temp_dir, basename)
|
202
|
+
# material.texture.write(path)
|
211
203
|
#
|
212
|
-
# @param [String]
|
213
|
-
#
|
204
|
+
# @param [String] path
|
205
|
+
# The file path to write the texture to.
|
214
206
|
#
|
215
207
|
# @param [Boolean] colorize
|
216
208
|
# Boolean - Allows for the texture to
|
@@ -219,7 +211,7 @@ class Sketchup::Texture < Sketchup::Entity
|
|
219
211
|
# @return [Boolean] true if the method succeeded
|
220
212
|
#
|
221
213
|
# @version SketchUp 2016
|
222
|
-
def write(
|
214
|
+
def write(path, colorize = false)
|
223
215
|
end
|
224
216
|
|
225
217
|
end
|
@@ -32,12 +32,15 @@
|
|
32
32
|
# - +ALT_MODIFIER_KEY+ = Command on Mac, Alt on PC
|
33
33
|
# - +ALT_MODIFIER_MASK+ = Command on Mac, Alt on PC
|
34
34
|
#
|
35
|
+
# @abstract Implement the methods described in this class to create a tool.
|
36
|
+
# You can not sub-class this class because it is not defined by the API.
|
37
|
+
#
|
35
38
|
# @version SketchUp 6.0
|
36
39
|
class Sketchup::Tool
|
37
40
|
|
38
41
|
# Instance Methods
|
39
42
|
|
40
|
-
# The #
|
43
|
+
# The {#activate} method is called by SketchUp when the tool is selected.
|
41
44
|
# It is a good place to put most of your initialization, such as instance
|
42
45
|
# variables to track the state of the tool.
|
43
46
|
#
|
@@ -50,7 +53,7 @@ class Sketchup::Tool
|
|
50
53
|
def activate
|
51
54
|
end
|
52
55
|
|
53
|
-
# The #
|
56
|
+
# The {#deactivate} method is called when the tool is deactivated because a
|
54
57
|
# different tool was selected.
|
55
58
|
#
|
56
59
|
# @example
|
@@ -102,7 +105,7 @@ class Sketchup::Tool
|
|
102
105
|
def draw(view)
|
103
106
|
end
|
104
107
|
|
105
|
-
# The #
|
108
|
+
# The {#enableVCB?} method is used to tell SketchUp whether to allow the user
|
106
109
|
# to enter text into the VCB (value control box, aka the "measurements" panel).
|
107
110
|
# If you do not implement this method, then the vcb is disabled by default.
|
108
111
|
#
|
@@ -141,7 +144,7 @@ class Sketchup::Tool
|
|
141
144
|
def getExtents
|
142
145
|
end
|
143
146
|
|
144
|
-
# The #
|
147
|
+
# The {#getInstructorContentDirectory} method is used to tell SketchUp the
|
145
148
|
# directory containing your Tool's instructor content. To use this, create
|
146
149
|
# a custom instructor directory, put an index.html file inside of it, and then
|
147
150
|
# return that path via this method. If the SketchUp user has the Instructor
|
@@ -165,7 +168,7 @@ class Sketchup::Tool
|
|
165
168
|
def getInstructorContentDirectory
|
166
169
|
end
|
167
170
|
|
168
|
-
# The #
|
171
|
+
# The {#getMenu} method is called by SketchUp to let the tool provide its own
|
169
172
|
# context menu. Most tools will not want to implement this method and,
|
170
173
|
# instead, use the normal context menu found on all entities.
|
171
174
|
#
|
@@ -250,6 +253,9 @@ class Sketchup::Tool
|
|
250
253
|
# actually executed. If you need to do something with the model after an undo
|
251
254
|
# use {Sketchup::ModelObserver#onTransactionUndo}.
|
252
255
|
#
|
256
|
+
# @note When {#onKeyDown} is implemented and returns +true+, pressing Esc
|
257
|
+
# doesn't trigger {#onCancel}.
|
258
|
+
#
|
253
259
|
# @param [Integer] reason
|
254
260
|
# A reason value (see comments).
|
255
261
|
#
|
@@ -259,7 +265,7 @@ class Sketchup::Tool
|
|
259
265
|
def onCancel(reason, view)
|
260
266
|
end
|
261
267
|
|
262
|
-
# The #
|
268
|
+
# The {#onKeyDown} method is called by SketchUp when the user presses a key on
|
263
269
|
# the keyboard. If you want to get input from the VCB, you should implement
|
264
270
|
# onUserText rather than this method.
|
265
271
|
#
|
@@ -320,7 +326,7 @@ class Sketchup::Tool
|
|
320
326
|
def onKeyDown(key, repeat, flags, view)
|
321
327
|
end
|
322
328
|
|
323
|
-
# The #
|
329
|
+
# The {#onKeyUp} method is called by SketchUp when the user releases a key on
|
324
330
|
# the keyboard.
|
325
331
|
#
|
326
332
|
# @example
|
@@ -352,7 +358,7 @@ class Sketchup::Tool
|
|
352
358
|
def onKeyUp(key, repeat, flags, view)
|
353
359
|
end
|
354
360
|
|
355
|
-
# The #
|
361
|
+
# The {#onLButtonDoubleClick} is called by SketchUp when the user double clicks
|
356
362
|
# with the left mouse button.
|
357
363
|
#
|
358
364
|
# @example
|
@@ -379,7 +385,7 @@ class Sketchup::Tool
|
|
379
385
|
def onLButtonDoubleClick(flags, x, y, view)
|
380
386
|
end
|
381
387
|
|
382
|
-
# The #
|
388
|
+
# The {#onLButtonDown} method is called by SketchUp when the left mouse button
|
383
389
|
# is pressed. Most tools will implement this method.
|
384
390
|
#
|
385
391
|
# @example
|
@@ -406,7 +412,7 @@ class Sketchup::Tool
|
|
406
412
|
def onLButtonDown(flags, x, y, view)
|
407
413
|
end
|
408
414
|
|
409
|
-
# The #
|
415
|
+
# The {#onLButtonUp} method is called by SketchUp when the left mouse button is
|
410
416
|
# released.
|
411
417
|
#
|
412
418
|
# @example
|
@@ -433,7 +439,7 @@ class Sketchup::Tool
|
|
433
439
|
def onLButtonUp(flags, x, y, view)
|
434
440
|
end
|
435
441
|
|
436
|
-
# The #
|
442
|
+
# The {#onMButtonDoubleClick} method is called by SketchUp when the middle
|
437
443
|
# mouse button (on a three button mouse) is double-clicked.
|
438
444
|
#
|
439
445
|
# Only implement this method if you want SketchUp to react to a middle mouse
|
@@ -468,7 +474,7 @@ class Sketchup::Tool
|
|
468
474
|
def onMButtonDoubleClick(flags, x, y, view)
|
469
475
|
end
|
470
476
|
|
471
|
-
# The #
|
477
|
+
# The {#onMButtonDown} method is called by SketchUp when the middle mouse
|
472
478
|
# button (on a three button mouse) is down.
|
473
479
|
#
|
474
480
|
# The Orbit tool is activated by default when the middle mouse button is down.
|
@@ -499,7 +505,7 @@ class Sketchup::Tool
|
|
499
505
|
def onMButtonDown(flags, x, y, view)
|
500
506
|
end
|
501
507
|
|
502
|
-
# The #
|
508
|
+
# The {#onMButtonUp} method is called by SketchUp when the middle mouse button
|
503
509
|
# (on a three button mouse) is released.
|
504
510
|
#
|
505
511
|
# SketchUp returns to the previous tool from the Orbit tool when the middle
|
@@ -531,7 +537,7 @@ class Sketchup::Tool
|
|
531
537
|
def onMButtonUp(flags, x, y, view)
|
532
538
|
end
|
533
539
|
|
534
|
-
# The #
|
540
|
+
# The {#onMouseEnter} method is called by SketchUp when the mouse enters the
|
535
541
|
# viewport.
|
536
542
|
#
|
537
543
|
# @example
|
@@ -545,7 +551,7 @@ class Sketchup::Tool
|
|
545
551
|
def onMouseEnter(view)
|
546
552
|
end
|
547
553
|
|
548
|
-
# The #
|
554
|
+
# The {#onMouseLeave} method is called by SketchUp when the mouse leaves the
|
549
555
|
# viewport.
|
550
556
|
#
|
551
557
|
# @example
|
@@ -559,7 +565,7 @@ class Sketchup::Tool
|
|
559
565
|
def onMouseLeave(view)
|
560
566
|
end
|
561
567
|
|
562
|
-
# The #
|
568
|
+
# The {#onMouseMove} method is called by SketchUp whenever the mouse is moved.
|
563
569
|
# You will often want to implement this method.
|
564
570
|
#
|
565
571
|
# Try to make this method as efficient as possible because this method is
|
@@ -589,7 +595,7 @@ class Sketchup::Tool
|
|
589
595
|
def onMouseMove(flags, x, y, view)
|
590
596
|
end
|
591
597
|
|
592
|
-
# The #
|
598
|
+
# The {#onMouseWheel} method is called by SketchUp when the mouse scroll wheel
|
593
599
|
# is used.
|
594
600
|
#
|
595
601
|
# @example
|
@@ -660,7 +666,7 @@ class Sketchup::Tool
|
|
660
666
|
def onMouseWheel(flags, delta, x, y, view)
|
661
667
|
end
|
662
668
|
|
663
|
-
# The #
|
669
|
+
# The {#onRButtonDoubleClick} is called by SketchUp when the user double clicks
|
664
670
|
# with the right mouse button.
|
665
671
|
#
|
666
672
|
# @example
|
@@ -687,7 +693,7 @@ class Sketchup::Tool
|
|
687
693
|
def onRButtonDoubleClick(flags, x, y, view)
|
688
694
|
end
|
689
695
|
|
690
|
-
# The #
|
696
|
+
# The {#onRButtonDown} method is called by SketchUp when the user presses
|
691
697
|
# the right mouse button. Implement this method, along with the tool.getMenu
|
692
698
|
# method, when you want your tool to do something other than display the
|
693
699
|
# default context menu when the right mouse button is clicked.
|
@@ -716,7 +722,7 @@ class Sketchup::Tool
|
|
716
722
|
def onRButtonDown(flags, x, y, view)
|
717
723
|
end
|
718
724
|
|
719
|
-
# The #
|
725
|
+
# The {#onRButtonUp} method is called by SketchUp when the user releases the
|
720
726
|
# right mouse button.
|
721
727
|
#
|
722
728
|
# @example
|
@@ -760,7 +766,7 @@ class Sketchup::Tool
|
|
760
766
|
def onReturn(view)
|
761
767
|
end
|
762
768
|
|
763
|
-
# The #
|
769
|
+
# The {#onSetCursor} method is called by SketchUp when the tool wants to set
|
764
770
|
# the cursor.
|
765
771
|
#
|
766
772
|
# @example
|
@@ -783,7 +789,7 @@ class Sketchup::Tool
|
|
783
789
|
# def onUserText(text, view)
|
784
790
|
# @distance = text.to_l
|
785
791
|
# rescue ArgumentError
|
786
|
-
# view.
|
792
|
+
# view.tooltip = 'Invalid length'
|
787
793
|
# end
|
788
794
|
#
|
789
795
|
# @param [String] text
|
@@ -796,7 +802,7 @@ class Sketchup::Tool
|
|
796
802
|
def onUserText(text, view)
|
797
803
|
end
|
798
804
|
|
799
|
-
# The #
|
805
|
+
# The {#resume} method is called by SketchUp when the tool becomes active again
|
800
806
|
# after being suspended.
|
801
807
|
#
|
802
808
|
# @example
|
@@ -810,7 +816,7 @@ class Sketchup::Tool
|
|
810
816
|
def resume(view)
|
811
817
|
end
|
812
818
|
|
813
|
-
# The #
|
819
|
+
# The {#suspend} method is called by SketchUp when the tool temporarily becomes
|
814
820
|
# inactive because another tool has been activated. This typically happens
|
815
821
|
# when a viewing tool is activated, such as when orbit is active due to the
|
816
822
|
# middle mouse button.
|