|
SketchUp Ruby API Reference |
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
The each_key method is a class method that iterates through all of the rendering options keys.
Sketchup::RenderingOptions.each_key { | key | … }
key – variable to hold each key as they are found
# Iterate through each key, displaying each in a message box
Sketchup::RenderingOptions.each_key { | key | UI.messagebox key }
The keys method is a class method that returns an array with all of the attribute keys
keys = Sketchup::RenderingOptions.keys
keys – an array of keys
# Retrieve the first key
key = Sketchup::RenderingOptions.keys[0]
UI.messagebox key
The [] method retrieves a value from the array of rendering options.
value = renderingoptions["key"]
key – the key of the rendering option value to retrieve.
value – the value that is retrieved.
model = Sketchup.active_modelrenderingoptions = model.rendering_optionsbeginvalue = renderingoptions["DisplayInstanceAxes"]rescueUI.messagebox $!.messageendUI.messagebox value
The set value ([]=) method is used to set the value in the array of rendering options..
value = renderingoptions[“key"]=value
key – the key of the rendering option value to set.
value – the value to be set
value – the value that was set if successful, or false if unsuccessful.
model = Sketchup.active_model
renderingoptions = model.rendering_options
value = renderingoptions["DisplayInstanceAxes"]
UI.messagebox value
value = renderingoptions["DisplayInstanceAxes"] = true
UI.messagebox value
The add_observer method is used to add an observer to the current object.
status = object.add_observer observer
observer - an observer
true if successful, false if unsuccessful.
The each method iterates through all of the rendering options key/value pairs.
renderingoptions.each { | key, value | … }
key, value – variables that will hold each key and value as they are found.
model = Sketchup.active_modelrenderingoptions = model.rendering_options
renderingoptions.each { | key, value | UI.messagebox key }
renderingoptions.each { | key, value | UI.messagebox value }
The each_key method iterates through all of the rendering options keys.
renderingoptions.each_key { | key | … }
key – variable to hold each key as they are found
model = Sketchup.active_model
renderingoptions = model.rendering_options
renderingoptoins.each_key { |key| UI.messagebox }
An alias for each. See RenderingOptions.each
The keys method returns an array with all of the attribute keys
keys = renderingoptions.keys
keys – an array of keys
model = Sketchup.active_model
renderingoptions = model.rendering_options
keys = renderingoptions.keys
key = keys[0]
UI.messagebox key
The remove_observer method is used to remove an observer from the current object.
status = object.remove_observer observer
observer - an observer
true if successful, false if unsuccessful.
|
SketchUp Ruby API Reference: RenderingOptions |
© Google Inc. 2007 sketchup.google.com |