sketchup-api-stubs 0.3.1 → 0.4.0
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 +5 -5
- data/.yardopts +7 -7
- data/SketchUp/Geom/BoundingBox.rb +7 -15
- data/SketchUp/Geom/Bounds2d.rb +18 -18
- data/SketchUp/Geom/LatLong.rb +6 -6
- data/SketchUp/Geom/OrientedBounds2d.rb +1 -1
- data/SketchUp/Geom/Point2d.rb +42 -6
- data/SketchUp/Geom/Point3d.rb +32 -21
- data/SketchUp/Geom/PolygonMesh.rb +22 -17
- data/SketchUp/Geom/Transformation.rb +35 -35
- data/SketchUp/Geom/Transformation2d.rb +153 -13
- data/SketchUp/Geom/UTM.rb +1 -1
- data/SketchUp/Geom/Vector2d.rb +45 -9
- data/SketchUp/Geom/Vector3d.rb +11 -11
- data/SketchUp/Layout.rb +1 -1
- data/SketchUp/Layout/AngularDimension.rb +25 -25
- data/SketchUp/Layout/AutoTextDefinition.rb +5 -5
- data/SketchUp/Layout/AutoTextDefinitions.rb +1 -1
- data/SketchUp/Layout/ConnectionPoint.rb +1 -1
- data/SketchUp/Layout/Document.rb +6 -5
- data/SketchUp/Layout/Ellipse.rb +1 -1
- data/SketchUp/Layout/Entities.rb +1 -1
- data/SketchUp/Layout/Entity.rb +16 -16
- data/SketchUp/Layout/FormattedText.rb +21 -21
- data/SketchUp/Layout/Grid.rb +1 -1
- data/SketchUp/Layout/Group.rb +18 -18
- data/SketchUp/Layout/Image.rb +6 -6
- data/SketchUp/Layout/Label.rb +15 -15
- data/SketchUp/Layout/Layer.rb +5 -5
- data/SketchUp/Layout/LayerInstance.rb +3 -3
- data/SketchUp/Layout/Layers.rb +1 -1
- data/SketchUp/Layout/LinearDimension.rb +25 -25
- data/SketchUp/Layout/LockedEntityError.rb +1 -1
- data/SketchUp/Layout/LockedLayerError.rb +1 -1
- data/SketchUp/Layout/Page.rb +3 -3
- data/SketchUp/Layout/PageInfo.rb +1 -1
- data/SketchUp/Layout/Pages.rb +1 -1
- data/SketchUp/Layout/Path.rb +47 -27
- data/SketchUp/Layout/Rectangle.rb +8 -8
- data/SketchUp/Layout/SketchUpModel.rb +61 -26
- data/SketchUp/Layout/Style.rb +18 -17
- data/SketchUp/Layout/Table.rb +14 -14
- data/SketchUp/Layout/TableCell.rb +5 -5
- data/SketchUp/Layout/TableColumn.rb +7 -7
- data/SketchUp/Layout/TableRow.rb +7 -7
- data/SketchUp/Sketchup/Animation.rb +1 -1
- data/SketchUp/Sketchup/AppObserver.rb +1 -1
- data/SketchUp/Sketchup/ArcCurve.rb +1 -1
- data/SketchUp/Sketchup/AttributeDictionaries.rb +1 -1
- data/SketchUp/Sketchup/AttributeDictionary.rb +7 -7
- data/SketchUp/Sketchup/Axes.rb +4 -4
- data/SketchUp/Sketchup/Behavior.rb +1 -1
- data/SketchUp/Sketchup/Camera.rb +30 -41
- data/SketchUp/Sketchup/ClassificationSchema.rb +1 -1
- data/SketchUp/Sketchup/Classifications.rb +1 -1
- data/SketchUp/Sketchup/Color.rb +1 -1
- data/SketchUp/Sketchup/ComponentDefinition.rb +3 -3
- data/SketchUp/Sketchup/ComponentInstance.rb +10 -10
- data/SketchUp/Sketchup/Console.rb +5 -5
- data/SketchUp/Sketchup/ConstructionLine.rb +11 -11
- data/SketchUp/Sketchup/ConstructionPoint.rb +1 -1
- data/SketchUp/Sketchup/Curve.rb +1 -1
- data/SketchUp/Sketchup/DefinitionList.rb +12 -9
- data/SketchUp/Sketchup/DefinitionObserver.rb +6 -7
- data/SketchUp/Sketchup/DefinitionsObserver.rb +3 -3
- data/SketchUp/Sketchup/Dimension.rb +1 -1
- data/SketchUp/Sketchup/DimensionLinear.rb +81 -1
- data/SketchUp/Sketchup/DimensionObserver.rb +1 -1
- data/SketchUp/Sketchup/DimensionRadial.rb +1 -1
- data/SketchUp/Sketchup/Drawingelement.rb +1 -1
- data/SketchUp/Sketchup/Edge.rb +13 -16
- data/SketchUp/Sketchup/EdgeUse.rb +1 -1
- data/SketchUp/Sketchup/Entities.rb +181 -100
- data/SketchUp/Sketchup/EntitiesObserver.rb +1 -1
- data/SketchUp/Sketchup/Entity.rb +29 -26
- data/SketchUp/Sketchup/EntityObserver.rb +1 -1
- data/SketchUp/Sketchup/ExtensionsManager.rb +1 -1
- data/SketchUp/Sketchup/Face.rb +7 -7
- data/SketchUp/Sketchup/FrameChangeObserver.rb +4 -4
- data/SketchUp/Sketchup/Group.rb +1 -1
- data/SketchUp/Sketchup/Http.rb +1 -1
- data/SketchUp/Sketchup/Http/Request.rb +3 -3
- data/SketchUp/Sketchup/Http/Response.rb +1 -1
- data/SketchUp/Sketchup/Image.rb +1 -1
- data/SketchUp/Sketchup/ImageRep.rb +16 -16
- data/SketchUp/Sketchup/Importer.rb +1 -1
- data/SketchUp/Sketchup/InputPoint.rb +8 -4
- data/SketchUp/Sketchup/InstanceObserver.rb +1 -1
- data/SketchUp/Sketchup/InstancePath.rb +15 -12
- data/SketchUp/Sketchup/Layer.rb +27 -1
- data/SketchUp/Sketchup/Layers.rb +1 -1
- data/SketchUp/Sketchup/LayersObserver.rb +1 -1
- data/SketchUp/Sketchup/Licensing.rb +1 -1
- data/SketchUp/Sketchup/Licensing/ExtensionLicense.rb +1 -1
- data/SketchUp/Sketchup/LineStyle.rb +24 -0
- data/SketchUp/Sketchup/LineStyles.rb +123 -0
- data/SketchUp/Sketchup/Loop.rb +1 -1
- data/SketchUp/Sketchup/Material.rb +16 -10
- data/SketchUp/Sketchup/Materials.rb +9 -1
- data/SketchUp/Sketchup/MaterialsObserver.rb +3 -3
- data/SketchUp/Sketchup/Menu.rb +1 -1
- data/SketchUp/Sketchup/Model.rb +47 -21
- data/SketchUp/Sketchup/ModelObserver.rb +3 -3
- data/SketchUp/Sketchup/OptionsManager.rb +1 -1
- data/SketchUp/Sketchup/OptionsProvider.rb +5 -5
- data/SketchUp/Sketchup/OptionsProviderObserver.rb +1 -1
- data/SketchUp/Sketchup/Page.rb +1 -1
- data/SketchUp/Sketchup/Pages.rb +13 -8
- data/SketchUp/Sketchup/PagesObserver.rb +1 -1
- data/SketchUp/Sketchup/PickHelper.rb +49 -50
- data/SketchUp/Sketchup/RegionalSettings.rb +1 -1
- data/SketchUp/Sketchup/RenderingOptions.rb +4 -4
- data/SketchUp/Sketchup/RenderingOptionsObserver.rb +3 -3
- data/SketchUp/Sketchup/SectionPlane.rb +1 -1
- data/SketchUp/Sketchup/Selection.rb +3 -3
- data/SketchUp/Sketchup/SelectionObserver.rb +3 -3
- data/SketchUp/Sketchup/Set.rb +1 -1
- data/SketchUp/Sketchup/ShadowInfo.rb +3 -3
- data/SketchUp/Sketchup/ShadowInfoObserver.rb +1 -1
- data/SketchUp/Sketchup/Style.rb +1 -1
- data/SketchUp/Sketchup/Styles.rb +1 -1
- data/SketchUp/Sketchup/Text.rb +28 -1
- data/SketchUp/Sketchup/Texture.rb +1 -1
- data/SketchUp/Sketchup/TextureWriter.rb +13 -13
- data/SketchUp/Sketchup/Tool.rb +68 -64
- data/SketchUp/Sketchup/Tools.rb +13 -1
- data/SketchUp/Sketchup/ToolsObserver.rb +13 -13
- data/SketchUp/Sketchup/UVHelper.rb +1 -1
- data/SketchUp/Sketchup/Vertex.rb +1 -1
- data/SketchUp/Sketchup/View.rb +57 -56
- data/SketchUp/Sketchup/ViewObserver.rb +2 -2
- data/SketchUp/UI/Command.rb +4 -1
- data/SketchUp/UI/HtmlDialog.rb +23 -14
- data/SketchUp/UI/Notification.rb +10 -10
- data/SketchUp/UI/Toolbar.rb +1 -1
- data/SketchUp/UI/WebDialog.rb +38 -20
- data/SketchUp/_top_level.rb +32 -34
- data/SketchUp/array.rb +125 -112
- data/SketchUp/geom.rb +2 -2
- data/SketchUp/languagehandler.rb +1 -1
- data/SketchUp/length.rb +1 -1
- data/SketchUp/numeric.rb +3 -3
- data/SketchUp/sketchup.rb +11 -11
- data/SketchUp/sketchupextension.rb +6 -2
- data/SketchUp/string.rb +1 -1
- data/SketchUp/ui.rb +14 -14
- data/autoload/sketchup.rb +2 -0
- metadata +5 -3
data/SketchUp/Sketchup/Layer.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright:: Copyright
|
|
1
|
+
# Copyright:: Copyright 2019 Trimble Inc.
|
|
2
2
|
# License:: The MIT License (MIT)
|
|
3
3
|
|
|
4
4
|
# The Layer class contains methods modifying and extracting information for a
|
|
@@ -103,6 +103,32 @@ class Sketchup::Layer < Sketchup::Entity
|
|
|
103
103
|
def color=(color)
|
|
104
104
|
end
|
|
105
105
|
|
|
106
|
+
# The {#line_style} method retrieves the line style on this layer.
|
|
107
|
+
#
|
|
108
|
+
# @example
|
|
109
|
+
# line_style = Sketchup.active_model.layers[0].line_style
|
|
110
|
+
#
|
|
111
|
+
# @return [Sketchup::LineStyle, nil] The line style retrieved.
|
|
112
|
+
#
|
|
113
|
+
# @version SketchUp 2019
|
|
114
|
+
def line_style
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# The {#line_style=} method lets you set a specific line style to a layer
|
|
118
|
+
#
|
|
119
|
+
# @example
|
|
120
|
+
# line_style = Sketchup.active_model.line_styles["Dot"]
|
|
121
|
+
# Sketchup.active_model.layers[0].line_style = line_style
|
|
122
|
+
#
|
|
123
|
+
# @param [Sketchup::LineStyle, nil] line_style
|
|
124
|
+
# The line style to set on this layer.
|
|
125
|
+
#
|
|
126
|
+
# @return [Sketchup::Layer] The layer that the line style was applied on.
|
|
127
|
+
#
|
|
128
|
+
# @version SketchUp 2019
|
|
129
|
+
def line_style=(line_style)
|
|
130
|
+
end
|
|
131
|
+
|
|
106
132
|
# The name method is used to retrieve the name of the layer.
|
|
107
133
|
#
|
|
108
134
|
# @example
|
data/SketchUp/Sketchup/Layers.rb
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Copyright:: Copyright 2019 Trimble Inc.
|
|
2
|
+
# License:: The MIT License (MIT)
|
|
3
|
+
|
|
4
|
+
# This provides a way for SketchUp to customize a line style and be set on a
|
|
5
|
+
# layer.
|
|
6
|
+
#
|
|
7
|
+
# @version SketchUp 2019
|
|
8
|
+
class Sketchup::LineStyle < Sketchup::Entity
|
|
9
|
+
|
|
10
|
+
# Instance Methods
|
|
11
|
+
|
|
12
|
+
# The {#name} method retrieves the name of the line style object.
|
|
13
|
+
#
|
|
14
|
+
# @example
|
|
15
|
+
# line_style = Sketchup.active_model.line_styles["Solid Basic"]
|
|
16
|
+
# line_style.name # returns "Solid Basic"
|
|
17
|
+
#
|
|
18
|
+
# @return [String] The name of the line style.
|
|
19
|
+
#
|
|
20
|
+
# @version SketchUp 2019
|
|
21
|
+
def name
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Copyright:: Copyright 2019 Trimble Inc.
|
|
2
|
+
# License:: The MIT License (MIT)
|
|
3
|
+
|
|
4
|
+
# Provides access to the different line style objects in the model.
|
|
5
|
+
#
|
|
6
|
+
# @version SketchUp 2019
|
|
7
|
+
class Sketchup::LineStyles < Sketchup::Entity
|
|
8
|
+
|
|
9
|
+
# Includes
|
|
10
|
+
|
|
11
|
+
include Enumerable
|
|
12
|
+
|
|
13
|
+
# Instance Methods
|
|
14
|
+
|
|
15
|
+
# The {#[]} method lets you retrieve a line style by name or index.
|
|
16
|
+
#
|
|
17
|
+
# The {#at} method is an alias of {#[]}.
|
|
18
|
+
#
|
|
19
|
+
# @example
|
|
20
|
+
# solid_style = Sketchup.active_model.line_styles["Solid Basic"]
|
|
21
|
+
# line_style = Sketchup.active_model.line_styles[1]
|
|
22
|
+
#
|
|
23
|
+
# @overload [](name)
|
|
24
|
+
#
|
|
25
|
+
# @param [String] name The name of the line style to retrieve.
|
|
26
|
+
#
|
|
27
|
+
# @overload [](index)
|
|
28
|
+
#
|
|
29
|
+
# @param [Index] index The index of the line style to retrieve.
|
|
30
|
+
#
|
|
31
|
+
# @raise [IndexError] If index is out of bounds.
|
|
32
|
+
#
|
|
33
|
+
# @return [Sketchup::LineStyle, nil] The line style retrieved. Nil if the name
|
|
34
|
+
# couldn't be retrived.
|
|
35
|
+
#
|
|
36
|
+
# @version SketchUp 2019
|
|
37
|
+
def [](arg)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# The {#[]} method lets you retrieve a line style by name or index.
|
|
41
|
+
#
|
|
42
|
+
# The {#at} method is an alias of {#[]}.
|
|
43
|
+
#
|
|
44
|
+
# @example
|
|
45
|
+
# solid_style = Sketchup.active_model.line_styles["Solid Basic"]
|
|
46
|
+
# line_style = Sketchup.active_model.line_styles[1]
|
|
47
|
+
#
|
|
48
|
+
# @overload [](name)
|
|
49
|
+
#
|
|
50
|
+
# @param [String] name The name of the line style to retrieve.
|
|
51
|
+
#
|
|
52
|
+
# @overload [](index)
|
|
53
|
+
#
|
|
54
|
+
# @param [Index] index The index of the line style to retrieve.
|
|
55
|
+
#
|
|
56
|
+
# @raise [IndexError] If index is out of bounds.
|
|
57
|
+
#
|
|
58
|
+
# @return [Sketchup::LineStyle, nil] The line style retrieved. Nil if the name
|
|
59
|
+
# couldn't be retrived.
|
|
60
|
+
#
|
|
61
|
+
# @version SketchUp 2019
|
|
62
|
+
def at(arg)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# The {#each} method is used to iterate through all the line styles.
|
|
66
|
+
#
|
|
67
|
+
# @example
|
|
68
|
+
# line_styles = Sketchup.active_model.line_styles
|
|
69
|
+
# line_styles.each{ |line_style| p line_style.name }
|
|
70
|
+
#
|
|
71
|
+
# @return [nil]
|
|
72
|
+
#
|
|
73
|
+
# @version SketchUp 2019
|
|
74
|
+
def each
|
|
75
|
+
end
|
|
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
|
+
# The {#names} method return the support line styles as strings.
|
|
90
|
+
#
|
|
91
|
+
# @example
|
|
92
|
+
# Sketchup.active_model.line_styles.names
|
|
93
|
+
#
|
|
94
|
+
# @return [Array<String>]
|
|
95
|
+
#
|
|
96
|
+
# @version SketchUp 2019
|
|
97
|
+
def names
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# The {#size} method returns the number of line styles that SketchUp supports.
|
|
101
|
+
#
|
|
102
|
+
# @example
|
|
103
|
+
# line_styles = Sketchup.active_model.line_styles
|
|
104
|
+
# line_styles.size
|
|
105
|
+
#
|
|
106
|
+
# @return [Integer] The count of line styles.
|
|
107
|
+
#
|
|
108
|
+
# @version SketchUp 2019
|
|
109
|
+
def size
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# The {#to_a} method returns an array of all the line styles.
|
|
113
|
+
#
|
|
114
|
+
# @example
|
|
115
|
+
# line_styles = Sketchup.active_active_model.line_styles.to_a
|
|
116
|
+
#
|
|
117
|
+
# @return [Array] Containing all the line style objects.
|
|
118
|
+
#
|
|
119
|
+
# @version SketchUp 2019
|
|
120
|
+
def to_a
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
end
|
data/SketchUp/Sketchup/Loop.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright:: Copyright
|
|
1
|
+
# Copyright:: Copyright 2019 Trimble Inc.
|
|
2
2
|
# License:: The MIT License (MIT)
|
|
3
3
|
|
|
4
4
|
# The Material class represents a texture or color that can be applied to
|
|
@@ -266,12 +266,18 @@ class Sketchup::Material < Sketchup::Entity
|
|
|
266
266
|
def name
|
|
267
267
|
end
|
|
268
268
|
|
|
269
|
-
#
|
|
269
|
+
# The {#name=} method sets the name of the material.
|
|
270
270
|
#
|
|
271
|
-
# @example
|
|
271
|
+
# @example Safely change name without raising errors
|
|
272
272
|
# materials = Sketchup.active_model.materials
|
|
273
273
|
# material = materials.add("Joe")
|
|
274
|
-
# material.name = 'Jeff'
|
|
274
|
+
# material.name = materials.unique_name('Jeff')
|
|
275
|
+
#
|
|
276
|
+
# @note Since SketchUp 2018 this method will raise an `ArgumentError` if the
|
|
277
|
+
# name is not unique.
|
|
278
|
+
#
|
|
279
|
+
# @note SketchUp 2018 would raise an error if you named material the name it
|
|
280
|
+
# already had.
|
|
275
281
|
#
|
|
276
282
|
# @param [String] str
|
|
277
283
|
# the new material name
|
|
@@ -337,18 +343,18 @@ class Sketchup::Material < Sketchup::Entity
|
|
|
337
343
|
# @param filename [String] The file path to the texture the material should use.
|
|
338
344
|
# @return [String]
|
|
339
345
|
#
|
|
340
|
-
# @overload texture=(image_rep)
|
|
341
|
-
#
|
|
342
|
-
# @param [Sketchup::ImageRep] image_rep The pixel data representing the
|
|
343
|
-
# texture. (Added in SketchUp 2018)
|
|
344
|
-
# @return [Sketchup::ImageRep]
|
|
345
|
-
#
|
|
346
346
|
# @overload texture=(properties)
|
|
347
347
|
#
|
|
348
348
|
# @param properties [Array(String, Integer, Integer)] An array with the
|
|
349
349
|
# texture filename and optionally the width and height in model units.
|
|
350
350
|
# @return [Array(String, Integer, Integer)]
|
|
351
351
|
#
|
|
352
|
+
# @overload texture=(image_rep)
|
|
353
|
+
#
|
|
354
|
+
# @param [Sketchup::ImageRep] image_rep The pixel data representing the
|
|
355
|
+
# texture. (Added in SketchUp 2018)
|
|
356
|
+
# @return [Sketchup::ImageRep]
|
|
357
|
+
#
|
|
352
358
|
# @version SketchUp 6.0
|
|
353
359
|
def texture=(arg)
|
|
354
360
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright:: Copyright
|
|
1
|
+
# Copyright:: Copyright 2019 Trimble Inc.
|
|
2
2
|
# License:: The MIT License (MIT)
|
|
3
3
|
|
|
4
4
|
# A collection of Materials objects. Each model contains a Materials collection
|
|
@@ -170,6 +170,10 @@ class Sketchup::Materials < Sketchup::Entity
|
|
|
170
170
|
# materials = Sketchup.active_model.materials
|
|
171
171
|
# number = materials.length
|
|
172
172
|
#
|
|
173
|
+
# @note The returned number includes {Sketchup::Image} materials as well.
|
|
174
|
+
# It will not reflect the number of materials yielded by {#each}. To get
|
|
175
|
+
# the number of non-image materials use {#count} or +materials.to_a.size+.
|
|
176
|
+
#
|
|
173
177
|
# @return [Integer]
|
|
174
178
|
#
|
|
175
179
|
# @see #size
|
|
@@ -274,6 +278,10 @@ class Sketchup::Materials < Sketchup::Entity
|
|
|
274
278
|
# materials = Sketchup.active_model.materials
|
|
275
279
|
# number = materials.size
|
|
276
280
|
#
|
|
281
|
+
# @note The returned number includes {Sketchup::Image} materials as well.
|
|
282
|
+
# It will not reflect the number of materials yielded by {#each}. To get
|
|
283
|
+
# the number of non-image materials use {#count} or +materials.to_a.size+.
|
|
284
|
+
#
|
|
277
285
|
# @return [Integer]
|
|
278
286
|
#
|
|
279
287
|
# @see #length
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright:: Copyright
|
|
1
|
+
# Copyright:: Copyright 2019 Trimble Inc.
|
|
2
2
|
# License:: The MIT License (MIT)
|
|
3
3
|
|
|
4
4
|
# This observer interface is implemented to react to materials events. To
|
|
@@ -128,10 +128,10 @@ class Sketchup::MaterialsObserver
|
|
|
128
128
|
# the {Sketchup::ModelObserver#onTransactionStart} to capture all undo
|
|
129
129
|
# events.
|
|
130
130
|
#
|
|
131
|
-
# @param [Sketchup::Material] material
|
|
132
|
-
#
|
|
133
131
|
# @param [Sketchup::Materials] materials
|
|
134
132
|
#
|
|
133
|
+
# @param [Sketchup::Material] material
|
|
134
|
+
#
|
|
135
135
|
# @return [nil]
|
|
136
136
|
#
|
|
137
137
|
# @version SketchUp 6.0
|
data/SketchUp/Sketchup/Menu.rb
CHANGED
data/SketchUp/Sketchup/Model.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright:: Copyright
|
|
1
|
+
# Copyright:: Copyright 2019 Trimble Inc.
|
|
2
2
|
# License:: The MIT License (MIT)
|
|
3
3
|
|
|
4
4
|
# This is the interface to a SketchUp model. The model is the 3D drawing that
|
|
@@ -36,6 +36,9 @@
|
|
|
36
36
|
#
|
|
37
37
|
# new_edge = entities.add_line([0,0,0], [500,500,0])
|
|
38
38
|
#
|
|
39
|
+
# @note Prior to SketchUp 2019 this class would yield +TypeError+ for all
|
|
40
|
+
# method calls if +#singleton_class+ was called on the model object.
|
|
41
|
+
#
|
|
39
42
|
# @version SketchUp 6.0
|
|
40
43
|
class Sketchup::Model
|
|
41
44
|
|
|
@@ -52,6 +55,7 @@ class Sketchup::Model
|
|
|
52
55
|
VERSION_2016 = nil # Stub value.
|
|
53
56
|
VERSION_2017 = nil # Stub value.
|
|
54
57
|
VERSION_2018 = nil # Stub value.
|
|
58
|
+
VERSION_2019 = nil # Stub value.
|
|
55
59
|
VERSION_3 = nil # Stub value.
|
|
56
60
|
VERSION_4 = nil # Stub value.
|
|
57
61
|
VERSION_5 = nil # Stub value.
|
|
@@ -174,12 +178,12 @@ class Sketchup::Model
|
|
|
174
178
|
# @param [String] note
|
|
175
179
|
# A string note.
|
|
176
180
|
#
|
|
177
|
-
# @param [Numeric] y
|
|
178
|
-
# A distance along the y axis between 0 and 1.
|
|
179
|
-
#
|
|
180
181
|
# @param [Numeric] x
|
|
181
182
|
# A distance along the x axis between 0 and 1.
|
|
182
183
|
#
|
|
184
|
+
# @param [Numeric] y
|
|
185
|
+
# A distance along the y axis between 0 and 1.
|
|
186
|
+
#
|
|
183
187
|
# @return [Sketchup::Text] a note object or an exception if it is
|
|
184
188
|
# unsuccessful.
|
|
185
189
|
#
|
|
@@ -459,7 +463,7 @@ class Sketchup::Model
|
|
|
459
463
|
# See the {file:pages/exporter_options.md Exporter Options} file for information
|
|
460
464
|
# on creating a valid hash for the various exporters.
|
|
461
465
|
#
|
|
462
|
-
# @example
|
|
466
|
+
# @example General use
|
|
463
467
|
# model = Sketchup.active_model
|
|
464
468
|
# show_summary = true
|
|
465
469
|
#
|
|
@@ -486,6 +490,14 @@ class Sketchup::Model
|
|
|
486
490
|
# :preserve_instancing => true }
|
|
487
491
|
# status = model.export('c:/my_export.dae', options_hash)
|
|
488
492
|
#
|
|
493
|
+
# @example IFC Example
|
|
494
|
+
# model = Sketchup.active_model
|
|
495
|
+
# # If no IFC types are passed in, then no geometry will be exported.
|
|
496
|
+
# options_hash = { :hidden_geometry => true,
|
|
497
|
+
# :ifc_mapped_items => true,
|
|
498
|
+
# :ifc_types => ['IfcBuilding', 'IfcDoor']}
|
|
499
|
+
# status = model.export('c:/my_export.ifc', options_hash)
|
|
500
|
+
#
|
|
489
501
|
# @overload export(filename, show_summary = false)
|
|
490
502
|
#
|
|
491
503
|
# @param [String] filename The name of the file to export.
|
|
@@ -600,13 +612,13 @@ class Sketchup::Model
|
|
|
600
612
|
# @param [String] dictname
|
|
601
613
|
# The name of the dictionary containing the value.
|
|
602
614
|
#
|
|
615
|
+
# @param [String] key
|
|
616
|
+
# The key containing the value.
|
|
617
|
+
#
|
|
603
618
|
# @param [Object] defaultvalue
|
|
604
619
|
# default value that will be returned if a
|
|
605
620
|
# value does not exist.
|
|
606
621
|
#
|
|
607
|
-
# @param [String] key
|
|
608
|
-
# The key containing the value.
|
|
609
|
-
#
|
|
610
622
|
# @return [Object, nil] the value for a given key in the given
|
|
611
623
|
# dictionary if a value exists; the default value if a
|
|
612
624
|
# defaultvalue is provided and the value does not exist;
|
|
@@ -688,7 +700,7 @@ class Sketchup::Model
|
|
|
688
700
|
# @example Import for SketchUp 2018+ and newer
|
|
689
701
|
# model = Sketchup.active_model
|
|
690
702
|
# options = { :units => "model",
|
|
691
|
-
# :
|
|
703
|
+
# :merge_coplanar_faces => true,
|
|
692
704
|
# :show_summary => true }
|
|
693
705
|
# status = model.import("filename", options)
|
|
694
706
|
#
|
|
@@ -777,6 +789,17 @@ class Sketchup::Model
|
|
|
777
789
|
def layers
|
|
778
790
|
end
|
|
779
791
|
|
|
792
|
+
# The {#line_styles} method returns the line styles manager.
|
|
793
|
+
#
|
|
794
|
+
# @example
|
|
795
|
+
# line_styles = Sketchup.active_model.line_styles
|
|
796
|
+
#
|
|
797
|
+
# @return [Sketchup::LineStyles] The line styles manager.
|
|
798
|
+
#
|
|
799
|
+
# @version SketchUp 2019
|
|
800
|
+
def line_styles
|
|
801
|
+
end
|
|
802
|
+
|
|
780
803
|
# This method retrieves an Array of all of the datums recognized by SketchUp.
|
|
781
804
|
#
|
|
782
805
|
# @example
|
|
@@ -1089,6 +1112,9 @@ class Sketchup::Model
|
|
|
1089
1112
|
# filename = File.join(ENV['Home'], 'Desktop', 'mysketchup_v8.skp')
|
|
1090
1113
|
# status = model.save("filename", Sketchup::Model::VERSION_8)
|
|
1091
1114
|
#
|
|
1115
|
+
# @note A bug in SketchUp 2016 and older caused the +.skb+ backup file
|
|
1116
|
+
# written during save to be empty. The +.skp+ file was however valid.
|
|
1117
|
+
#
|
|
1092
1118
|
# @overload save
|
|
1093
1119
|
#
|
|
1094
1120
|
# Starting with SketchUp 2014, this parameter is optional.
|
|
@@ -1239,12 +1265,12 @@ class Sketchup::Model
|
|
|
1239
1265
|
# The name of the attribute dictionary whose attribute
|
|
1240
1266
|
# you wish to set.
|
|
1241
1267
|
#
|
|
1242
|
-
# @param [Object] value
|
|
1243
|
-
# The value to set.
|
|
1244
|
-
#
|
|
1245
1268
|
# @param [String] key
|
|
1246
1269
|
# The attribute name.
|
|
1247
1270
|
#
|
|
1271
|
+
# @param [Object] value
|
|
1272
|
+
# The value to set.
|
|
1273
|
+
#
|
|
1248
1274
|
# @return [Object] the value that was set
|
|
1249
1275
|
#
|
|
1250
1276
|
# @version SketchUp 6.0
|
|
@@ -1321,6 +1347,15 @@ class Sketchup::Model
|
|
|
1321
1347
|
# new Ruby operation while another is still open, you will implicitly close
|
|
1322
1348
|
# the first one.
|
|
1323
1349
|
#
|
|
1350
|
+
# @param [String] op_name
|
|
1351
|
+
# name of the operation visible in the UI
|
|
1352
|
+
#
|
|
1353
|
+
# @param [Boolean] disable_ui
|
|
1354
|
+
# if set to true, then SketchUp's tendency to
|
|
1355
|
+
# update the user interface after each geometry change will be
|
|
1356
|
+
# suppressed. This can result in much faster Ruby code execution if the
|
|
1357
|
+
# operation involves updating the model in any way.
|
|
1358
|
+
#
|
|
1324
1359
|
# @param [Boolean] next_transparent
|
|
1325
1360
|
# <b>Deprecated!</b> if set to true, then
|
|
1326
1361
|
# whatever operation comes after this one will be appended into one
|
|
@@ -1330,15 +1365,6 @@ class Sketchup::Model
|
|
|
1330
1365
|
# with one of their own. <b>Use extreme caution</b> and test thoroughly
|
|
1331
1366
|
# when setting this to true.
|
|
1332
1367
|
#
|
|
1333
|
-
# @param [Boolean] disable_ui
|
|
1334
|
-
# if set to true, then SketchUp's tendency to
|
|
1335
|
-
# update the user interface after each geometry change will be
|
|
1336
|
-
# suppressed. This can result in much faster Ruby code execution if the
|
|
1337
|
-
# operation involves updating the model in any way.
|
|
1338
|
-
#
|
|
1339
|
-
# @param [String] op_name
|
|
1340
|
-
# name of the operation visible in the UI
|
|
1341
|
-
#
|
|
1342
1368
|
# @param [Boolean] transparent
|
|
1343
1369
|
# if set to true, then this operation will
|
|
1344
1370
|
# append to the previous operation. This is particularly useful for
|