sketchup-api-stubs 0.7.9 → 0.7.11
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 +157 -151
- data/lib/sketchup-api-stubs/stubs/Array.rb +741 -741
- data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +322 -322
- data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +182 -172
- data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +111 -126
- data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
- data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +423 -400
- data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +693 -661
- data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +535 -509
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +500 -476
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +267 -263
- data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +133 -141
- data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +547 -522
- data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +678 -693
- data/lib/sketchup-api-stubs/stubs/Geom.rb +351 -351
- data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +93 -93
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +595 -595
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +751 -747
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +183 -183
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
- data/lib/sketchup-api-stubs/stubs/Layout/Dictionary.rb +234 -0
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +683 -517
- data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
- data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +148 -148
- data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +464 -353
- data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +354 -354
- data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -311
- data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
- data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -91
- data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +370 -370
- data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +218 -218
- data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +128 -128
- data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +225 -225
- data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +614 -567
- data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +10 -10
- data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +11 -11
- data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +282 -183
- data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +458 -387
- data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +209 -209
- data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +346 -344
- data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +174 -174
- data/lib/sketchup-api-stubs/stubs/Layout/ReferenceEntity.rb +82 -82
- data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +714 -692
- data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1565 -1519
- data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
- data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
- data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
- data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
- data/lib/sketchup-api-stubs/stubs/Length.rb +286 -278
- data/lib/sketchup-api-stubs/stubs/Numeric.rb +249 -249
- data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +196 -144
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +169 -169
- data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +226 -209
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +145 -150
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +294 -281
- data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +296 -302
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +473 -478
- data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
- data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +121 -121
- data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +294 -294
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +673 -659
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +600 -593
- data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +252 -257
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
- data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +201 -201
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +443 -449
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +74 -74
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +104 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +167 -165
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +306 -306
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +42 -42
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
- data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +403 -406
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +397 -397
- data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1282 -1239
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +261 -261
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -127
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +519 -545
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -60
- data/lib/sketchup-api-stubs/stubs/Sketchup/Environment.rb +406 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Environments.rb +185 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/EnvironmentsObserver.rb +113 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +122 -125
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +1006 -937
- data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +102 -102
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +740 -750
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +289 -282
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +64 -62
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
- data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +405 -468
- data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +266 -266
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +189 -189
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +432 -406
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +84 -84
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +307 -306
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +332 -326
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +380 -422
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +409 -427
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +241 -249
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +55 -48
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +114 -114
- data/lib/sketchup-api-stubs/stubs/Sketchup/LoadHandler.rb +70 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +1115 -414
- data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +330 -317
- data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +93 -93
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1714 -1652
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +372 -357
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +133 -130
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +271 -271
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
- data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +463 -490
- data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +104 -116
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +939 -797
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +388 -361
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -77
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +501 -478
- data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +385 -361
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +45 -45
- data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +451 -458
- data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
- data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +211 -212
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +259 -255
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +59 -59
- data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -40
- data/lib/sketchup-api-stubs/stubs/Sketchup/Snap.rb +125 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +88 -69
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +263 -217
- data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +283 -262
- data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +199 -217
- data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +924 -834
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +156 -156
- data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +75 -75
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +143 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1566 -1311
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +71 -45
- data/lib/sketchup-api-stubs/stubs/Sketchup.rb +1429 -1377
- data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/String.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +399 -389
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +580 -494
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +280 -269
- data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +258 -241
- data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +636 -635
- data/lib/sketchup-api-stubs/stubs/UI.rb +791 -683
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +303 -303
- data/lib/sketchup-api-stubs.rb +1 -1
- metadata +10 -24
|
@@ -1,517 +1,683 @@
|
|
|
1
|
-
# Copyright:: Copyright
|
|
2
|
-
# License:: The MIT License (MIT)
|
|
3
|
-
|
|
4
|
-
# This is the interface to a LayOut document. A {Layout::Document} is the 2D
|
|
5
|
-
# drawing that the user is working with, and it serves as the "entry point" for
|
|
6
|
-
# most Ruby API interactions. The {Layout::Document.open} method gives you a
|
|
7
|
-
# handle to a {Layout::Document}, and from there you can use the
|
|
8
|
-
# document-level methods to start getting information and making changes.
|
|
9
|
-
#
|
|
10
|
-
# @example
|
|
11
|
-
# # Grab a handle to an existing LayOut document.
|
|
12
|
-
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
13
|
-
#
|
|
14
|
-
# # Grab other handles to commonly used collections inside the model.
|
|
15
|
-
# layers = doc.layers
|
|
16
|
-
# pages = doc.pages
|
|
17
|
-
# entities = doc.shared_entities
|
|
18
|
-
#
|
|
19
|
-
# # Now that we have our handles, we can start pulling objects and making
|
|
20
|
-
# # method calls that are useful.
|
|
21
|
-
# first_entity = entities[0]
|
|
22
|
-
#
|
|
23
|
-
# number_pages = pages.count
|
|
24
|
-
#
|
|
25
|
-
# @version LayOut 2018
|
|
26
|
-
class Layout::Document
|
|
27
|
-
|
|
28
|
-
# Constants
|
|
29
|
-
|
|
30
|
-
DECIMAL_CENTIMETERS = nil # Stub value.
|
|
31
|
-
DECIMAL_FEET = nil # Stub value.
|
|
32
|
-
DECIMAL_INCHES = nil # Stub value.
|
|
33
|
-
DECIMAL_METERS = nil # Stub value.
|
|
34
|
-
DECIMAL_MILLIMETERS = nil # Stub value.
|
|
35
|
-
DECIMAL_POINTS = nil # Stub value.
|
|
36
|
-
|
|
37
|
-
FRACTIONAL_INCHES = nil # Stub value.
|
|
38
|
-
|
|
39
|
-
VERSION_1 = nil # Stub value.
|
|
40
|
-
VERSION_2 = nil # Stub value.
|
|
41
|
-
VERSION_2013 = nil # Stub value.
|
|
42
|
-
VERSION_2014 = nil # Stub value.
|
|
43
|
-
VERSION_2015 = nil # Stub value.
|
|
44
|
-
VERSION_2016 = nil # Stub value.
|
|
45
|
-
VERSION_2017 = nil # Stub value.
|
|
46
|
-
VERSION_2018 = nil # Stub value.
|
|
47
|
-
VERSION_2019 = nil # Stub value.
|
|
48
|
-
VERSION_2020 = nil # Stub value.
|
|
49
|
-
VERSION_2021 = nil # Stub value.
|
|
50
|
-
VERSION_2022 = nil # Stub value.
|
|
51
|
-
VERSION_2023 = nil # Stub value.
|
|
52
|
-
VERSION_3 = nil # Stub value.
|
|
53
|
-
VERSION_CURRENT = nil # Stub value.
|
|
54
|
-
|
|
55
|
-
# Class Methods
|
|
56
|
-
|
|
57
|
-
# The {.open} method creates a new {Layout::Document} by loading an existing
|
|
58
|
-
# .layout file.
|
|
59
|
-
#
|
|
60
|
-
# @example
|
|
61
|
-
# filename = File.join(ENV['Home'], 'Desktop', 'template.layout')
|
|
62
|
-
# doc = Layout::Document.open(filename)
|
|
63
|
-
#
|
|
64
|
-
# @param [String] path
|
|
65
|
-
# The path to the .layout file on disk.
|
|
66
|
-
#
|
|
67
|
-
# @raise [ArgumentError] if the file does not exist
|
|
68
|
-
#
|
|
69
|
-
# @return [Layout::Document] The {Layout::Document} created from the .layout
|
|
70
|
-
# file.
|
|
71
|
-
#
|
|
72
|
-
# @version LayOut 2018
|
|
73
|
-
def self.open(path)
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
# Instance Methods
|
|
77
|
-
|
|
78
|
-
# The {#==} method checks to see if the two {Layout::Document}s are equal.
|
|
79
|
-
# This checks whether the Ruby Objects are pointing to the same internal
|
|
80
|
-
# object.
|
|
81
|
-
#
|
|
82
|
-
# @example
|
|
83
|
-
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
84
|
-
# document = doc.pages.first.document
|
|
85
|
-
# doc == document
|
|
86
|
-
#
|
|
87
|
-
# @param [Layout::Document] other
|
|
88
|
-
#
|
|
89
|
-
# @return [Boolean]
|
|
90
|
-
#
|
|
91
|
-
# @version LayOut 2018
|
|
92
|
-
def ==(other)
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
# The {#add_entity} method adds an {Layout::Entity} to the {Layout::Document}
|
|
96
|
-
# and places it on the given {Layout::Layer} and {Layout::Page}. If layer is a
|
|
97
|
-
# shared {Layout::Layer} then page may be ommitted. The {Layout::Entity} must
|
|
98
|
-
# not already belong to a {Layout::Document}. If the {Layout::Entity} is a
|
|
99
|
-
# {Layout::Group}, then the {Layout::Group} along with all of its children will
|
|
100
|
-
# be added to the {Layout::Document}.
|
|
101
|
-
#
|
|
102
|
-
# @example
|
|
103
|
-
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
104
|
-
# rect = Layout::Rectangle.new([[1, 1], [2, 2]])
|
|
105
|
-
# all_layers = doc.layers
|
|
106
|
-
# all_pages = doc.pages
|
|
107
|
-
# doc.add_entity(rect, all_layers.first, all_pages.first)
|
|
108
|
-
#
|
|
109
|
-
# @overload add_entity(entity, layer, page)
|
|
110
|
-
#
|
|
111
|
-
# @param [Layout::Entity] entity The {Layout::Entity} to be added
|
|
112
|
-
# @param [Layout::Layer] layer The {Layout::Layer} to add the
|
|
113
|
-
# {Layout::Entity} to
|
|
114
|
-
# @param [Layout::Page] page The {Layout::Page} to add the {Layout::Entity}
|
|
115
|
-
# to
|
|
116
|
-
#
|
|
117
|
-
# @overload add_entity(entity, layer)
|
|
118
|
-
#
|
|
119
|
-
# @param [Layout::Entity] entity The {Layout::Entity} to be added
|
|
120
|
-
# @param [Layout::Layer] layer The shared {Layout::Layer} to add the
|
|
121
|
-
# {Layout::Entity} to
|
|
122
|
-
#
|
|
123
|
-
# @raise [ArgumentError] if no {Layout::Page} is passed in and layer is
|
|
124
|
-
# non-shared
|
|
125
|
-
#
|
|
126
|
-
# @raise [ArgumentError] if page does not belong to the {Layout::Document}
|
|
127
|
-
#
|
|
128
|
-
# @raise [ArgumentError] if layer does not belong to the {Layout::Document}
|
|
129
|
-
#
|
|
130
|
-
# @raise [ArgumentError] if entity already belongs to a {Layout::Document}
|
|
131
|
-
#
|
|
132
|
-
# @
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
#
|
|
139
|
-
#
|
|
140
|
-
#
|
|
141
|
-
#
|
|
142
|
-
#
|
|
143
|
-
# @
|
|
144
|
-
#
|
|
145
|
-
#
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
#
|
|
150
|
-
#
|
|
151
|
-
#
|
|
152
|
-
#
|
|
153
|
-
#
|
|
154
|
-
#
|
|
155
|
-
#
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
#
|
|
160
|
-
#
|
|
161
|
-
#
|
|
162
|
-
#
|
|
163
|
-
#
|
|
164
|
-
#
|
|
165
|
-
#
|
|
166
|
-
#
|
|
167
|
-
#
|
|
168
|
-
#
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
#
|
|
173
|
-
#
|
|
174
|
-
#
|
|
175
|
-
#
|
|
176
|
-
#
|
|
177
|
-
#
|
|
178
|
-
#
|
|
179
|
-
#
|
|
180
|
-
#
|
|
181
|
-
#
|
|
182
|
-
#
|
|
183
|
-
#
|
|
184
|
-
#
|
|
185
|
-
#
|
|
186
|
-
#
|
|
187
|
-
#
|
|
188
|
-
#
|
|
189
|
-
#
|
|
190
|
-
#
|
|
191
|
-
#
|
|
192
|
-
#
|
|
193
|
-
#
|
|
194
|
-
#
|
|
195
|
-
#
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
#
|
|
200
|
-
#
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
#
|
|
205
|
-
#
|
|
206
|
-
# @example
|
|
207
|
-
# doc = Layout::Document.open("
|
|
208
|
-
#
|
|
209
|
-
#
|
|
210
|
-
#
|
|
211
|
-
#
|
|
212
|
-
#
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
#
|
|
217
|
-
#
|
|
218
|
-
#
|
|
219
|
-
#
|
|
220
|
-
# doc
|
|
221
|
-
#
|
|
222
|
-
#
|
|
223
|
-
#
|
|
224
|
-
#
|
|
225
|
-
#
|
|
226
|
-
#
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
#
|
|
231
|
-
#
|
|
232
|
-
#
|
|
233
|
-
#
|
|
234
|
-
#
|
|
235
|
-
#
|
|
236
|
-
#
|
|
237
|
-
#
|
|
238
|
-
#
|
|
239
|
-
#
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
#
|
|
244
|
-
#
|
|
245
|
-
#
|
|
246
|
-
#
|
|
247
|
-
#
|
|
248
|
-
#
|
|
249
|
-
#
|
|
250
|
-
#
|
|
251
|
-
#
|
|
252
|
-
#
|
|
253
|
-
#
|
|
254
|
-
#
|
|
255
|
-
#
|
|
256
|
-
# @
|
|
257
|
-
#
|
|
258
|
-
#
|
|
259
|
-
#
|
|
260
|
-
#
|
|
261
|
-
#
|
|
262
|
-
#
|
|
263
|
-
# @
|
|
264
|
-
#
|
|
265
|
-
#
|
|
266
|
-
#
|
|
267
|
-
#
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
#
|
|
272
|
-
#
|
|
273
|
-
# @
|
|
274
|
-
#
|
|
275
|
-
#
|
|
276
|
-
#
|
|
277
|
-
#
|
|
278
|
-
#
|
|
279
|
-
#
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
#
|
|
284
|
-
#
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
#
|
|
289
|
-
#
|
|
290
|
-
#
|
|
291
|
-
#
|
|
292
|
-
#
|
|
293
|
-
#
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
#
|
|
298
|
-
#
|
|
299
|
-
#
|
|
300
|
-
#
|
|
301
|
-
# doc
|
|
302
|
-
#
|
|
303
|
-
#
|
|
304
|
-
#
|
|
305
|
-
#
|
|
306
|
-
# @
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
#
|
|
311
|
-
#
|
|
312
|
-
#
|
|
313
|
-
# @
|
|
314
|
-
#
|
|
315
|
-
#
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
#
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
#
|
|
324
|
-
#
|
|
325
|
-
#
|
|
326
|
-
#
|
|
327
|
-
#
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
#
|
|
332
|
-
#
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
#
|
|
337
|
-
#
|
|
338
|
-
#
|
|
339
|
-
#
|
|
340
|
-
#
|
|
341
|
-
#
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
#
|
|
346
|
-
#
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
#
|
|
351
|
-
#
|
|
352
|
-
# @
|
|
353
|
-
#
|
|
354
|
-
#
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
#
|
|
359
|
-
#
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
#
|
|
364
|
-
#
|
|
365
|
-
#
|
|
366
|
-
#
|
|
367
|
-
#
|
|
368
|
-
#
|
|
369
|
-
#
|
|
370
|
-
#
|
|
371
|
-
#
|
|
372
|
-
#
|
|
373
|
-
#
|
|
374
|
-
#
|
|
375
|
-
#
|
|
376
|
-
#
|
|
377
|
-
#
|
|
378
|
-
# @
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
#
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
#
|
|
387
|
-
#
|
|
388
|
-
#
|
|
389
|
-
#
|
|
390
|
-
# doc.
|
|
391
|
-
#
|
|
392
|
-
# @
|
|
393
|
-
#
|
|
394
|
-
#
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
#
|
|
402
|
-
#
|
|
403
|
-
#
|
|
404
|
-
#
|
|
405
|
-
# @
|
|
406
|
-
#
|
|
407
|
-
#
|
|
408
|
-
#
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
#
|
|
413
|
-
#
|
|
414
|
-
#
|
|
415
|
-
#
|
|
416
|
-
#
|
|
417
|
-
#
|
|
418
|
-
#
|
|
419
|
-
#
|
|
420
|
-
#
|
|
421
|
-
#
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
#
|
|
426
|
-
#
|
|
427
|
-
#
|
|
428
|
-
# @
|
|
429
|
-
#
|
|
430
|
-
#
|
|
431
|
-
#
|
|
432
|
-
#
|
|
433
|
-
#
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
#
|
|
439
|
-
#
|
|
440
|
-
#
|
|
441
|
-
#
|
|
442
|
-
#
|
|
443
|
-
#
|
|
444
|
-
#
|
|
445
|
-
#
|
|
446
|
-
#
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
#
|
|
452
|
-
#
|
|
453
|
-
#
|
|
454
|
-
#
|
|
455
|
-
#
|
|
456
|
-
#
|
|
457
|
-
#
|
|
458
|
-
#
|
|
459
|
-
# @
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
#
|
|
466
|
-
#
|
|
467
|
-
#
|
|
468
|
-
#
|
|
469
|
-
#
|
|
470
|
-
#
|
|
471
|
-
#
|
|
472
|
-
#
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
#
|
|
479
|
-
#
|
|
480
|
-
#
|
|
481
|
-
#
|
|
482
|
-
#
|
|
483
|
-
#
|
|
484
|
-
#
|
|
485
|
-
#
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
#
|
|
490
|
-
#
|
|
491
|
-
#
|
|
492
|
-
#
|
|
493
|
-
#
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
#
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
#
|
|
502
|
-
#
|
|
503
|
-
#
|
|
504
|
-
#
|
|
505
|
-
#
|
|
506
|
-
#
|
|
507
|
-
#
|
|
508
|
-
#
|
|
509
|
-
#
|
|
510
|
-
#
|
|
511
|
-
#
|
|
512
|
-
#
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
1
|
+
# Copyright:: Copyright 2026 Trimble Inc.
|
|
2
|
+
# License:: The MIT License (MIT)
|
|
3
|
+
|
|
4
|
+
# This is the interface to a LayOut document. A {Layout::Document} is the 2D
|
|
5
|
+
# drawing that the user is working with, and it serves as the "entry point" for
|
|
6
|
+
# most Ruby API interactions. The {Layout::Document.open} method gives you a
|
|
7
|
+
# handle to a {Layout::Document}, and from there you can use the
|
|
8
|
+
# document-level methods to start getting information and making changes.
|
|
9
|
+
#
|
|
10
|
+
# @example
|
|
11
|
+
# # Grab a handle to an existing LayOut document.
|
|
12
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
13
|
+
#
|
|
14
|
+
# # Grab other handles to commonly used collections inside the model.
|
|
15
|
+
# layers = doc.layers
|
|
16
|
+
# pages = doc.pages
|
|
17
|
+
# entities = doc.shared_entities
|
|
18
|
+
#
|
|
19
|
+
# # Now that we have our handles, we can start pulling objects and making
|
|
20
|
+
# # method calls that are useful.
|
|
21
|
+
# first_entity = entities[0]
|
|
22
|
+
#
|
|
23
|
+
# number_pages = pages.count
|
|
24
|
+
#
|
|
25
|
+
# @version LayOut 2018
|
|
26
|
+
class Layout::Document
|
|
27
|
+
|
|
28
|
+
# Constants
|
|
29
|
+
|
|
30
|
+
DECIMAL_CENTIMETERS = nil # Stub value.
|
|
31
|
+
DECIMAL_FEET = nil # Stub value.
|
|
32
|
+
DECIMAL_INCHES = nil # Stub value.
|
|
33
|
+
DECIMAL_METERS = nil # Stub value.
|
|
34
|
+
DECIMAL_MILLIMETERS = nil # Stub value.
|
|
35
|
+
DECIMAL_POINTS = nil # Stub value.
|
|
36
|
+
|
|
37
|
+
FRACTIONAL_INCHES = nil # Stub value.
|
|
38
|
+
|
|
39
|
+
VERSION_1 = nil # Stub value.
|
|
40
|
+
VERSION_2 = nil # Stub value.
|
|
41
|
+
VERSION_2013 = nil # Stub value.
|
|
42
|
+
VERSION_2014 = nil # Stub value.
|
|
43
|
+
VERSION_2015 = nil # Stub value.
|
|
44
|
+
VERSION_2016 = nil # Stub value.
|
|
45
|
+
VERSION_2017 = nil # Stub value.
|
|
46
|
+
VERSION_2018 = nil # Stub value.
|
|
47
|
+
VERSION_2019 = nil # Stub value.
|
|
48
|
+
VERSION_2020 = nil # Stub value.
|
|
49
|
+
VERSION_2021 = nil # Stub value.
|
|
50
|
+
VERSION_2022 = nil # Stub value.
|
|
51
|
+
VERSION_2023 = nil # Stub value.
|
|
52
|
+
VERSION_3 = nil # Stub value.
|
|
53
|
+
VERSION_CURRENT = nil # Stub value.
|
|
54
|
+
|
|
55
|
+
# Class Methods
|
|
56
|
+
|
|
57
|
+
# The {.open} method creates a new {Layout::Document} by loading an existing
|
|
58
|
+
# .layout file.
|
|
59
|
+
#
|
|
60
|
+
# @example
|
|
61
|
+
# filename = File.join(ENV['Home'], 'Desktop', 'template.layout')
|
|
62
|
+
# doc = Layout::Document.open(filename)
|
|
63
|
+
#
|
|
64
|
+
# @param [String] path
|
|
65
|
+
# The path to the .layout file on disk.
|
|
66
|
+
#
|
|
67
|
+
# @raise [ArgumentError] if the file does not exist
|
|
68
|
+
#
|
|
69
|
+
# @return [Layout::Document] The {Layout::Document} created from the .layout
|
|
70
|
+
# file.
|
|
71
|
+
#
|
|
72
|
+
# @version LayOut 2018
|
|
73
|
+
def self.open(path)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Instance Methods
|
|
77
|
+
|
|
78
|
+
# The {#==} method checks to see if the two {Layout::Document}s are equal.
|
|
79
|
+
# This checks whether the Ruby Objects are pointing to the same internal
|
|
80
|
+
# object.
|
|
81
|
+
#
|
|
82
|
+
# @example
|
|
83
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
84
|
+
# document = doc.pages.first.document
|
|
85
|
+
# doc == document
|
|
86
|
+
#
|
|
87
|
+
# @param [Layout::Document] other
|
|
88
|
+
#
|
|
89
|
+
# @return [Boolean]
|
|
90
|
+
#
|
|
91
|
+
# @version LayOut 2018
|
|
92
|
+
def ==(other)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# The {#add_entity} method adds an {Layout::Entity} to the {Layout::Document}
|
|
96
|
+
# and places it on the given {Layout::Layer} and {Layout::Page}. If layer is a
|
|
97
|
+
# shared {Layout::Layer} then page may be ommitted. The {Layout::Entity} must
|
|
98
|
+
# not already belong to a {Layout::Document}. If the {Layout::Entity} is a
|
|
99
|
+
# {Layout::Group}, then the {Layout::Group} along with all of its children will
|
|
100
|
+
# be added to the {Layout::Document}.
|
|
101
|
+
#
|
|
102
|
+
# @example
|
|
103
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
104
|
+
# rect = Layout::Rectangle.new([[1, 1], [2, 2]])
|
|
105
|
+
# all_layers = doc.layers
|
|
106
|
+
# all_pages = doc.pages
|
|
107
|
+
# doc.add_entity(rect, all_layers.first, all_pages.first)
|
|
108
|
+
#
|
|
109
|
+
# @overload add_entity(entity, layer, page)
|
|
110
|
+
#
|
|
111
|
+
# @param [Layout::Entity] entity The {Layout::Entity} to be added
|
|
112
|
+
# @param [Layout::Layer] layer The {Layout::Layer} to add the
|
|
113
|
+
# {Layout::Entity} to
|
|
114
|
+
# @param [Layout::Page] page The {Layout::Page} to add the {Layout::Entity}
|
|
115
|
+
# to
|
|
116
|
+
#
|
|
117
|
+
# @overload add_entity(entity, layer)
|
|
118
|
+
#
|
|
119
|
+
# @param [Layout::Entity] entity The {Layout::Entity} to be added
|
|
120
|
+
# @param [Layout::Layer] layer The shared {Layout::Layer} to add the
|
|
121
|
+
# {Layout::Entity} to
|
|
122
|
+
#
|
|
123
|
+
# @raise [ArgumentError] if no {Layout::Page} is passed in and layer is
|
|
124
|
+
# non-shared
|
|
125
|
+
#
|
|
126
|
+
# @raise [ArgumentError] if page does not belong to the {Layout::Document}
|
|
127
|
+
#
|
|
128
|
+
# @raise [ArgumentError] if layer does not belong to the {Layout::Document}
|
|
129
|
+
#
|
|
130
|
+
# @raise [ArgumentError] if entity already belongs to a {Layout::Document}
|
|
131
|
+
#
|
|
132
|
+
# @return [Layout::Entity] The {Layout::Entity} that was added to the {Layout::Document}.
|
|
133
|
+
#
|
|
134
|
+
# @version LayOut 2018
|
|
135
|
+
def add_entity(*args)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# The {#attribute_dictionary} method returns a copy of the document's attribute dictionary with the
|
|
139
|
+
# given name.
|
|
140
|
+
#
|
|
141
|
+
# is no attribute dictionary
|
|
142
|
+
#
|
|
143
|
+
# @example
|
|
144
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
145
|
+
# doc.set_attribute("jane_doe_doc_maker", "made_by_doc_maker", true)
|
|
146
|
+
# attributes = doc.attribute_dictionary("jane_doe_doc_maker")
|
|
147
|
+
# # Adding to this Layout::Dictionary does not apply to the document's attribute dictionary, use
|
|
148
|
+
# #Layout::Document#set_attribute.
|
|
149
|
+
# attributes.merge!(doc_id: 42)
|
|
150
|
+
#
|
|
151
|
+
# @param [String] name
|
|
152
|
+
#
|
|
153
|
+
# @return [Layout::Dictionary, nil] A copy of the document's attribute dictionary, or nil if there
|
|
154
|
+
#
|
|
155
|
+
# @version LayOut 2026.0
|
|
156
|
+
def attribute_dictionary(name)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# The {#auto_text_definitions} method returns an array of
|
|
160
|
+
# {Layout::AutoTextDefinition}'s in the {Layout::Document}.
|
|
161
|
+
#
|
|
162
|
+
# @example
|
|
163
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
164
|
+
# defs = doc.auto_text_definitions
|
|
165
|
+
#
|
|
166
|
+
# @return [Layout::AutoTextDefinitions]
|
|
167
|
+
#
|
|
168
|
+
# @version LayOut 2018
|
|
169
|
+
def auto_text_definitions
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# The {#delete_attribute} method is used to delete an attribute from a document.
|
|
173
|
+
#
|
|
174
|
+
# @overload delete_attribute(dictionary_name)
|
|
175
|
+
#
|
|
176
|
+
# @param [String] dictionary_name The name of an attribute dictionary.
|
|
177
|
+
# @return [Boolean]
|
|
178
|
+
#
|
|
179
|
+
# @example
|
|
180
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
181
|
+
# doc.set_attribute("jane_doe_doc_maker", "made_by_doc_maker", true)
|
|
182
|
+
# doc.delete_attribute("jane_doe_doc_maker")
|
|
183
|
+
#
|
|
184
|
+
# @overload delete_attribute(dictionary_name, key)
|
|
185
|
+
#
|
|
186
|
+
# @param [String] dictionary_name The name of an attribute dictionary.
|
|
187
|
+
# @param [String] key An attribute key.
|
|
188
|
+
# @return [Boolean]
|
|
189
|
+
#
|
|
190
|
+
# @example
|
|
191
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
192
|
+
# doc.set_attribute("jane_doe_doc_maker", "made_by_doc_maker", true)
|
|
193
|
+
# doc.delete_attribute("jane_doe_doc_maker", "made_by_doc_maker")
|
|
194
|
+
#
|
|
195
|
+
# @version LayOut 2026.0
|
|
196
|
+
def delete_attribute(*args)
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# The {#export} method exports the {Layout::Document} to a given file format.
|
|
200
|
+
# It knows which format to export based on the file extension you place on the
|
|
201
|
+
# file name. For example, a filename of "thing.pdf" will export a PDF file,
|
|
202
|
+
# whereas "thing.png" will export a set of PNG images.
|
|
203
|
+
#
|
|
204
|
+
# For LayOut version 2020.1, valid extensions include .pdf, .jpg, and .png.
|
|
205
|
+
#
|
|
206
|
+
# @example PDF Export Examples
|
|
207
|
+
# doc = Layout::Document.open("c:/path/to/document.layout")
|
|
208
|
+
#
|
|
209
|
+
# # Export pdf file on a PC, with default settings.
|
|
210
|
+
# doc.export("c:/my_export.pdf")
|
|
211
|
+
#
|
|
212
|
+
# # Export pages one through three at high quality, compressing jpeg images
|
|
213
|
+
# # at 0.75 compression quality (valid range is 0.0 - 1.0). Note that the
|
|
214
|
+
# # first page of a {Layout::Document} is index 0.
|
|
215
|
+
# options = { start_page: 1,
|
|
216
|
+
# end_page: 3,
|
|
217
|
+
# compress_images: true,
|
|
218
|
+
# compress_quality: 0.75 }
|
|
219
|
+
#
|
|
220
|
+
# doc.export("c:/my_export.pdf", options)
|
|
221
|
+
#
|
|
222
|
+
# # Export pages one and three through five. Note that page_range starts at
|
|
223
|
+
# # index 1.
|
|
224
|
+
# # `page_range` support added in LayOut 2024.0.
|
|
225
|
+
# options = { page_range: "1,3-5",
|
|
226
|
+
# compress_images: true,
|
|
227
|
+
# compress_quality: 0.75 }
|
|
228
|
+
#
|
|
229
|
+
# doc.export("c:/my_export.pdf", options)
|
|
230
|
+
#
|
|
231
|
+
# @example Image Set Export Examples
|
|
232
|
+
# doc = Layout::Document.open("c:/path/to/document.layout")
|
|
233
|
+
#
|
|
234
|
+
# # Export png files on macOS, with default settings.
|
|
235
|
+
# doc.export("/Users/<username>/Desktop/pngs/page.png")
|
|
236
|
+
#
|
|
237
|
+
# # Export pages one through three at 300 dpi as JPGs.
|
|
238
|
+
# options = { start_page: 1,
|
|
239
|
+
# end_page: 3,
|
|
240
|
+
# dpi: 300 }
|
|
241
|
+
# doc.export('c:/page.jpg', options)
|
|
242
|
+
#
|
|
243
|
+
# # Export pages one and three through five. Note that page_range starts at
|
|
244
|
+
# # index 1.
|
|
245
|
+
# # `page_range` support added in LayOut 2024.0.
|
|
246
|
+
# options = { page_range: "1,3-5",
|
|
247
|
+
# compress_images: true,
|
|
248
|
+
# compress_quality: 0.75 }
|
|
249
|
+
#
|
|
250
|
+
# doc.export("c:/my_export.png", options)
|
|
251
|
+
#
|
|
252
|
+
# @option options [Integer] :start_page The first page to export.
|
|
253
|
+
#
|
|
254
|
+
# @option options [Integer] :end_page The last page to export.
|
|
255
|
+
#
|
|
256
|
+
# @option options [String] :page_range A string specifying the range of pages to export. The
|
|
257
|
+
# format can include individual page numbers and ranges of pages, separated by commas (e.g.,
|
|
258
|
+
# "1,3-5"). This was added in LayOut 2024.0
|
|
259
|
+
#
|
|
260
|
+
# @option options [Boolean] :compress_images Whether to compress images in the document. This is
|
|
261
|
+
# valid only for image compression for PDF exports.
|
|
262
|
+
#
|
|
263
|
+
# @option options [Float] :compress_quality The compression quality for JPEG images. This is
|
|
264
|
+
# valid only for the quality of the compression of images for PDF exports.
|
|
265
|
+
#
|
|
266
|
+
# @option options [Integer] :dpi The resolution in dots per inch for the exported images. This
|
|
267
|
+
# option is only valid for image exports.
|
|
268
|
+
#
|
|
269
|
+
# @param [String] file_path
|
|
270
|
+
# The file or image set to create. The directory
|
|
271
|
+
# path must already exist. The path must include the file extension.
|
|
272
|
+
#
|
|
273
|
+
# @param [Hash, nil] options
|
|
274
|
+
# An optional hash of settings for the export.
|
|
275
|
+
#
|
|
276
|
+
# @raise [TypeError] if an options value is the wrong type
|
|
277
|
+
#
|
|
278
|
+
# @raise [RangeError] if an options value is out of range
|
|
279
|
+
#
|
|
280
|
+
# @raise [ArgumentError] if the full file path does not exist
|
|
281
|
+
#
|
|
282
|
+
# @raise [ArgumentError] if the specified file type is missing or not supported
|
|
283
|
+
#
|
|
284
|
+
# @version LayOut 2020.1
|
|
285
|
+
def export(file_path, options = nil)
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
# The {#get_attribute} method is used to retrieve the value of an attribute in
|
|
289
|
+
# the document's attribute dictionary.
|
|
290
|
+
#
|
|
291
|
+
# If the third parameter, +default_value+, is not passed and there is no
|
|
292
|
+
# attribute that matches the given name, it returns +nil+.
|
|
293
|
+
#
|
|
294
|
+
# If +default_value+ is provided and there is no matching attribute it returns
|
|
295
|
+
# the given value. It does not create an attribute with that name though.
|
|
296
|
+
#
|
|
297
|
+
# @example
|
|
298
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
299
|
+
# # Read an attribute value from the document. In this case this will return the
|
|
300
|
+
# # default value provided: 42.
|
|
301
|
+
# doc.get_attribute("jane_doe_doc_maker", "doc_id", 42)
|
|
302
|
+
#
|
|
303
|
+
# @param [String] name
|
|
304
|
+
# The name of an attribute dictionary.
|
|
305
|
+
#
|
|
306
|
+
# @param [String] key
|
|
307
|
+
# An attribute key.
|
|
308
|
+
#
|
|
309
|
+
# @param [String, Boolean, Integer, Float, Hash, Layout::Dictionary, nil] default_value
|
|
310
|
+
# A default
|
|
311
|
+
# value to return if no attribute is found.
|
|
312
|
+
#
|
|
313
|
+
# @return [String, Boolean, Integer, Float, Layout::Dictionary, nil] the retrieved value.
|
|
314
|
+
#
|
|
315
|
+
# @version LayOut 2026.0
|
|
316
|
+
def get_attribute(name, key, default_value = nil)
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
# The {#grid} method returns the {Layout::Grid} for a {Layout::Document}.
|
|
320
|
+
#
|
|
321
|
+
# @example
|
|
322
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
323
|
+
# grid = doc.grid
|
|
324
|
+
#
|
|
325
|
+
# @return [Layout::Grid]
|
|
326
|
+
#
|
|
327
|
+
# @version LayOut 2018
|
|
328
|
+
def grid
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
# The {#grid_snap_enabled=} method sets whether or not grid snap is enabled in
|
|
332
|
+
# the {Layout::Document}.
|
|
333
|
+
#
|
|
334
|
+
# @example
|
|
335
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
336
|
+
# doc.grid_snap_enabled = true
|
|
337
|
+
#
|
|
338
|
+
# @param [Boolean] enabled
|
|
339
|
+
# +true+ for enabled +false+ for disabled
|
|
340
|
+
#
|
|
341
|
+
# @version LayOut 2018
|
|
342
|
+
def grid_snap_enabled=(enabled)
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
# The {#grid_snap_enabled?} method returns whether or not grid snap is enabled
|
|
346
|
+
# in the {Layout::Document}.
|
|
347
|
+
#
|
|
348
|
+
# @example
|
|
349
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
350
|
+
# enabled = doc.grid_snap_enabled?
|
|
351
|
+
#
|
|
352
|
+
# @return [Boolean]
|
|
353
|
+
#
|
|
354
|
+
# @version LayOut 2018
|
|
355
|
+
def grid_snap_enabled?
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
# The {#initialize} method creates a new {Layout::Document}. Passing a path to
|
|
359
|
+
# an existing {Layout::Document} will use that file as a template. The new
|
|
360
|
+
# {Layout::Document} won't have a path until it is saved for the first time.
|
|
361
|
+
#
|
|
362
|
+
# @example
|
|
363
|
+
# doc = Layout::Document.new
|
|
364
|
+
# doc2 = Layout::Document.new("/path/to/template.layout")
|
|
365
|
+
#
|
|
366
|
+
# @overload initialize
|
|
367
|
+
#
|
|
368
|
+
# @return [Layout::Document] an empty {Layout::Document} with one
|
|
369
|
+
# {Layout::Layer} and one {Layout::Page}
|
|
370
|
+
#
|
|
371
|
+
# @overload initialize(template_path)
|
|
372
|
+
#
|
|
373
|
+
# @param [String] template_path The path to the {Layout::Document} to use as
|
|
374
|
+
# a template
|
|
375
|
+
# @return [Layout::Document] an unsaved {Layout::Document} based on the
|
|
376
|
+
# template
|
|
377
|
+
#
|
|
378
|
+
# @raise [RuntimeError] if there was an error reading the template file
|
|
379
|
+
#
|
|
380
|
+
# @raise [ArgumentError] if the template file could not be found
|
|
381
|
+
#
|
|
382
|
+
# @version LayOut 2018
|
|
383
|
+
def initialize(*args)
|
|
384
|
+
end
|
|
385
|
+
|
|
386
|
+
# The {#layers} method returns the {Layout::Layers} of the {Layout::Document}.
|
|
387
|
+
#
|
|
388
|
+
# @example
|
|
389
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
390
|
+
# layers = doc.layers
|
|
391
|
+
#
|
|
392
|
+
# @return [Layout::Layers]
|
|
393
|
+
#
|
|
394
|
+
# @version LayOut 2018
|
|
395
|
+
def layers
|
|
396
|
+
end
|
|
397
|
+
|
|
398
|
+
# The {#object_snap_enabled=} method enables or disables inference in the
|
|
399
|
+
# {Layout::Document}.
|
|
400
|
+
#
|
|
401
|
+
# @example
|
|
402
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
403
|
+
# doc.object_snap_enabled = false
|
|
404
|
+
#
|
|
405
|
+
# @param [Boolean] enabled
|
|
406
|
+
# +true+ for enabled +false+ for disabled
|
|
407
|
+
#
|
|
408
|
+
# @version LayOut 2018
|
|
409
|
+
def object_snap_enabled=(enabled)
|
|
410
|
+
end
|
|
411
|
+
|
|
412
|
+
# The {#object_snap_enabled?} method returns whether or not inference is
|
|
413
|
+
# enabled in the {Layout::Document}.
|
|
414
|
+
#
|
|
415
|
+
# @example
|
|
416
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
417
|
+
# enabled = doc.object_snap_enabled?
|
|
418
|
+
#
|
|
419
|
+
# @return [Boolean]
|
|
420
|
+
#
|
|
421
|
+
# @version LayOut 2018
|
|
422
|
+
def object_snap_enabled?
|
|
423
|
+
end
|
|
424
|
+
|
|
425
|
+
# The {#page_info} method returns a reference to the {Layout::PageInfo}
|
|
426
|
+
# settings of the {Layout::Document}.
|
|
427
|
+
#
|
|
428
|
+
# @example
|
|
429
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
430
|
+
# page_info = doc.page_info
|
|
431
|
+
#
|
|
432
|
+
# @return [Layout::PageInfo]
|
|
433
|
+
#
|
|
434
|
+
# @version LayOut 2018
|
|
435
|
+
def page_info
|
|
436
|
+
end
|
|
437
|
+
|
|
438
|
+
# The {#pages} method returns the {Layout::Pages} of the {Layout::Document}.
|
|
439
|
+
#
|
|
440
|
+
#
|
|
441
|
+
# @example:
|
|
442
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
443
|
+
# doc_pages = doc.pages
|
|
444
|
+
#
|
|
445
|
+
# @return [Layout::Pages] The {Layout::Pages} for the {Layout::Document}.
|
|
446
|
+
#
|
|
447
|
+
# @version LayOut 2018
|
|
448
|
+
def pages
|
|
449
|
+
end
|
|
450
|
+
|
|
451
|
+
# The {#path} method returns the full path of the {Layout::Document} file. An
|
|
452
|
+
# empty string is returned for a new {Layout::Document} (one which has not
|
|
453
|
+
# been saved and opened).
|
|
454
|
+
#
|
|
455
|
+
# @example
|
|
456
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
457
|
+
# path = doc.path
|
|
458
|
+
#
|
|
459
|
+
# @return [String]
|
|
460
|
+
#
|
|
461
|
+
# @version LayOut 2018
|
|
462
|
+
def path
|
|
463
|
+
end
|
|
464
|
+
|
|
465
|
+
# The {#precision} method returns the precision for the {Layout::Document}.
|
|
466
|
+
#
|
|
467
|
+
# @example
|
|
468
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
469
|
+
# precision = doc.precision
|
|
470
|
+
#
|
|
471
|
+
# @return [Float] the number specifying the precision for the
|
|
472
|
+
# {Layout::Document}
|
|
473
|
+
#
|
|
474
|
+
# @version LayOut 2018
|
|
475
|
+
def precision
|
|
476
|
+
end
|
|
477
|
+
|
|
478
|
+
# The {#precision=} method sets the precision for the {Layout::Document}.
|
|
479
|
+
#
|
|
480
|
+
# @example
|
|
481
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
482
|
+
# doc.precision = 0.0001
|
|
483
|
+
#
|
|
484
|
+
# @note LayOut only allows for a finite set of precision values for each units
|
|
485
|
+
# setting, so it will set the precision to the closest valid setting for the
|
|
486
|
+
# specified units. See the "Units" section of LayOut's "Document Setup"
|
|
487
|
+
# dialog for a reference of the available precisions for each units setting.
|
|
488
|
+
#
|
|
489
|
+
# @param [Float] precision
|
|
490
|
+
# The double specifying the precision for the
|
|
491
|
+
# {Layout::Document}
|
|
492
|
+
#
|
|
493
|
+
# @version LayOut 2018
|
|
494
|
+
def precision=(precision)
|
|
495
|
+
end
|
|
496
|
+
|
|
497
|
+
# The {#remove_entity} method removes an {Layout::Entity} from the
|
|
498
|
+
# {Layout::Document}. If entity is a {Layout::Group}, then the {Layout::Group}
|
|
499
|
+
# and all of its children will be removed from the {Layout::Document}.
|
|
500
|
+
#
|
|
501
|
+
# @example
|
|
502
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
503
|
+
# shared_entities = doc.shared_entities
|
|
504
|
+
# # Remove the first entity in the document
|
|
505
|
+
# doc.remove_entity(shared_entities.first)
|
|
506
|
+
#
|
|
507
|
+
# @param [Layout::Entity] entity
|
|
508
|
+
# The {Layout::Entity} to be removed
|
|
509
|
+
#
|
|
510
|
+
# @raise [ArgumentError] if entity does not belong to the {Layout::Document}
|
|
511
|
+
#
|
|
512
|
+
# @version LayOut 2018
|
|
513
|
+
def remove_entity(entity)
|
|
514
|
+
end
|
|
515
|
+
|
|
516
|
+
# The {#render_mode_override} method returns the override setting for output render modes
|
|
517
|
+
# of {Layout::SketchUpModel}s in the {Layout::Document}.
|
|
518
|
+
#
|
|
519
|
+
# @example
|
|
520
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
521
|
+
# render_mode = doc.render_mode_override
|
|
522
|
+
#
|
|
523
|
+
# @return [Integer]
|
|
524
|
+
#
|
|
525
|
+
# @version LayOut 2023.1
|
|
526
|
+
def render_mode_override
|
|
527
|
+
end
|
|
528
|
+
|
|
529
|
+
# The {#render_mode_override=} method sets the override setting for output render modes
|
|
530
|
+
# of {Layout::SketchUpModel}s in the {Layout::Document}. Setting this to +NO_OVERRIDE+
|
|
531
|
+
# will prevent overriding the individual {Layout::SketchUpModel} render mode setting during
|
|
532
|
+
# export. This override will only affect raster rendered {Layout::SketchUpModel}s, if a
|
|
533
|
+
# viewport is set to vector or hybrid, it will retain that render mode as its output render
|
|
534
|
+
# mode.
|
|
535
|
+
#
|
|
536
|
+
# @example
|
|
537
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
538
|
+
# doc.render_mode_override = Layout::SketchUpModel::VECTOR_RENDER
|
|
539
|
+
#
|
|
540
|
+
# @param [Integer] render_mode
|
|
541
|
+
# +NO_OVERRIDE+, +VECTOR_RENDER+, or +HYBRID_RENDER+
|
|
542
|
+
#
|
|
543
|
+
# @raise [ArgumentError] if render_mode is not a valid render mode
|
|
544
|
+
#
|
|
545
|
+
# @raise [ArgumentError] if render_mode is +RASTER_RENDER+
|
|
546
|
+
#
|
|
547
|
+
# @version LayOut 2023.1
|
|
548
|
+
def render_mode_override=(render_mode)
|
|
549
|
+
end
|
|
550
|
+
|
|
551
|
+
# The {#save} method saves the {Layout::Document} to a file at the given path.
|
|
552
|
+
# Passing an empty path string will save the {Layout::Document} at its current
|
|
553
|
+
# path.
|
|
554
|
+
#
|
|
555
|
+
# @example
|
|
556
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
557
|
+
# # Save the model using the current Layout format
|
|
558
|
+
# path = File.join(ENV['Home'], 'Desktop', 'mydoc.layout')
|
|
559
|
+
# status = doc.save(path)
|
|
560
|
+
# # Save the document to the current file using the current LayOut format
|
|
561
|
+
# status = doc.save
|
|
562
|
+
# # Save the document to the current file in LayOut 3 format
|
|
563
|
+
# status = doc.save(Layout::Document::VERSION_3)
|
|
564
|
+
# # Save the document in LayOut 2013 format
|
|
565
|
+
# path = File.join(ENV['Home'], 'Desktop', 'mydoc_v2013.layout')
|
|
566
|
+
# status = doc.save(path, Layout::Document::VERSION_2013)
|
|
567
|
+
#
|
|
568
|
+
# @overload save
|
|
569
|
+
#
|
|
570
|
+
# @raise [ArgumentError] if the {Layout::Document} hasn't been saved with a
|
|
571
|
+
# path yet
|
|
572
|
+
#
|
|
573
|
+
# @overload save(path, version = Layout::Document::VERSION_CURRENT)
|
|
574
|
+
#
|
|
575
|
+
# @param [String] path The path to the .layout file on disk.
|
|
576
|
+
# @param [Integer] version LayOut file format to save.
|
|
577
|
+
#
|
|
578
|
+
# @raise [ArgumentError] if version is not a valid version
|
|
579
|
+
#
|
|
580
|
+
# @raise [ArgumentError] if saving failed. This may be due to the LayOut file
|
|
581
|
+
# being open in the LayOut application
|
|
582
|
+
#
|
|
583
|
+
# @version LayOut 2018
|
|
584
|
+
def save(*args)
|
|
585
|
+
end
|
|
586
|
+
|
|
587
|
+
# The {#set_attribute} method adds an attribute to the document's attribute dictionary.
|
|
588
|
+
#
|
|
589
|
+
# @example
|
|
590
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
591
|
+
# doc.set_attribute "jane_doe_doc_maker", "doc_id", 42
|
|
592
|
+
#
|
|
593
|
+
# @param [String] name
|
|
594
|
+
# The name of an attribute dictionary.
|
|
595
|
+
# @param [String] key An attribute key.
|
|
596
|
+
# @param [String, Boolean, Integer, Float, Hash, Layout::Dictionary, nil] value The value for the
|
|
597
|
+
# attribute.
|
|
598
|
+
#
|
|
599
|
+
# @version LayOut 2026.0
|
|
600
|
+
def set_attribute(name, key, value)
|
|
601
|
+
end
|
|
602
|
+
|
|
603
|
+
# The {#shared_entities} method returns the {Layout::Entities}
|
|
604
|
+
# that exist on shared {Layout::Layer}s in the {Layout::Document}.
|
|
605
|
+
#
|
|
606
|
+
# @example
|
|
607
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
608
|
+
# entities = doc.shared_entities
|
|
609
|
+
#
|
|
610
|
+
# @return [Layout::Entities]
|
|
611
|
+
#
|
|
612
|
+
# @version LayOut 2018
|
|
613
|
+
def shared_entities
|
|
614
|
+
end
|
|
615
|
+
|
|
616
|
+
# The {#time_created} method returns the time when the {Layout::Document} was
|
|
617
|
+
# created.
|
|
618
|
+
#
|
|
619
|
+
# @example
|
|
620
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
621
|
+
# created_time = doc.time_created
|
|
622
|
+
#
|
|
623
|
+
# @return [Time] time when the {Layout::Document} was created
|
|
624
|
+
#
|
|
625
|
+
# @version LayOut 2018
|
|
626
|
+
def time_created
|
|
627
|
+
end
|
|
628
|
+
|
|
629
|
+
# The {#time_modified} method returns the last time the {Layout::Document} was
|
|
630
|
+
# modified.
|
|
631
|
+
#
|
|
632
|
+
# @example
|
|
633
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
634
|
+
# mod_time = doc.time_modified
|
|
635
|
+
#
|
|
636
|
+
# @return [Time] time when the {Layout::Document} was last modified
|
|
637
|
+
#
|
|
638
|
+
# @version LayOut 2018
|
|
639
|
+
def time_modified
|
|
640
|
+
end
|
|
641
|
+
|
|
642
|
+
# The {#time_published} method returns the time when the {Layout::Document} was
|
|
643
|
+
# published.
|
|
644
|
+
#
|
|
645
|
+
# @example
|
|
646
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
647
|
+
# pub_time = doc.time_published
|
|
648
|
+
#
|
|
649
|
+
# @return [Time] time when the {Layout::Document} was published
|
|
650
|
+
#
|
|
651
|
+
# @version LayOut 2018
|
|
652
|
+
def time_published
|
|
653
|
+
end
|
|
654
|
+
|
|
655
|
+
# The {#units} method returns the units for the {Layout::Document}.
|
|
656
|
+
#
|
|
657
|
+
# @example
|
|
658
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
659
|
+
# units = doc.units
|
|
660
|
+
#
|
|
661
|
+
# @return [Integer] The unit format of the {Layout::Document}
|
|
662
|
+
#
|
|
663
|
+
# @version LayOut 2018
|
|
664
|
+
def units
|
|
665
|
+
end
|
|
666
|
+
|
|
667
|
+
# The {#units=} method sets the units for the {Layout::Document}.
|
|
668
|
+
#
|
|
669
|
+
# @example
|
|
670
|
+
# doc = Layout::Document.open("C:/path/to/document.layout")
|
|
671
|
+
# units_format = LAYOUT::DOCUMENT::DECIMAL_MILLIMETERS
|
|
672
|
+
# doc.units = units_format
|
|
673
|
+
#
|
|
674
|
+
# @param [Integer] units_format
|
|
675
|
+
# The format of the units in the {Layout::Document}
|
|
676
|
+
#
|
|
677
|
+
# @raise [ArgumentError] if units format is not a valid format
|
|
678
|
+
#
|
|
679
|
+
# @version LayOut 2018
|
|
680
|
+
def units=(units_format)
|
|
681
|
+
end
|
|
682
|
+
|
|
683
|
+
end
|