Class: Sketchup::Materials
| Relationships | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
Entity
|
|
|
Instance Chain:
self,
Enumerable,
Entity
|
|
| Inherits: |
Sketchup::Entity
|
Overview
A collection of Materials objects. Each model contains a Materials collection that can be accessed via Model.materials.
Instance Attribute Summary
-
#current ⇒ Sketchup::Material
rw
The current method is used to get the current material, i.e.
-
#current=(material) ⇒ Sketchup::Material
rw
The current= method is used to set the current material.
Entity - Inherited
Instance Method Summary
-
#[](index) ⇒ Sketchup::Material?
The #[] method is used to retrieve a material by index or name.
-
#add(name) ⇒ Sketchup::Material
Add a new
Material. -
#add_observer(observer) ⇒ Boolean
The add_observer method is used to add an observer to the materials collection.
-
#[](index) ⇒ Sketchup::Material?
The #[] method is used to retrieve a material by index or name.
- #count ⇒ Integer
-
#each {|material| ... } ⇒ Sketchup::Materials
The #each method is used to iterate through all of the materials.
-
#length ⇒ Integer
The number of materials in the collection.
-
#load(filename) ⇒ Sketchup::Material
The #load method is used to load a material from file into the model.
-
#purge_unused ⇒ Sketchup::Materials
The purge_unused method is used to remove unused materials.
-
#remove(material) ⇒ Boolean
Remove a given material.
-
#remove_observer(observer) ⇒ Boolean
The remove_observer method is used to remove an observer from the materials collection.
-
#size ⇒ Integer
The number of materials in the collection.
-
#unique_name(name) ⇒ String
The #unique_name method is used to retrieve a unique name from the materials collection that is based on the provided one.
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 |
| #attribute_dictionary | The attribute_dictionary method is used to retrieve an attribute dictionary with a given name that is attached to an |
| #delete_attribute | The |
| #entityID | The entityID method is used to retrieve a unique ID assigned to an entity. |
| #get_attribute | The |
| #inspect | The |
| #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 |
| #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 |
| #typename | The typename method retrieves the type of the entity, which will be a string such as “Face”, “Edge”, or “Group”. |
Instance Attribute Details
#current ⇒ Sketchup::Material (rw)
The current method is used to get the current material, i.e. the material that the user has selected in the Materials dialog.
#current=(material) ⇒ Sketchup::Material (rw)
The current= method is used to set the current material.
Instance Method Details
#[](index) ⇒ Sketchup::Material?
#[](name) ⇒ Sketchup::Material?
The #[] method is used to retrieve a material by index or name.
The #at method is an alias of #[]
#add(name) ⇒ Sketchup::Material
Add a new Material. When called with no arguments, this will generate a new unique name for the new Material. If a name is given, it will check to see if there is already a material with that name. If there is already a material with the given name, then a new unique name is generated using the given name as a base.
#add_observer(observer) ⇒ Boolean
The add_observer method is used to add an observer to the materials collection.
#[](index) ⇒ Sketchup::Material?
#[](name) ⇒ Sketchup::Material?
#count ⇒ Integer
Since SketchUp 2014 the count method is inherited from Ruby’s Enumerable mix-in module. Prior to that the #count method is an alias for #length.
#each {|material| ... } ⇒ Materials
Don’t remove content from this collection while iterating over it with #each. This would change the size of the collection and cause elements to be skipped as the indices change. Instead copy the current collection to an array using to_a and then use each on the array, when removing content.
The #each method is used to iterate through all of the materials.
#length ⇒ Integer
#load(filename) ⇒ Sketchup::Material
The #load method is used to load a material from file into the model.
If a matching material exist in the model it will be returned instead.
#purge_unused ⇒ Materials
The purge_unused method is used to remove unused materials.
#remove(material) ⇒ Boolean
Remove a given material.
#remove_observer(observer) ⇒ Boolean
The remove_observer method is used to remove an observer from the materials collection.
#size ⇒ Integer
#unique_name(name) ⇒ String
The #unique_name method is used to retrieve a unique name from the materials collection that is based on the provided one. If provided name is unique it will be returned, otherwise any trailing indices will be replaced by a new index.