sketchup-api-stubs 0.6.1 → 0.7.4
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/.yardopts +2 -0
- data/lib/sketchup-api-stubs.rb +1 -1
- data/lib/sketchup-api-stubs/sketchup.rb +145 -145
- data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +318 -318
- data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +172 -172
- data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +126 -126
- data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
- data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +400 -401
- data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +661 -661
- data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +492 -492
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +478 -478
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +263 -263
- data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +141 -141
- data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +522 -523
- data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +691 -691
- data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +573 -569
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +411 -411
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +174 -186
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +514 -455
- data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
- data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +143 -155
- data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +353 -359
- data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +349 -349
- data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -123
- data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
- data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -86
- data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +371 -371
- 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 +220 -232
- data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +567 -563
- 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 +183 -183
- data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +387 -387
- data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +204 -216
- data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +344 -344
- data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +174 -174
- data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +694 -547
- data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1519 -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/Sketchup/Animation.rb +140 -140
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +157 -157
- data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +209 -209
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +152 -152
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +281 -281
- data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +328 -328
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +577 -577
- data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
- data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +122 -122
- data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +281 -281
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +562 -554
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +593 -593
- data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +257 -257
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
- data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +194 -194
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +329 -329
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +72 -72
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +102 -102
- data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +165 -165
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +312 -312
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +38 -38
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
- data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +390 -390
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +508 -508
- data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1119 -1097
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +125 -125
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +544 -537
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +59 -59
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +125 -125
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +750 -750
- data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +104 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +697 -697
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +285 -285
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +62 -62
- data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +409 -409
- data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +226 -226
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +190 -190
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +393 -393
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +82 -82
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +303 -303
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +285 -262
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +244 -231
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +136 -136
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +48 -48
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +112 -123
- data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +416 -416
- data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +311 -311
- data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +141 -141
- data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +95 -95
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1638 -1483
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +356 -356
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +132 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +284 -282
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +770 -650
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +76 -76
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +456 -456
- data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +364 -356
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +44 -44
- data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +454 -454
- data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
- data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +212 -212
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +257 -257
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +57 -57
- data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +69 -69
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +211 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +262 -262
- data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +225 -225
- data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +829 -829
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +154 -154
- data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +61 -61
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1301 -995
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +43 -43
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +310 -310
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +356 -356
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +229 -229
- data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +240 -240
- data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +633 -633
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +311 -303
- data/lib/sketchup-api-stubs/stubs/array.rb +741 -741
- data/lib/sketchup-api-stubs/stubs/geom.rb +348 -233
- data/lib/sketchup-api-stubs/stubs/languagehandler.rb +92 -92
- data/lib/sketchup-api-stubs/stubs/length.rb +278 -262
- data/lib/sketchup-api-stubs/stubs/numeric.rb +249 -249
- data/lib/sketchup-api-stubs/stubs/sketchup.rb +1310 -1310
- 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.rb +667 -660
- metadata +2 -16
@@ -1,353 +1,353 @@
|
|
1
|
-
# Copyright:: Copyright
|
2
|
-
# License:: The MIT License (MIT)
|
3
|
-
|
4
|
-
# The Pages class contains methods for manipulating a collection of Pages
|
5
|
-
# (scenes) in a model.
|
6
|
-
#
|
7
|
-
# You get a handle to this collection by calling Model.pages.
|
8
|
-
#
|
9
|
-
# @example
|
10
|
-
# model = Sketchup.active_model
|
11
|
-
# pages = model.pages
|
12
|
-
#
|
13
|
-
# @version SketchUp 6.0
|
14
|
-
class Sketchup::Pages < Sketchup::Entity
|
15
|
-
|
16
|
-
# Includes
|
17
|
-
|
18
|
-
include Enumerable
|
19
|
-
|
20
|
-
# Class Methods
|
21
|
-
|
22
|
-
# The {.add_frame_change_observer} method is used to add a new frame change
|
23
|
-
# observer that is called with each frame of an animation, meaning the
|
24
|
-
# end user has clicked on a Scene tab (aka Page) inside SketchUp and
|
25
|
-
# the camera is animating to that scene.
|
26
|
-
#
|
27
|
-
# The method returns an integer id that can be stored and later used to remove
|
28
|
-
# the observer with the {Sketchup::Pages.remove_frame_change_observer} method.
|
29
|
-
#
|
30
|
-
# @example
|
31
|
-
# class MyFrameChangeObserver
|
32
|
-
# def frameChange(from_page, to_page, percent_done)
|
33
|
-
# puts "From page #{from_page.name} to #{to_page.name} (#{percent_done * 100}%)"
|
34
|
-
# end
|
35
|
-
# end
|
36
|
-
# id = Sketchup::Pages.add_frame_change_observer(MyFrameChangeObserver.new)
|
37
|
-
#
|
38
|
-
# @param [#frameChange] object
|
39
|
-
# An object that implements the
|
40
|
-
# {Sketchup::FrameChangeObserver#frameChange} method.
|
41
|
-
#
|
42
|
-
# @return [Integer] A unique id of the observer
|
43
|
-
#
|
44
|
-
# @see Sketchup::FrameChangeObserver#frameChange
|
45
|
-
#
|
46
|
-
# @version SketchUp 6.0
|
47
|
-
def self.add_frame_change_observer(object)
|
48
|
-
end
|
49
|
-
|
50
|
-
# The #{remove_frame_change_observer} method is used to remove a frame change
|
51
|
-
# observer
|
52
|
-
#
|
53
|
-
# @example
|
54
|
-
# Sketchup::Pages.remove_frame_change_observer(id)
|
55
|
-
#
|
56
|
-
# @param [Integer] observer_id
|
57
|
-
# The unique id returned by {.add_frame_change_observer}
|
58
|
-
#
|
59
|
-
# @return [Boolean]
|
60
|
-
#
|
61
|
-
# @version SketchUp 6.0
|
62
|
-
def self.remove_frame_change_observer(observer_id)
|
63
|
-
end
|
64
|
-
|
65
|
-
# Instance Methods
|
66
|
-
|
67
|
-
# The [] method retrieves a page by either name or index.
|
68
|
-
#
|
69
|
-
# @example
|
70
|
-
# model = Sketchup.active_model
|
71
|
-
# pages = model.pages
|
72
|
-
# status = pages.add "Page 1"
|
73
|
-
# status = pages.add "Page 2"
|
74
|
-
# page = pages["Page 2"]
|
75
|
-
# if (page)
|
76
|
-
# UI.messagebox page
|
77
|
-
# else
|
78
|
-
# UI.messagebox "Failure"
|
79
|
-
# end
|
80
|
-
#
|
81
|
-
# @param index_or_name
|
82
|
-
# The index or the string name of the specific page.
|
83
|
-
#
|
84
|
-
# @return page - a Page object if successful
|
85
|
-
#
|
86
|
-
# @version SketchUp 6.0
|
87
|
-
def [](index_or_name)
|
88
|
-
end
|
89
|
-
|
90
|
-
# The add method is used to add an empty Page object to the collection.
|
91
|
-
#
|
92
|
-
# If no name is given, then a new name is generated using the default name for
|
93
|
-
# new Pages. If a name is given, then a new Page with that name is
|
94
|
-
# added.
|
95
|
-
#
|
96
|
-
# If the flags parameter is given, it controls which properties are saved with
|
97
|
-
# the Page. See the Page.update method for a description of the flags that can
|
98
|
-
# be set.
|
99
|
-
#
|
100
|
-
# If index is given, it specifies the position in the page list that the new
|
101
|
-
# page is added. Otherwise the new page is added to the end.
|
102
|
-
#
|
103
|
-
# @example
|
104
|
-
# model = Sketchup.active_model
|
105
|
-
# pages = model.pages
|
106
|
-
# status = pages.add "Page 1"
|
107
|
-
# status = pages.add "Page 2"
|
108
|
-
# if (status)
|
109
|
-
# UI.messagebox status
|
110
|
-
# else
|
111
|
-
# UI.messagebox "Failure"
|
112
|
-
# end
|
113
|
-
#
|
114
|
-
# @param name
|
115
|
-
# The name of the specific page.
|
116
|
-
#
|
117
|
-
# @param [optional] flags
|
118
|
-
# Bit flags in integer form.
|
119
|
-
#
|
120
|
-
# @param [optional] index
|
121
|
-
# Index of where to inset.
|
122
|
-
#
|
123
|
-
# @return nil
|
124
|
-
#
|
125
|
-
# @version SketchUp 6.0
|
126
|
-
def add(name, flags, index)
|
127
|
-
end
|
128
|
-
|
129
|
-
# The add_matchphoto_page method is used to add a photomatch page to the
|
130
|
-
# model. This is an advanced feature that was added to support internal
|
131
|
-
# SketchUp work, so it is unlikely to be useful to you.
|
132
|
-
#
|
133
|
-
# @example
|
134
|
-
# pages = Sketchup.active_model.pages
|
135
|
-
# page = pages.add_matchphoto_page "Test"
|
136
|
-
#
|
137
|
-
# @param image_name
|
138
|
-
# String image name.
|
139
|
-
#
|
140
|
-
# @param [optional] camera
|
141
|
-
# Camera object.
|
142
|
-
#
|
143
|
-
# @param [optional] page_name
|
144
|
-
# String page name.
|
145
|
-
#
|
146
|
-
# @return page - the new photomatch page.
|
147
|
-
#
|
148
|
-
# @version SketchUp 7.0
|
149
|
-
def add_matchphoto_page(image_name, camera, page_name)
|
150
|
-
end
|
151
|
-
|
152
|
-
# The add_observer method is used to add an observer to the Pages object.
|
153
|
-
# See the PagesObserver interface for more details.
|
154
|
-
#
|
155
|
-
# @example
|
156
|
-
# pages = Sketchup.active_model.pages
|
157
|
-
# status = pages.add_observer observer
|
158
|
-
#
|
159
|
-
# @param observer
|
160
|
-
# An observer.
|
161
|
-
#
|
162
|
-
# @return true if successful, false if unsuccessful.
|
163
|
-
#
|
164
|
-
# @version SketchUp 6.0
|
165
|
-
def add_observer(observer)
|
166
|
-
end
|
167
|
-
|
168
|
-
#
|
169
|
-
# @example
|
170
|
-
# pages = Sketchup.active_model.pages
|
171
|
-
# pages.add('Page 1')
|
172
|
-
# pages.add('Page 2')
|
173
|
-
# number = pages.count
|
174
|
-
#
|
175
|
-
# @note Since SketchUp 2014 the count method is inherited from Ruby's
|
176
|
-
# +Enumable+ mix-in module. Prior to that the {#count} method is an alias
|
177
|
-
# for {#length}.
|
178
|
-
#
|
179
|
-
# @return [Integer]
|
180
|
-
#
|
181
|
-
# @see #length
|
182
|
-
#
|
183
|
-
# @version SketchUp 6.0
|
184
|
-
def count
|
185
|
-
end
|
186
|
-
|
187
|
-
# The each method is used to iterate through pages.
|
188
|
-
#
|
189
|
-
# @example
|
190
|
-
# model = Sketchup.active_model
|
191
|
-
# pages = model.pages
|
192
|
-
# status = pages.add "Page 1"
|
193
|
-
# status = pages.add "Page 2"
|
194
|
-
# pages.each {|page| UI.messagebox page}
|
195
|
-
#
|
196
|
-
# @return nil
|
197
|
-
#
|
198
|
-
# @version SketchUp 6.0
|
199
|
-
#
|
200
|
-
# @yield [page] Variables that will hold each page as it is found.
|
201
|
-
def each
|
202
|
-
end
|
203
|
-
|
204
|
-
# The {#erase} method is used to remove a page from the collection.
|
205
|
-
#
|
206
|
-
# @example
|
207
|
-
# page = Sketchup.active_model.pages.add('Hello World')
|
208
|
-
# Sketchup.active_model.pages.erase(page)
|
209
|
-
#
|
210
|
-
# @param [Sketchup::Page] page
|
211
|
-
#
|
212
|
-
# @return [Boolean]
|
213
|
-
#
|
214
|
-
# @version SketchUp 6.0
|
215
|
-
def erase(page)
|
216
|
-
end
|
217
|
-
|
218
|
-
# The {#length} method is an alias for {#size}.
|
219
|
-
#
|
220
|
-
# @example
|
221
|
-
# pages = Sketchup.active_model.pages
|
222
|
-
# pages.add('Page 1')
|
223
|
-
# pages.add('Page 2')
|
224
|
-
# number = pages.length
|
225
|
-
#
|
226
|
-
# @return [Integer]
|
227
|
-
#
|
228
|
-
# @see #size
|
229
|
-
#
|
230
|
-
# @version SketchUp 2014
|
231
|
-
def length
|
232
|
-
end
|
233
|
-
|
234
|
-
# The parent method is used to determine the model for the Pages collection.
|
235
|
-
#
|
236
|
-
# @example
|
237
|
-
# model = Sketchup.active_model
|
238
|
-
# pages = model.pages
|
239
|
-
# status = pages.add "Page 1"
|
240
|
-
# status = pages.add "Page 2"
|
241
|
-
# model = pages.parent
|
242
|
-
#
|
243
|
-
# @return model - the model that contains the pages if successful
|
244
|
-
#
|
245
|
-
# @version SketchUp 6.0
|
246
|
-
def parent
|
247
|
-
end
|
248
|
-
|
249
|
-
# The remove_observer method is used to remove an observer from the current
|
250
|
-
# object. See the PagesObserver interface for more details.
|
251
|
-
#
|
252
|
-
# @example
|
253
|
-
# pages = Sketchup.active_model.pages
|
254
|
-
# status = pages.remove_observer observer
|
255
|
-
#
|
256
|
-
# @param observer
|
257
|
-
# An observer.
|
258
|
-
#
|
259
|
-
# @return true if successful, false if unsuccessful.
|
260
|
-
#
|
261
|
-
# @version SketchUp 6.0
|
262
|
-
def remove_observer(observer)
|
263
|
-
end
|
264
|
-
|
265
|
-
# The selected_page method is used to retrieve the currently selected page.
|
266
|
-
#
|
267
|
-
# @example
|
268
|
-
# model = Sketchup.active_model
|
269
|
-
# pages = model.pages
|
270
|
-
# status = pages.add "Page 1"
|
271
|
-
# status = pages.add "Page 2"
|
272
|
-
# page = pages.selected_page
|
273
|
-
#
|
274
|
-
# @return page - the currently selected Page object if successful
|
275
|
-
#
|
276
|
-
# @version SketchUp 6.0
|
277
|
-
def selected_page
|
278
|
-
end
|
279
|
-
|
280
|
-
# The selected_page method is used to set the currently selected page. Once
|
281
|
-
# you set this, SketchUp will animate to that page as if the user had clicked
|
282
|
-
# on its scene tab.
|
283
|
-
#
|
284
|
-
# @example
|
285
|
-
# model = Sketchup.active_model
|
286
|
-
# pages = model.pages
|
287
|
-
# status = pages.add "Page 1"
|
288
|
-
# status = pages.add "Page 2"
|
289
|
-
# pages.selected_page = model.pages[1]
|
290
|
-
#
|
291
|
-
# @param [Sketchup::Page] page
|
292
|
-
#
|
293
|
-
# @return status - true if successful
|
294
|
-
#
|
295
|
-
# @version SketchUp 6.0
|
296
|
-
def selected_page=(page)
|
297
|
-
end
|
298
|
-
|
299
|
-
# The {#show_frame_at} method is used to show a frame in animation (of the
|
300
|
-
# slide show) at a given time in seconds.
|
301
|
-
#
|
302
|
-
# @example
|
303
|
-
# model = Sketchup.active_model
|
304
|
-
# pages = model.pages
|
305
|
-
# pages.add("Page 1")
|
306
|
-
# pages.add("Page 2")
|
307
|
-
# page, ratio = pages.show_frame_at(1.8)
|
308
|
-
#
|
309
|
-
# @note In versions prior to SketchUp 2019 this method will crash if called
|
310
|
-
# when there are no pages in the model.
|
311
|
-
#
|
312
|
-
# @param [Float] seconds
|
313
|
-
# The time in seconds.
|
314
|
-
#
|
315
|
-
# @return [Array(Sketchup::Page, Float), nil] Upon success it returns the
|
316
|
-
# page that is displayed and a parameter between +0.0+ and +1.0+ that is
|
317
|
-
# tells how far along the transition to next page you are at.
|
318
|
-
#
|
319
|
-
# @version SketchUp 6.0
|
320
|
-
def show_frame_at(seconds)
|
321
|
-
end
|
322
|
-
|
323
|
-
# The {#size} method is used to retrieve the number of pages.
|
324
|
-
#
|
325
|
-
# @example
|
326
|
-
# pages = Sketchup.active_model.pages
|
327
|
-
# pages.add('Page 1')
|
328
|
-
# pages.add('Page 2')
|
329
|
-
# number = pages.size
|
330
|
-
#
|
331
|
-
# @return [Integer]
|
332
|
-
#
|
333
|
-
# @see #length
|
334
|
-
#
|
335
|
-
# @version SketchUp 6.0
|
336
|
-
def size
|
337
|
-
end
|
338
|
-
|
339
|
-
# The slideshow_time method is used to get the amount of time that a slideshow
|
340
|
-
# of all of the pages will take. This takes into account the transition time
|
341
|
-
# for each Page and the amount of time that each Page is displayed.
|
342
|
-
#
|
343
|
-
# @example
|
344
|
-
# pages = Sketchup.active_model.pages
|
345
|
-
# time = pages.slideshow_time
|
346
|
-
#
|
347
|
-
# @return status - true if successful
|
348
|
-
#
|
349
|
-
# @version SketchUp 6.0
|
350
|
-
def slideshow_time
|
351
|
-
end
|
352
|
-
|
353
|
-
end
|
1
|
+
# Copyright:: Copyright 2020 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The Pages class contains methods for manipulating a collection of Pages
|
5
|
+
# (scenes) in a model.
|
6
|
+
#
|
7
|
+
# You get a handle to this collection by calling Model.pages.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# model = Sketchup.active_model
|
11
|
+
# pages = model.pages
|
12
|
+
#
|
13
|
+
# @version SketchUp 6.0
|
14
|
+
class Sketchup::Pages < Sketchup::Entity
|
15
|
+
|
16
|
+
# Includes
|
17
|
+
|
18
|
+
include Enumerable
|
19
|
+
|
20
|
+
# Class Methods
|
21
|
+
|
22
|
+
# The {.add_frame_change_observer} method is used to add a new frame change
|
23
|
+
# observer that is called with each frame of an animation, meaning the
|
24
|
+
# end user has clicked on a Scene tab (aka Page) inside SketchUp and
|
25
|
+
# the camera is animating to that scene.
|
26
|
+
#
|
27
|
+
# The method returns an integer id that can be stored and later used to remove
|
28
|
+
# the observer with the {Sketchup::Pages.remove_frame_change_observer} method.
|
29
|
+
#
|
30
|
+
# @example
|
31
|
+
# class MyFrameChangeObserver
|
32
|
+
# def frameChange(from_page, to_page, percent_done)
|
33
|
+
# puts "From page #{from_page.name} to #{to_page.name} (#{percent_done * 100}%)"
|
34
|
+
# end
|
35
|
+
# end
|
36
|
+
# id = Sketchup::Pages.add_frame_change_observer(MyFrameChangeObserver.new)
|
37
|
+
#
|
38
|
+
# @param [#frameChange] object
|
39
|
+
# An object that implements the
|
40
|
+
# {Sketchup::FrameChangeObserver#frameChange} method.
|
41
|
+
#
|
42
|
+
# @return [Integer] A unique id of the observer
|
43
|
+
#
|
44
|
+
# @see Sketchup::FrameChangeObserver#frameChange
|
45
|
+
#
|
46
|
+
# @version SketchUp 6.0
|
47
|
+
def self.add_frame_change_observer(object)
|
48
|
+
end
|
49
|
+
|
50
|
+
# The #{remove_frame_change_observer} method is used to remove a frame change
|
51
|
+
# observer
|
52
|
+
#
|
53
|
+
# @example
|
54
|
+
# Sketchup::Pages.remove_frame_change_observer(id)
|
55
|
+
#
|
56
|
+
# @param [Integer] observer_id
|
57
|
+
# The unique id returned by {.add_frame_change_observer}
|
58
|
+
#
|
59
|
+
# @return [Boolean]
|
60
|
+
#
|
61
|
+
# @version SketchUp 6.0
|
62
|
+
def self.remove_frame_change_observer(observer_id)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Instance Methods
|
66
|
+
|
67
|
+
# The [] method retrieves a page by either name or index.
|
68
|
+
#
|
69
|
+
# @example
|
70
|
+
# model = Sketchup.active_model
|
71
|
+
# pages = model.pages
|
72
|
+
# status = pages.add "Page 1"
|
73
|
+
# status = pages.add "Page 2"
|
74
|
+
# page = pages["Page 2"]
|
75
|
+
# if (page)
|
76
|
+
# UI.messagebox page
|
77
|
+
# else
|
78
|
+
# UI.messagebox "Failure"
|
79
|
+
# end
|
80
|
+
#
|
81
|
+
# @param index_or_name
|
82
|
+
# The index or the string name of the specific page.
|
83
|
+
#
|
84
|
+
# @return page - a Page object if successful
|
85
|
+
#
|
86
|
+
# @version SketchUp 6.0
|
87
|
+
def [](index_or_name)
|
88
|
+
end
|
89
|
+
|
90
|
+
# The add method is used to add an empty Page object to the collection.
|
91
|
+
#
|
92
|
+
# If no name is given, then a new name is generated using the default name for
|
93
|
+
# new Pages. If a name is given, then a new Page with that name is
|
94
|
+
# added.
|
95
|
+
#
|
96
|
+
# If the flags parameter is given, it controls which properties are saved with
|
97
|
+
# the Page. See the Page.update method for a description of the flags that can
|
98
|
+
# be set.
|
99
|
+
#
|
100
|
+
# If index is given, it specifies the position in the page list that the new
|
101
|
+
# page is added. Otherwise the new page is added to the end.
|
102
|
+
#
|
103
|
+
# @example
|
104
|
+
# model = Sketchup.active_model
|
105
|
+
# pages = model.pages
|
106
|
+
# status = pages.add "Page 1"
|
107
|
+
# status = pages.add "Page 2"
|
108
|
+
# if (status)
|
109
|
+
# UI.messagebox status
|
110
|
+
# else
|
111
|
+
# UI.messagebox "Failure"
|
112
|
+
# end
|
113
|
+
#
|
114
|
+
# @param name
|
115
|
+
# The name of the specific page.
|
116
|
+
#
|
117
|
+
# @param [optional] flags
|
118
|
+
# Bit flags in integer form.
|
119
|
+
#
|
120
|
+
# @param [optional] index
|
121
|
+
# Index of where to inset.
|
122
|
+
#
|
123
|
+
# @return nil
|
124
|
+
#
|
125
|
+
# @version SketchUp 6.0
|
126
|
+
def add(name, flags, index)
|
127
|
+
end
|
128
|
+
|
129
|
+
# The add_matchphoto_page method is used to add a photomatch page to the
|
130
|
+
# model. This is an advanced feature that was added to support internal
|
131
|
+
# SketchUp work, so it is unlikely to be useful to you.
|
132
|
+
#
|
133
|
+
# @example
|
134
|
+
# pages = Sketchup.active_model.pages
|
135
|
+
# page = pages.add_matchphoto_page "Test"
|
136
|
+
#
|
137
|
+
# @param image_name
|
138
|
+
# String image name.
|
139
|
+
#
|
140
|
+
# @param [optional] camera
|
141
|
+
# Camera object.
|
142
|
+
#
|
143
|
+
# @param [optional] page_name
|
144
|
+
# String page name.
|
145
|
+
#
|
146
|
+
# @return page - the new photomatch page.
|
147
|
+
#
|
148
|
+
# @version SketchUp 7.0
|
149
|
+
def add_matchphoto_page(image_name, camera, page_name)
|
150
|
+
end
|
151
|
+
|
152
|
+
# The add_observer method is used to add an observer to the Pages object.
|
153
|
+
# See the PagesObserver interface for more details.
|
154
|
+
#
|
155
|
+
# @example
|
156
|
+
# pages = Sketchup.active_model.pages
|
157
|
+
# status = pages.add_observer observer
|
158
|
+
#
|
159
|
+
# @param observer
|
160
|
+
# An observer.
|
161
|
+
#
|
162
|
+
# @return true if successful, false if unsuccessful.
|
163
|
+
#
|
164
|
+
# @version SketchUp 6.0
|
165
|
+
def add_observer(observer)
|
166
|
+
end
|
167
|
+
|
168
|
+
#
|
169
|
+
# @example
|
170
|
+
# pages = Sketchup.active_model.pages
|
171
|
+
# pages.add('Page 1')
|
172
|
+
# pages.add('Page 2')
|
173
|
+
# number = pages.count
|
174
|
+
#
|
175
|
+
# @note Since SketchUp 2014 the count method is inherited from Ruby's
|
176
|
+
# +Enumable+ mix-in module. Prior to that the {#count} method is an alias
|
177
|
+
# for {#length}.
|
178
|
+
#
|
179
|
+
# @return [Integer]
|
180
|
+
#
|
181
|
+
# @see #length
|
182
|
+
#
|
183
|
+
# @version SketchUp 6.0
|
184
|
+
def count
|
185
|
+
end
|
186
|
+
|
187
|
+
# The each method is used to iterate through pages.
|
188
|
+
#
|
189
|
+
# @example
|
190
|
+
# model = Sketchup.active_model
|
191
|
+
# pages = model.pages
|
192
|
+
# status = pages.add "Page 1"
|
193
|
+
# status = pages.add "Page 2"
|
194
|
+
# pages.each {|page| UI.messagebox page}
|
195
|
+
#
|
196
|
+
# @return nil
|
197
|
+
#
|
198
|
+
# @version SketchUp 6.0
|
199
|
+
#
|
200
|
+
# @yield [page] Variables that will hold each page as it is found.
|
201
|
+
def each
|
202
|
+
end
|
203
|
+
|
204
|
+
# The {#erase} method is used to remove a page from the collection.
|
205
|
+
#
|
206
|
+
# @example
|
207
|
+
# page = Sketchup.active_model.pages.add('Hello World')
|
208
|
+
# Sketchup.active_model.pages.erase(page)
|
209
|
+
#
|
210
|
+
# @param [Sketchup::Page] page
|
211
|
+
#
|
212
|
+
# @return [Boolean]
|
213
|
+
#
|
214
|
+
# @version SketchUp 6.0
|
215
|
+
def erase(page)
|
216
|
+
end
|
217
|
+
|
218
|
+
# The {#length} method is an alias for {#size}.
|
219
|
+
#
|
220
|
+
# @example
|
221
|
+
# pages = Sketchup.active_model.pages
|
222
|
+
# pages.add('Page 1')
|
223
|
+
# pages.add('Page 2')
|
224
|
+
# number = pages.length
|
225
|
+
#
|
226
|
+
# @return [Integer]
|
227
|
+
#
|
228
|
+
# @see #size
|
229
|
+
#
|
230
|
+
# @version SketchUp 2014
|
231
|
+
def length
|
232
|
+
end
|
233
|
+
|
234
|
+
# The parent method is used to determine the model for the Pages collection.
|
235
|
+
#
|
236
|
+
# @example
|
237
|
+
# model = Sketchup.active_model
|
238
|
+
# pages = model.pages
|
239
|
+
# status = pages.add "Page 1"
|
240
|
+
# status = pages.add "Page 2"
|
241
|
+
# model = pages.parent
|
242
|
+
#
|
243
|
+
# @return model - the model that contains the pages if successful
|
244
|
+
#
|
245
|
+
# @version SketchUp 6.0
|
246
|
+
def parent
|
247
|
+
end
|
248
|
+
|
249
|
+
# The remove_observer method is used to remove an observer from the current
|
250
|
+
# object. See the PagesObserver interface for more details.
|
251
|
+
#
|
252
|
+
# @example
|
253
|
+
# pages = Sketchup.active_model.pages
|
254
|
+
# status = pages.remove_observer observer
|
255
|
+
#
|
256
|
+
# @param observer
|
257
|
+
# An observer.
|
258
|
+
#
|
259
|
+
# @return true if successful, false if unsuccessful.
|
260
|
+
#
|
261
|
+
# @version SketchUp 6.0
|
262
|
+
def remove_observer(observer)
|
263
|
+
end
|
264
|
+
|
265
|
+
# The selected_page method is used to retrieve the currently selected page.
|
266
|
+
#
|
267
|
+
# @example
|
268
|
+
# model = Sketchup.active_model
|
269
|
+
# pages = model.pages
|
270
|
+
# status = pages.add "Page 1"
|
271
|
+
# status = pages.add "Page 2"
|
272
|
+
# page = pages.selected_page
|
273
|
+
#
|
274
|
+
# @return page - the currently selected Page object if successful
|
275
|
+
#
|
276
|
+
# @version SketchUp 6.0
|
277
|
+
def selected_page
|
278
|
+
end
|
279
|
+
|
280
|
+
# The selected_page method is used to set the currently selected page. Once
|
281
|
+
# you set this, SketchUp will animate to that page as if the user had clicked
|
282
|
+
# on its scene tab.
|
283
|
+
#
|
284
|
+
# @example
|
285
|
+
# model = Sketchup.active_model
|
286
|
+
# pages = model.pages
|
287
|
+
# status = pages.add "Page 1"
|
288
|
+
# status = pages.add "Page 2"
|
289
|
+
# pages.selected_page = model.pages[1]
|
290
|
+
#
|
291
|
+
# @param [Sketchup::Page] page
|
292
|
+
#
|
293
|
+
# @return status - true if successful
|
294
|
+
#
|
295
|
+
# @version SketchUp 6.0
|
296
|
+
def selected_page=(page)
|
297
|
+
end
|
298
|
+
|
299
|
+
# The {#show_frame_at} method is used to show a frame in animation (of the
|
300
|
+
# slide show) at a given time in seconds.
|
301
|
+
#
|
302
|
+
# @example
|
303
|
+
# model = Sketchup.active_model
|
304
|
+
# pages = model.pages
|
305
|
+
# pages.add("Page 1")
|
306
|
+
# pages.add("Page 2")
|
307
|
+
# page, ratio = pages.show_frame_at(1.8)
|
308
|
+
#
|
309
|
+
# @note In versions prior to SketchUp 2019 this method will crash if called
|
310
|
+
# when there are no pages in the model.
|
311
|
+
#
|
312
|
+
# @param [Float] seconds
|
313
|
+
# The time in seconds.
|
314
|
+
#
|
315
|
+
# @return [Array(Sketchup::Page, Float), nil] Upon success it returns the
|
316
|
+
# page that is displayed and a parameter between +0.0+ and +1.0+ that is
|
317
|
+
# tells how far along the transition to next page you are at.
|
318
|
+
#
|
319
|
+
# @version SketchUp 6.0
|
320
|
+
def show_frame_at(seconds)
|
321
|
+
end
|
322
|
+
|
323
|
+
# The {#size} method is used to retrieve the number of pages.
|
324
|
+
#
|
325
|
+
# @example
|
326
|
+
# pages = Sketchup.active_model.pages
|
327
|
+
# pages.add('Page 1')
|
328
|
+
# pages.add('Page 2')
|
329
|
+
# number = pages.size
|
330
|
+
#
|
331
|
+
# @return [Integer]
|
332
|
+
#
|
333
|
+
# @see #length
|
334
|
+
#
|
335
|
+
# @version SketchUp 6.0
|
336
|
+
def size
|
337
|
+
end
|
338
|
+
|
339
|
+
# The slideshow_time method is used to get the amount of time that a slideshow
|
340
|
+
# of all of the pages will take. This takes into account the transition time
|
341
|
+
# for each Page and the amount of time that each Page is displayed.
|
342
|
+
#
|
343
|
+
# @example
|
344
|
+
# pages = Sketchup.active_model.pages
|
345
|
+
# time = pages.slideshow_time
|
346
|
+
#
|
347
|
+
# @return status - true if successful
|
348
|
+
#
|
349
|
+
# @version SketchUp 6.0
|
350
|
+
def slideshow_time
|
351
|
+
end
|
352
|
+
|
353
|
+
end
|