Revit 2025.3 API
ElementGet |
Gets the element ids of all materials present in the element.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.3.0.0 (25.3.0.0)
Syntax
public ICollection<ElementId> GetMaterialIds( bool returnPaintMaterials )
Public Function GetMaterialIds ( returnPaintMaterials As Boolean ) As ICollection(Of ElementId)
public: ICollection<ElementId^>^ GetMaterialIds( bool returnPaintMaterials )
member GetMaterialIds : returnPaintMaterials : bool -> ICollection<ElementId>
Parameters
- returnPaintMaterials 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
ICollectionElementIdThe set of material ids.

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.
See Also