123456789_123456789_123456789_123456789_123456789_

Class: Sketchup::ShadowInfo

Relationships
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Entity
Instance Chain:
self, Enumerable, Entity
Inherits: Sketchup::Entity

Overview

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 dialogs inside SketchUp.

The following shadow information keys are maintained in SketchUp:

  • City (in Model Info > Geo-location > Set Manual Location…) Note that ‘City’ is called ‘Location’ in the UI

  • Country (in Model Info > Geo-location > Set Manual Location…)

  • Dark (in Window > Shadows)

  • DayOfYear

  • DaylightSavings

  • DisplayNorth

  • DisplayOnAllFaces (in Window > Shadows)

  • DisplayOnGroundPlane (in Window > Shadows)

  • DisplayShadows (in Window > Shadows)

  • EdgesCastShadows (in Window > Shadows)

  • Latitude (in Model Info > Geo-location > Set Manual Location…)

  • Light (in Window > Shadows)

  • Longitude (in Model Info > Geo-location > Set Manual Location…)

  • NorthAngle

  • ShadowTime (in Window > Shadows)

  • ShadowTime_time_t (ShadowTime in Epoch time)

  • SunDirection (Generated based on ShadowTime)

  • SunRise (Generated based on ShadowTime)

  • SunRise_time_t (SunRise in Epoch time)

  • SunSet (Generated based on ShadowTime)

  • SunSet_time_t (SunSet in Epoch time)

  • TZOffset (in Window > Shadows)

  • UseSunForAllShading (in Window > Shadows)

You access the ShadowInfo object by calling Model#shadow_info:

Examples:

model = Sketchup.active_model
shadowinfo = model.shadow_info
puts "My city is: #{shadowinfo["City"]}"

Version:

  • SketchUp 6.0

Class Method Summary

Instance Attribute Summary

Entity - Inherited

#deleted?

The deleted? method is used to determine if your entity is still valid (not deleted by another script, for example.).

#valid?

The #valid? method is used to determine if your entity is still valid (not deleted by another script, for example).

Instance Method Summary

Entity - Inherited

#add_observer

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

#attribute_dictionaries

The attribute_dictionaries method is used to retrieve the AttributeDictionaries collection attached to the entity.

#attribute_dictionary

The attribute_dictionary method is used to retrieve an attribute dictionary with a given name that is attached to an Entity.

#delete_attribute

The #delete_attribute method is used to delete an attribute from an entity.

#entityID

The entityID method is used to retrieve a unique ID assigned to an entity.

#get_attribute

The #get_attribute method is used to retrieve the value of an attribute in the entity’s attribute dictionary.

#inspect

The #inspect method is used to retrieve the string representation of the entity.

#model

The model method is used to retrieve the model for the entity.

#parent

The parent method is used to retrieve the parent of the entity.

#persistent_id

The #persistent_id method is used to retrieve a unique persistent id assigned to an entity.

#remove_observer

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

#set_attribute

The set attribute is used to set the value of an attribute in an attribute dictionary with the given name.

#to_s

The #to_s method is used to retrieve the string representation of the entity.

#typename

The typename method retrieves the type of the entity, which will be a string such as “Face”, “Edge”, or “Group”.

Class Method Details

.each_key {|key| ... } ⇒ nil

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

Examples:

shadowinfo.each_key { |key| puts key }

Yield Parameters:

Version:

  • SketchUp 6.0

.keysArray<String>

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

Examples:

keys = Sketchup::ShadowInfo.keys

Returns:

Version:

  • SketchUp 6.0

Instance Method Details

#[](key) ⇒ Object?

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

Examples:

value = shadowinfo["key"]

Parameters:

  • key (String)

    The key of the shadowinfo value to retrieve.

Returns:

  • (Object, nil)

    the value that is retrieved.

Version:

  • SketchUp 6.0

#[]=(key, value) ⇒ Object

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

Examples:

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

Parameters:

  • key (String)

    The key of the shadowinfo value to set.

  • value (Object)

    The value to be set.

Returns:

  • (Object)

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

Version:

  • SketchUp 6.0

#add_observer(observer) ⇒ Boolean

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

Examples:

status = object.add_observer observer

Parameters:

  • observer (Object)

    An observer.

Returns:

  • (Boolean)

    true if successful, false if unsuccessful.

Version:

  • SketchUp 6.0

#countInteger

The count method is inherited from the Enumerable mix-in module.

Examples:

shadow_info = Sketchup.active_model.shadow_info
number = shadow_info.count

Version:

  • SketchUp 2014

#each {|key, value| ... } ⇒ nil

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

Examples:

model = Sketchup.active_model
shadow_info = model.shadow_info
shadow_info.each { |key, value|
  puts "#{key} : #{value}"
}

Yield Parameters:

See Also:

Version:

  • SketchUp 6.0

#each_key {|key| ... } ⇒ nil

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

Examples:

shadowinfo.each_key { |key| puts key }

Yield Parameters:

Version:

  • SketchUp 6.0

#each_pair {|key, value| ... } ⇒ nil

The #each_pair method is an alias for #each.

Examples:

model = Sketchup.active_model
shadow_info = model.shadow_info
shadow_info.each_pair { |key, value|
  puts "#{key} : #{value}"
}

Yield Parameters:

See Also:

Version:

  • SketchUp 6.0

#keysArray<String>

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

Examples:

keys = Sketchup::ShadowInfo.keys

Returns:

Version:

  • SketchUp 6.0

#lengthInteger

The #length method returns the number of options in the shadow options collection

Examples:

shadow_info = Sketchup.active_model.shadow_info
number = shadow_info.length

See Also:

Version:

  • SketchUp 2014

#remove_observer(observer) ⇒ Boolean

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

Examples:

status = object.remove_observer observer

Parameters:

  • observer (Object)

    An observer.

Returns:

  • (Boolean)

    true if successful, false if unsuccessful.

Version:

  • SketchUp 6.0

#sizeInteger

The #size method is an alias for #length.

Examples:

shadow_info = Sketchup.active_model.shadow_info
number = shadow_info.size

See Also:

Version:

  • SketchUp 2014