Properties
Overrides: CommonComponentTable<T>.ComponentType
At all times, there is a "current" material. Unless otherwise specified, new objects are assigned to the current material. The current material is never locked, hidden, or deleted.
Gets or sets the current material source.
Indexers
this[]
#Conceptually, the material table is an array of materials. The operator[] can be used to get individual materials. A material is either active or deleted and this state is reported by Material.IsDeleted.
Remarks: Detaching a worksession reference model, or purging a linked instance definition, removes its materials but leaves the table slots they occupied empty; the slots cannot be closed up, because table indices are persistent references that objects store. Count spans the empty slots and they accumulate for the life of the document. An index that lands on one returns the default material rather than throwing, and nothing about it says it is a stand-in except its index, which is -1 and never the index you asked for - so test index == Materials[index].Index before treating an entry as real. Enumerating the table with foreach goes through the document manifest rather than the raw table array, so it does not visit empty slots at all. See RH-97389.
Parameters:
| index (int) | zero based array index. |
Returns: If index is out of range, the current material is returned.
Methods
Adds a new material to the table based on the default material.
Returns: The position of the new material in the table.
Adds a new material to the table based on a given material.
Adds a new material to the table based on a given material.
Parameters:
| material (Material) | A model of the material to be added. |
Returns: The position of the new material in the table.
Clear
public void Clear()
Marks all items as deleted.
Parameters:
| item (Material) |
Overrides: CommonComponentTable<T>.Delete
Removes a material at a specific position from this material table.
Parameters:
| materialIndex (int) | The position to be removed. |
Returns: true if successful. false if materialIndex is out of range or the material cannot be deleted because it is the current material or because it material contains active geometry.
Finds a material with a matching id.
Finds a material index.
Finds a material with a given name.
FindId
Uses the guid to find a model component. Deleted objects cannot be found by id. The guid is the value that is stored in the .Id property. In a single document, no two active objects have the same guid. If an object is replaced with a new object, then the guid persists. For example, if the _Move command moves an object, then the moved object inherits its guid from the starting object. If the Copy command copies an object, then the copy gets a new guid. This guid persists through file saving/opening operations. This function will not find grip objects.
Retrieves a Material object based on Index. This search type of search is discouraged. We are moving towards using only IDs for all tables.
Parameters:
| index (int) | The index to search for. |
Returns: A Material object, or null if none was found.
GetEnumerator
Returns the enumerator that yields all items.
Modify material settings.
Parameters:
| newSettings (Material) | This information is copied. |
| materialIndex (int) | zero based index of material to set. This must be in the range 0 <= layerIndex < MaterialTable.Count. |
| quiet (bool) | if true, information message boxes pop up when illegal changes are attempted. |
Returns: true if successful. false if materialIndex is out of range or the settings attempt to lock or hide the current material.
Parameters:
| item (Material) |