RenderingOptions

class RenderingOptions

Parent: Object | Class Index
Methods:each_key, keys, [], []=, each, each_key, each_pair, keys |
Sample Code:renderingoptionstests.rb |

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 |  |

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
Return Value:
Comments:
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
Arguments:
Return Value:
keys – an array of keys
Comments:
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[x]
Arguments:
x – the number of the rendering option value to retrieve.
Return Value:
value – the value that is retrieved.
Comments:
Example:

model = Sketchup.active_model
renderingoptions = model.rendering_options

begin
value = renderingoptions[0]\
rescue
UI.messagebox $!.message
end

UI.messagebox value

[]=
Syntax:
Arguments:
Return Value:
Comments:
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.
Return Value:
Comments:
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
Return Value:
Comments:
Example:
model = Sketchup.active_model renderingoptions = model.rendering_options renderingoptoins.each_key { |key| UI.messagebox }

each_pair
An alias for each. See RenderingOptions.each
Syntax:
Arguments:
Return Value:
Comments:
Example:

keys
The keys method returns an array with all of the attribute keys
Syntax:
keys = renderingoptions.keys
Arguments:
Return Value:
keys – an array of keys
Comments:
Example:
model = Sketchup.active_model renderingoptions = model.rendering_options keys = renderingoptions.keys key = keys[0] UI.messagebox key