|
SketchUp Ruby API Reference |
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
The each_key method is a class method that iterates through all of the shadow information keys.
Sketchup::ShadowInfo.each_key { | key | … }
key – variable to hold each key as they are found
# Iterate through each key, displaying each in a message box
Sketchup:ShadowInfo.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::ShadowInfo.keys
keys – an array of keys
# Retrieve the first key
key = Sketchup::ShadowInfo.keys[0]
UI.messagebox key
The [] method retrieves a value from the array of keys
value = shadowinfo["key"]
"key" – the key of the shadowinfo value to retrieve.
value – the value that is retrieved.
model = Sketchup.active_modelshadowinfo = model.shadow_infovalue = shadowinfo["City"]UI.messagebox value
The set value ([]=) method is used to set the value in the array of shadow info options.
value = shadowinfo[“key"]=value
key – the key of the shadowinfo 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
shadowinfo = model.shadow_info
value = shadowinfo["City"]
UI.messagebox value
value = shadowinfo["City"]="Denver, CO"
UI.messagebox value
The each method iterates through all of the shadow information key/value pairs.
shadowinfo.each { | key, value | … }
key, value – variables that will hold each key and value as they are found.
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 }
The each_key method iterates through all of the shadow information keys.
shadowinfo.each_key { | key | … }
key – variable to hold each key as they are found
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 }
An alias for each. See ShadowInfo.each
The keys method returns an array with all of the attribute keys
keys = shadowinfo.keys
keys – an array of keys
model = Sketchup.active_model
shadowinfo = model.shadow_info
keys = shadowinfo.keys
key = keys[0]
UI.messagebox key