Properties

ComponentType

#Since v6.0
public override ModelComponentType ComponentType { get; }

Count

public virtual int Count { get; }
Returns the count of all items, including deleted ones.
inherited fromCommonComponentTable<T>

CurrentMaterialIndex

#Since v5.0
public int CurrentMaterialIndex { get; set; }
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.

CurrentMaterialSource

#Since v5.0
public ObjectMaterialSource CurrentMaterialSource { get; set; }
Gets or sets the current material source.

Document

public RhinoDoc Document { get; }
Document that owns this table.
inherited fromRhinoDocCommonTable<T>

Indexers

this[]

#
public Material this[int index] { get; }
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.
index (int)zero based array index.
If index is out of range, the current material is returned.

Methods

Add

#Since v5.0
public int Add()
Adds a new material to the table based on the default material.
The position of the new material in the table.

Add

#Since v5.0
public int Add(Material material, bool reference)
Adds a new material to the table based on a given material.
material (Material)A model of the material to be added.
reference (bool)true if this material is supposed to be a reference material. Reference materials are not saved in the file.
The position of the new material in the table.

Add

#Since v5.0
public int Add(Material material)
Adds a new material to the table based on a given material.
material (Material)A model of the material to be added.
The position of the new material in the table.

Clear

public void Clear()
Marks all items as deleted.
inherited fromCommonComponentTable<T>

Delete

#Since v6.0
public override bool Delete(Material item)
item (Material)

DeleteAt

#Since v5.0
public bool DeleteAt(int materialIndex)
Removes a material at a specific position from this material table.
materialIndex (int)The position to be removed.
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.

Find

#Since v5.0
public int Find(Guid materialId, bool ignoreDeletedMaterials)
Finds a material with a matching id.
materialId (Guid)A material ID to be found.
ignoreDeletedMaterials (bool)If true, deleted materials are not checked.
>=0 index of the material with the given name -1 no material has the given name.

Find

#Since v8.0
public int Find(Material material, bool ignoreDeletedMaterials)
Finds a material index.
material (Material)Material to search for.
ignoreDeletedMaterials (bool)true means don't search deleted materials.
>=0 index of the material -1 no material matchin material.

Find

#Since v5.0
public int Find(string materialName, bool ignoreDeletedMaterials)
Finds a material with a given name.
materialName (string)Name of the material to search for. The search ignores case.
ignoreDeletedMaterials (bool)true means don't search deleted materials.
>=0 index of the material with the given name -1 no material has the given name.

FindId

public virtual T FindId(Guid id)
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.
inherited fromCommonComponentTable<T>
id (Guid)ID of model component to search for.
Reference to the rhino object with the objectId or null if no such object could be found.
FindId

FindIndex

#Since v6.0
public Material FindIndex(int index)
Retrieves a Material object based on Index. This search type of search is discouraged. We are moving towards using only IDs for all tables.
index (int)The index to search for.
A Material object, or null if none was found.

GetEnumerator

public virtual IEnumerator<T> GetEnumerator()
Returns the enumerator that yields all items.
inherited fromCommonComponentTable<T>

Modify

#Since v5.0
public bool Modify(Material newSettings, int materialIndex, bool quiet)
Modify material settings.
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.
true if successful. false if materialIndex is out of range or the settings attempt to lock or hide the current material.

ResetMaterial

#Since v5.0
public bool ResetMaterial(int materialIndex)
materialIndex (int)
Explicit

ICollection<Material>.Add

#Since v5.0
void ICollection<Material>.Add(Material item)
item (Material)