In some case you need add or delete many parameters. Spiderinnet did many great articles about parameters, here are 2 of them :
Some Revit addins and extensions are adding many parameters to you project. Some are not even visible to the user. It means that you have to use API to remove it. In most common case you’ll never see it unless you use Revit Lookup. But when you export your model or do a duct pressure loss report it appears on it. So I made a script to get quickly rid of unwanted parameters (hidden or not).
from Autodesk.Revit.DB import * from System import Guid uidoc = __revit__.ActiveUIDocument doc = __revit__.ActiveUIDocument.Document app = __revit__.Application #Retrieve all parameters in the document params = FilteredElementCollector(doc).OfClass(ParameterElement) filteredparams = [] #Store parameters which has a name starting with "magi" or "MC" for param in params: if param.Name.startswith(("magi", "MC")): #startswith method accept tuple filteredparams.append(param) print param.Name #To check if a parameter in the list is not supposed to be deleted #Delete all parameters in the list t = Transaction(doc, "Delete parameters") t.Start() for param in filteredparams: doc.Delete(param.Id) t.Commit()
Cheers !