Importing materials in Revit can be challenging due to limitations in API access. Revit, like Autodesk Inventor, relies on a standard material library, but unlike Inventor, it does not provide direct programmatic access to the material browser.
How It Works: Importing Materials in Revit
To import a material into a Revit project, follow these steps:
- Prepare the Material Source
- Ensure the material exists in a Revit family (.rfa file) as Revit does not allow direct imports.
- Create a material with the necessary properties (e.g., colour, texture, and reflectivity).
- Load the Family into Revit
- Use the Revit API to load the .rfa file containing the material.
- When loaded, the material will automatically transfer to the project.
- Remove the Family, Keep the Material
- Delete the imported family while retaining the material in the project’s material browser.
- This ensures that the project remains uncluttered while making the material accessible.

Automating Importing Materials in Revit with the API
Using Revit’s API, you can streamline this workflow. Below is an example of how to automate the process using C# (See more about the C#):
public static Material? FindMaterial(Autodesk.Revit.DB.Document doc, string materialName)
{
// Search for the material if not then load it in
Material? m = GetMaterial(doc, materialName);
m ??= LoadMaterialFromLibrary(doc, materialName);
return m;
}
// Search for the material in the current project
private static Material? GetMaterial(Autodesk.Revit.DB.Document doc, string materialName) =>
new FilteredElementCollector(doc)
.OfClass(typeof(Material))
.Cast<Material>()
.FirstOrDefault(m => m.Name.Equals(materialName, StringComparison.OrdinalIgnoreCase));
private static Material? LoadMaterialFromLibrary(Autodesk.Revit.DB.Document doc, string materialName)
{
// load material into doc
string familyPath = $"C:\\temp\\Revit\\Materials\\{materialName}.rfa";
if (!File.Exists(familyPath))
{
Debug.WriteLine("Error", $"Family file not found: {familyPath}");
return null;
}
if (doc.LoadFamily(familyPath, out Family loadedFamily))
{
doc.Delete(loadedFamily.Id);
return GetMaterial(doc, materialName);
}
else
{ return null;}
}
This script loads a family into the project and removes it immediately, leaving only the material behind.
For additional details on the Revit API and material handling, refer to the official Revit API documentation.
Benefits of Using This Workaround
- Bypasses material import limitations within the Revit API.
- Maintains a clean project file by preventing unnecessary family clutter.
- Automates material handling for efficiency in large-scale projects.
Final Thoughts
Importing materials into Revit using the API requires creativity due to system limitations. By leveraging family files, you can introduce new materials efficiently without manual intervention.
Interested in optimising your workflow? Contact us today to learn how we can streamline your Revit processes!
Leave a Reply