SketchUp  Ruby API Reference 

Class Index

Method Index

Developers Guide

Examples

RenderingOptions class

The RenderingOptions class contains method to extract the rendering information for a model. The majority of the rendering information returned exists in the Model Info > Display section of SketchUp. The following rendering information keys are maintained in SketchUp:


Key

Location in SketchUp UI

Comments

BackgroundColor

 

 

BandColor

 

 

ConstructionColor

 

 

DisplayColorbyLayer

 

 

DisplayFog

 

 

DisplayFogEdges

 

 

DisplayInstanceAxes

 

 

DrawGround

 

 

DrawHidden

 

 

DrawHorizon

 

 

DrawSilhouettes

 

 

EdgeColorMode

 

 

EdgeDisplayMode

 

 

ExtendLines

 

 

FaceBackColor

Model Info > Colors

 

FaceColorMode

 

 

FaceFrontColor

Model Info > Colors

 

FogColor

 

 

FogDensity

 

 

FogEnd

 

 

FogStart

 

 

FogType

 

 

FogUseBkColor

 

 

ForegroundColor

 

 

GroundColor

Model Info > Colors

 

GroundTransparency

Model Info > Colors

 

HighlightColor

 

 

HorizonColor

 

 

InactiveHidden

 

 

InstanceHidden

 

 

JitterEdges

Model Info > Display

 

LineExtension

Model Info > Display

 

MaterialTransparency

Materials Browser

 

ModelTransparency

 

 

RenderMode

 

 

SectionActiveColor

Model Info > Sections

 

SectionCutWidth

Model Info > Sections

 

SectionDefaultCutColor

Model Info > Sections

 

SectionInactiveColor

Model Info > Sections

 

SilhouetteWidth

 

 

SkyColor

Model Info > Colors

 

Texture

Materials Browser

 

TransparencySort

 

 

 

 

 


Parent: Object 

Methods: add_observer, each_key, keys, [], []=, each, each_key, each_pair, keys, remove_observer

Example Code: renderingoptionstests.rb

Class Methods


each_key 

The each_key method is a class method that iterates through all of the rendering options keys.

Syntax

Sketchup::RenderingOptions.each_key { | key | … }

Arguments

key – variable to hold each key as they are found

Example

# Iterate through each key, displaying each in a message box

Sketchup::RenderingOptions.each_key { | key | UI.messagebox key }

 

 


keys 

The keys method is a class method that returns an array with all of the attribute keys

Syntax

keys = Sketchup::RenderingOptions.keys

Return Value

keys – an array of keys

Example

# Retrieve the first key
key = Sketchup::RenderingOptions.keys[0]
UI.messagebox key

Instance Methods


[]

The [] method retrieves a value from the array of rendering options.

Syntax

value = renderingoptions["key"]

Arguments

key – the key of the rendering option value to retrieve.

Return Value

value – the value that is retrieved.

Example 

model = Sketchup.active_model
renderingoptions = model.rendering_options
begin
value = renderingoptions["DisplayInstanceAxes"]
rescue
UI.messagebox $!.message
end
UI.messagebox value

 

 


[]= 

The set value ([]=) method is used to set the value in the array of rendering options..

Syntax

value = renderingoptions[“key"]=value

Arguments

key – the key of the rendering option value to set.

value – the value to be set

Return Value

value – the value that was set if successful, or false if unsuccessful.

 Example

model = Sketchup.active_model
renderingoptions = model.rendering_options
value = renderingoptions["DisplayInstanceAxes"]
UI.messagebox value
value = renderingoptions["DisplayInstanceAxes"] = true
UI.messagebox value

 

 


add_observer

The add_observer method is used to add an observer to the current object.

Syntax

status = object.add_observer observer

Arguments

observer - an observer

Return Value

true if successful, false if unsuccessful.

Example

 

 


each 

The each method iterates through all of the rendering options key/value pairs.

Syntax

renderingoptions.each { | key, value | … }

Arguments

key, value – variables that will hold each key and value as they are found.

Example

model = Sketchup.active_modelrenderingoptions = model.rendering_options
renderingoptions.each { | key, value | UI.messagebox key }
renderingoptions.each { | key, value | UI.messagebox value }

 

 


each_key 

The each_key method iterates through all of the rendering options keys.

Syntax

renderingoptions.each_key { | key | … }

Arguments

key – variable to hold each key as they are found

Example 

model = Sketchup.active_model
renderingoptions = model.rendering_options
renderingoptoins.each_key { |key| UI.messagebox }

 

 


each_pair 

An alias for each. See RenderingOptions.each


keys 

The keys method returns an array with all of the attribute keys

Syntax

keys = renderingoptions.keys

Return Value

keys – an array of keys

Example

model = Sketchup.active_model
renderingoptions = model.rendering_options
keys = renderingoptions.keys
key = keys[0]
UI.messagebox key

 

 



remove_observer

The remove_observer method is used to remove an observer from the current object.

Syntax

status = object.remove_observer observer

Arguments

observer - an observer

Return Value

true if successful, false if unsuccessful.

Example

SketchUp  Ruby API Reference: RenderingOptions

© Google Inc. 2007 sketchup.google.com