class Materials |
Parent: Entity |
|
| |
Sample Code: materialstests.rb |
|
Instance Methods |
[] |
The [] method is used to retrieve a material by index or name. |
Syntax: |
material = materials[index] material = materials "name" |
Arguments: |
index - a number representing the material's index in an array of Material objects "name" - the name of the material |
Return Value: |
material - a Material object |
Comments: |
|
Example: |
model = Sketchup.active_model |
add |
The add method is used to add a material. |
Syntax: |
materials.add material = materials.add "name" |
Arguments: |
"name" - the name of the added Material object |
Return Value: |
material - the newly added Material object |
Comments: |
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 gnerated using the given name as a base. |
Example: |
|
at |
The at method is an alias for []. See []. |
Syntax: |
|
Arguments: |
|
Return Value: |
|
Comments: |
|
Example: |
|
count |
The count method is an alias for length. See length. |
Syntax: |
|
Arguments: |
|
Return Value: |
|
Comments: |
|
Example: |
|
each |
The each method is used to iterate through all of the materials. |
Syntax: |
materials.each {| material | ...} |
Arguments: |
material - a variable that will hold each Material object as they are found. |
Return Value: |
|
Comments: |
|
Example: |
model = Sketchup.active_model |
length |
The length method retrieves the number of materials. |
Syntax: |
length = materials.length |
Arguments: |
|
Return Value: |
length - the number of entities in the collection of entities if successful |
Comments: |
|
Example: |
model = Sketchup.active_model |