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 !
Hi.
Will you consider making a script in pyRevit described in you first link which will import project parameters via a temporary shared parameters file?
Maybe it’s possible to import the script in the link, but I don’t know how.
Best regards, Kyrre.
Hi Kyrre,
Could you explain a bit what would be the goal of the script ?
When I want to copy shared parameter from a project to another I just use the built-in Revit function «Transfer Project Standards» to transfer all projects parameters. If I want to import only specific parameters, I create a schedule which contains all the parameters I want to copy. Then I copy the schedule from source project to target project.
The linked code is written is C# so you cannot just copy paste it or something like this but it should be pretty easy to do one for pyRevit.
Best Regards,
Cyril