I once took over a Revit project that was an absolute mess. The modelling practices were sloppy, content was pulled in from everywhere, and the result was a bloated model filled with hundreds of unused parameters.
There were:
✅ Parameters from other consultants
✅ Random project parameters no one could explain
✅ Parameters from content downloaded online
✅ Duplicate parameters with the same names but different GUIDs
✅ ..and parameters from who-knows-where-else.
It was a mess. These weren’t just harmless leftovers; they were slowing down performance, cluttering the parameter list, and making it harder for the team to work efficiently.
At first, I tried using BIMLink and PlanWorks Tables to identify the empty parameters. While these tools helped spot the issues, they didn’t automate the cleanup. Deleting parameters manually wasn’t an option—I needed a better solution.
So, I wrote my own Revit API script to automatically detect and remove unused project parameters. Here’s how it works:
The script follows these steps:
1️⃣ Get all project parameters – It gathers all non-system parameters in the model.
2️⃣ Check parameter usage – It iterates through elements in the model, checking if the parameters contain any data.
3️⃣ Identify unused parameters – If a parameter is completely empty across the project, it’s flagged for removal.
4️⃣ Delete unused parameters – Using a Revit transaction, all flagged parameters are deleted automatically.
This solution made it easy to clean up over 400 unnecessary parameters in minutes.
Collecting the Parameters
I created the code as a Revit macro, where the core code collects the project parameters within the model.
Click to expand source code
class ProjectParameterData
{
public Definition Definition = null;
public ElementBinding Binding = null;
public string Name = null;
public bool IsSharedStatusKnown = false;
public bool IsShared = false;
public string GUID = null;
}
// Get all project parameters
static List<ProjectParameterData> GetProjectParameterData(Document doc)
{
if (doc == null)
throw new ArgumentNullException("doc");
if (doc.IsFamilyDocument)
throw new Exception("doc can not be a family document.");
List<ProjectParameterData> result = new List<ProjectParameterData>();
BindingMap map = doc.ParameterBindings;
DefinitionBindingMapIterator it = map.ForwardIterator();
it.Reset();
while (it.MoveNext())
{
ProjectParameterData newProjectParameterData = new ProjectParameterData
{
Definition = it.Key,
Name = it.Key.Name,
Binding = it.Current as ElementBinding
};
result.Add(newProjectParameterData);
}
return result;
}
Code language: PHP (php)
Checking for Unused Parameters
Once all project parameters are collected, the script loops through the model to determine if any of them contain actual values.
Click to expand source code
public void CheckAndRemoveUnusedParameters()
{
UIDocument uidoc = this.ActiveUIDocument;
Document doc = uidoc.Document;
var families = new FilteredElementCollector(doc).WhereElementIsNotElementType();
List<ProjectParameterData> projectParametersData = GetProjectParameterData(doc);
List<string> unusedParams = new List<string>();
IList<ElementId> paramsToBeDeleted = new List<ElementId>();
foreach (var param in projectParametersData)
{
bool isUsed = false;
foreach (var elem in families)
{
try
{
Parameter p = elem.LookupParameter(param.Name);
if (p != null && !string.IsNullOrEmpty(p.AsString()))
{
isUsed = true;
break;
}
}
catch (Exception) { }
}
if (!isUsed)
{
unusedParams.Add(param.Name);
}
}
DeleteUnusedParameters(doc, unusedParams);
}
Code language: PHP (php)
Deleting the Unused Parameters
After identifying unused parameters, we need to safely remove them from the project.
Click to expand source code
private void DeleteUnusedParameters(Document doc, List<string> paramNames)
{
IEnumerable<ParameterElement> allParams = new FilteredElementCollector(doc)
.WhereElementIsNotElementType()
.OfClass(typeof(ParameterElement))
.Cast<ParameterElement>();
IList<ElementId> paramsToDelete = new List<ElementId>();
foreach (var param in allParams)
{
if (paramNames.Contains(param.GetDefinition().Name))
{
paramsToDelete.Add(param.Id);
}
}
using (Transaction t = new Transaction(doc, "Remove Unused Parameters"))
{
t.Start();
foreach (var paramId in paramsToDelete)
{
doc.Delete(paramId);
}
t.Commit();
}
}
Code language: PHP (php)
This script saved me hours of manual work. In one run, it identified and removed all 400+ unused parameters, cleaning up the model and improving performance.
Unused parameters might seem like a small issue, but they add up. They slow down your model, confuse your team, and make it harder to maintain consistency. Automating this process saves time and creates a cleaner, more efficient workflow.
If you’re dealing with a messy Revit model, don’t let unused parameters weigh you down. Whether you use this script or build your own, automation can be a game-changer. And if you’re not sure where to start, feel free to adapt the code above, it’s saved me more than once!
Hi Ryan, Thanks for for sharing this. How can we use this? Is there Python version of this as well?
Hi Amir,
You will need to have macros enabled in your version of Revit, there are instructions on how to do that here: https://help.autodesk.com/view/RVT/2025/ENU/?guid=GUID-23497666-2918-4F91-A50A-402949070658
You will then need to create a new macro module, and then a new macro using c#, which there are instructions on how to do that here:
for 2025: https://help.autodesk.com/view/RVT/2025/ENU/?guid=GUID-D3A09447-BA7F-4045-88BF-EA8B37F0D46D
for 2024 and earlier: https://help.autodesk.com/view/RVT/2024/ENU/?guid=GUID-D3A09447-BA7F-4045-88BF-EA8B37F0D46D
There is also some great general guidance on how to create macros in 2024 and earlier here: https://www.archdaily.com/797619/how-to-write-your-first-revit-macro-in-7-easy-steps
Once you have compiled the macro, you can run it through the macro manager.
For the code that I’ve provided, it’s essentially like 3 parts that go together, the main macro and it’s two “helpers”
I’ve shared the macro in it’s entirety here: https://github.com/ryanlenihan/Revit_Macros/blob/main/PurgeProjectParams.cs
As for a python version, my best suggestion would be to use some kind of AI to convert the code for you. If you’re self hosting an LLM, my goto for code assistance is Codestral. Otherwise ChatGPT, Claude or others should be able to help you out.
Hi,
Have you seen issues where you deleted the project parameters but they still show in Revits Project Parameter dialog?
Thanks,
Dan
Hi Dan,
Would it by any chance be shared parameters that have been loaded into family? Possibly a family with the shared option ticked in the settings? There is an engineering company and an architecture firm that I deal with regularly, and their parameters are often ending up in everyone else’s files just by linking their models into ours.
Otherwise, if you 100% know that they’ve not come into your project from a family or a project file, and that they are random project parameters floating around in your model and this script doesn’t fix it, it means that the parameter must have been filled out somewhere in your model.
You could adjust the macro to save a report out to csv that you could then investigate. I have a new version of the code that would do that for you: https://github.com/ryanlenihan/Revit_Macros/blob/main/PurgeAndReportProjectParams.cs