class Pages |
Parent: Entity |
|
Methods:add_frame_change_observer, remove_frame_change_observer, [], add, count, each, parent, selected_page, show_frame_at, size, slideshow_time |
|
Sample Code:pagestests.rb |
|
Class Methods |
add_frame_change_observer |
The add_frame_change_observer method is used to add a new frame change observer for animations |
Syntax: |
pages.add_frame_change_observer object |
Arguments: |
object - an object that implements the frameChange method |
Return Value: |
|
Comments: |
The argument is an object that implements a method frameChange with the following form: def frameChange(fromPage, toPage, parameter) ... end This method is called during a slide show or creation of an animation after the camera has been set up, but before the frame is displayed. It give you a chance to perform your own actions during the animation. The arguments for frameChange method are the Page that you transition from (fromPage), the Page that you transition to (toPage), and a parameter between 0 and 1 that tell you the percentage of the way between the two pages. The method returns an integer that can be used to remove the observer |
Example: |
number = Sketchup::Pages.add_frame_change_observer FrameChangeObserver.new --------------- class FrameChangeObserver def
frameChange(fromPage, toPage, parameter) |
remove_frame_change_observer |
The remove_frame_change_observer method is used to remove a frame change observer |
Syntax: |
pages.remove_frame_change_observer(observer_num) |
Arguments: |
|
Return Value: |
|
Comments: |
The argument is the number returned from the call to add_frame_change_observer. |
Example: |
number = Sketchup::Pages.remove_frame_change_observer |
Instance Methods |
[] |
The [] method retrieves a page by either name or index. |
Syntax: |
page = pages[index] page = pages["name"] |
Arguments: |
index - the index for a specific page name - the name of the specific page |
Return Value: |
page - a Page object if successful |
Comments: |
|
Example: |
model = Sketchup.active_model |
add |
The add method is used to add a empty Page object |
Syntax: |
page = pages.add page = pages.add name page = pages.add name, flags |
Arguments: |
name - the name of the specific page flags - |
Return Value: |
|
Comments: |
If no name is given, then a new name is generated using the default name for new Pages. If a name is given, then a new Page with that name is added. If flags is given, it controls which properties are saved with the new Page. See Page.update for a description of the flags that can be set. |
Example: |
model = Sketchup.active_model |
count |
The count method is an alias for size. See also Page.size |
Syntax: |
num_pages = pages.count |
Arguments: |
|
Return Value: |
num_pages - the number of pages if successful |
Comments: |
|
Example: |
model = Sketchup.active_model |
each |
The each method is used to iterate through pages. |
Syntax: |
pages.each {| page |...} |
Arguments: |
page – variables that will hold each page as it is found. |
Return Value: |
|
Comments: |
|
Example: |
model = Sketchup.active_model |
parent |
The parent method is used to determine the model for the pages. |
Syntax: |
model = pages.parent |
Arguments: |
|
Return Value: |
model - the model that contains the pages if successful |
Comments: |
|
Example: |
model = Sketchup.active_model |
selected_page |
The selected_page method is used to retrieve the currently selected page. |
Syntax: |
page = pages.selected_page |
Arguments: |
|
Return Value: |
page - the currently selected Page object if successful |
Comments: |
|
Example: |
model = Sketchup.active_model |
show_frame_at |
The show_frame_at method is used to show a frame in animation (of the slide show) at a given time in seconds. |
Syntax: |
pages.show_frame_at time_in_seconds |
Arguments: |
time_in_seconds - the time in seconds |
Return Value: |
|
Comments: |
|
Example: |
model = Sketchup.active_model |
size |
The size method is used to retrieve the number of pages. |
Syntax: |
num_pages = pages.size |
Arguments: |
|
Return Value: |
num_pages - the number of pages |
Comments: |
|
Example: |
model = Sketchup.active_model |
slideshow_time |
The slideshow_time method is used to retrieve the amount of time that a slideshow of all of the pages will take. |
Syntax: |
time = pages.slideshow_time |
Arguments: |
|
Return Value: |
time - the amount of time that a slide show will take if successful |
Comments: |
This takes into account the transition time for each Page and the amount of time that each Page is displayed. |
Example: |
model = Sketchup.active_model |