SketchUp  Ruby API Reference 

Class Index

Method Index

Developers Guide

Examples

ShadowInfo class

The ShadowInfo class contains method to extract the shadow information for a model. The majority of the shadow information returned exists in the Model Info > Location and Model Info > Shadows section of SketchUp. The following shadow information keys are maintained in SketchUp:

Key

Location in SketchUp

Comments

City

Model Info > Location

City is referred to as Location in Sketchup

Country

Model Info > Location

 

Dark

Model Info > Shadows

 

DaylightSavings

 

 

DisplayNorth

Model Info > Location > Show In Model checkbox

 

DisplayOnAllFaces

Model Info > Shadows

 

DisplayOnGroundPlane

Model Info > Shadows

 

DisplayShadows

Model Info > Shadows

 

EdgeCastingShadows

Model Info > Shadows

 

Latitude

Model Info > Location > Set Custom Location

 

Light

Model Info > Shadows

 

Longitude

Model Info > Location > Set Custom Location

 

North Angle

Model Info > Location

 

ShadowTime

Model Info > Shadows

In Time section

SunRise

N/A

Generated based on ShadowTime

SunSet

N/A

 

Generated based on ShadowTime

Parent:Entity 

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

Example Code: shadowinfotests.rb

Class Methods


each_key

The each_key method is a class method that iterates through all of the shadow information keys.

Syntax

Sketchup::ShadowInfo.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:ShadowInfo.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::ShadowInfo.keys

Return Value

keys – an array of keys

Example 

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

Instance Methods


[]

The [] method retrieves a value from the array of keys

Syntax

value = shadowinfo["key"]

Arguments

"key" – the key of the shadowinfo value to retrieve.

Return Value

value – the value that is retrieved.

Example 

model = Sketchup.active_model
shadowinfo = model.shadow_info
value = shadowinfo["City"]
UI.messagebox value

 

 


[]= 

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

Syntax

value = shadowinfo[“key"]=value

Arguments

key – the key of the shadowinfo 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
shadowinfo = model.shadow_info
value = shadowinfo["City"]

UI.messagebox value
value = shadowinfo["City"]="Denver, CO"
UI.messagebox value

 

 


each 

The each method iterates through all of the shadow information key/value pairs.

Syntax

shadowinfo.each { | key, value | … }

Arguments

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

Example

model = Sketchup.active_model
shadowinfo = model.shadow_info # Iterate through each key and value displaying each in a message box

shadowinfo.each { | key, value | UI.messagebox key }

shadowinfo.each { | key, value | UI.messagebox value }

 

 


each_key 

The each_key method iterates through all of the shadow information keys.

Syntax

shadowinfo.each_key { | key | … }

Arguments

key – variable to hold each key as they are found

Example 

model = Sketchup.each_key
shadowinfo = model.shadow_info
# Iterate through each key, displaying each in a message box
shadowinfo.each_key { | key | UI.messagebox key }

 

 


each_pair 

An alias for each. See ShadowInfo.each

 

 


keys 

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

Syntax

keys = shadowinfo.keys

Return Value

keys – an array of keys

Example

model = Sketchup.active_model
shadowinfo = model.shadow_info
keys = shadowinfo.keys
key = keys[0]
UI.messagebox key