GetMaterialIds Method


Gets the element ids of all materials present in the element.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)
Since: 2014

Syntax

C#
public ICollection<ElementId> GetMaterialIds(
	bool returnPaintMaterials
)
Visual Basic
Public Function GetMaterialIds ( _
	returnPaintMaterials As Boolean _
) As ICollection(Of ElementId)
Visual C++
public:
ICollection<ElementId^>^ GetMaterialIds(
	bool returnPaintMaterials
)

Parameters

returnPaintMaterials
Type: System Boolean
If true, this returns material ids assigned to element faces by the Paint tools. If false, this returns ids associated to the material through its geometry or compound structure layers.

Return Value

The set of material ids.

Remarks

The returned collection of materials will be empty in any of the following situations:
  • The returnPaintMaterials flag is false, and the Category.HasMaterialQuantities property of the element's Category is false.
  • The returnPaintMaterials flag is true, and the the element does not have any painted faces.
Any material ids returned by this method can be used in GetMaterialArea() to get the calculated area associated to the material. Non-paint materials ids returned by this method can be used in GetMaterialVolume() to get the volume associated to the material.

See Also