SketchUp  Ruby API Reference 

Class Index

Method Index

Developers Guide

Examples

Styles class

The Styles class contains methods for manipulating a collection of styles in a model.

Parent:

Methods: [], active_style, active_style_changed, add_style, count, each, parent, purge_unused, selected_style, selected_style=, size, update_selected_style

Example Code:

Instance Methods


[]

The [] method is used to retrieves a style by either name or index.

Syntax

style = styles[index]
style = styles["name"]

Arguments

index - the index for a specific style

name - the name of the specific style

Return Value

style - a Style object if successful

Example

 

 


active_style

The active_style method is used to retrieve the active style.

Syntax

style = styles.active_style

Return Value

style - the active Style object.

Example

 

 

 


active_styles_changed

The active_styles_changed method is used to...

Syntax

styles.active_styles_changed

Return Value

 

Example

 

 



add_style 

The add_style method is used to load a style from the given file and optionally set the style as the current active style in the model.

Syntax

status = styles.add_style filename select

Arguments

filename - the filename for the style.

selective - true if you want to set the style to be the active style, false if you do not want to set the style to the active style.

Return Value

status - true if successful, false if unsuccessful.

Example




 


count

The count method is an alias for size. See Styles.size.

 

 


each

The each method is used to iterate through styles.

Syntax

styles.each {| style |...}

Arguments

style – variables that will hold each style as it is found.

Example

 

 


parent

The parent method is used to determine the model for the styles.

Syntax

model = styles.parent

Return Value

model - the model that contains the styles if successful

Example

 

 


purge_unused

The purge_unused method is used to remove unused styles.

Syntax

status = styles.purge_unused

Return Value

status - true if successful, false if unsuccessful.

Example

 

 


selected_style

The selected_style method is used to retrieve the currently selected style.

Syntax

style = styles.selected_style

Return Value

style - the currently selected Style object.

Example

 

 


selected_style=

The selected_style= method is used to set the currently selected style.

Syntax

status = styles.selected_style = style

Arguments

style - a Style object.

Return Value

status - true if successful, false if unsuccessful.

Example

 

 


size

The size method is used to retrieve the size (number of elements) in a styles object .

Syntax

size = styles.size

Return Value

size – the number of Styles if successful.

Example

 

SketchUp  Ruby API Reference: Styles class

© Google Inc. 2007 sketchup.google.com