I’m a newbie to Revit and Dynamo. Is it possible to delete multiple specific shared parameters in multiple families at once? For example: I have many window families in a folder on my computer that all contain the same shared parameters. I now want to remove 2 (as an example) shared parameters from all the window families. Instead of going into each family and removing the parameters manually, is it possible to remove the parameters from all the families at once?
And if that is possible, could I then also add multiple shared parameters to multiple families at once?
You can’t edit a family without opening it. You could programmatically open all the families, edit them, and save them, but that is pretty intensive compute wise, as you have to open all the files at once and Revit doesn’t like using that many documents at once.
Why not start a new project with no template, add all of the families and types to the project, delete the shared parameters, and then save out all the families using the “save as library” function?
Thanks for the reply. Are you suggesting that I open each family manually and delete the shared parameters in them as well? If so, then that is exactly what I’m trying to avoid. The reason I don’t want to do this manually is because this will happen often. The company I work at uses product numbers as shared parameters in their families. So all the window families have the same product number as a shared parameter in them. The problem is that the product number changes from time to time. This doesn’t only happen with the window families, but with all the other types of families as well. So ideally I need to find a way to delete the product number shared parameter in all families at once.
Please correct me if I missunderstood your suggestion.
Try this: Load a family with a shared parameter into a new project started from a template. In that project delete the shared parameter so that the family in the project no longer has a reference to the parameter. Then save as a library to push that family out of the project. Open the family you saved out, and see if the shared parameter is still there.
If that works for you then you’ll just have to run that process for whatever families you want to delete shared parameters from. It’s ~8 steps, but those 8 steps can be run on 10000 families at once, or 1 family.
I just tried that and unfortunately the parameter is still in the families.
As you can see the family still has all 4 test parameters even after I loaded it into a new project with no template, deleted the 3 test shared parameters and saved the family as a library.
Shoot. Thought that would be a simple work around. Sorry.
You’re into the “open each family programmatically” option now. Check out the latest Rhythm package and the Orchid package as one/both of those will be a must if you use nodes.
Totally possible from directories, and from project as well (but I’ve shown how to do via directory below - more stable approach in my experience. Most of the Python I’ve used is in my Crumple package but I’ve adjusted it to work one family document at a time, so if it hits any errors/crashes you get the work completed to a point at least.
Delete parameters in directory.dyn (15.9 KB)
# Made by Gavin Crump # Free for use # BIM Guru, www.bimguru.com.au # Boilerplate text import clr clr.AddReference("RevitServices") import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager clr.AddReference("RevitAPI") clr.AddReference("RevitAPIUI") import Autodesk from Autodesk.Revit.DB import * from Autodesk.Revit.UI import * # Current doc/app/ui uiapp = DocumentManager.Instance.CurrentUIApplication app = uiapp.Application # Define list/unwrap list functions def tolist(input): result = input if isinstance(input, list) else [input] return result # Preparing input from dynamo to revit pathList = tolist(IN) paraList = tolist(IN) # Track what happens results =  # For each family file path for path in pathList: # Open the family, get its name doc = app.OpenDocumentFile(path) docT = doc.Title # Get the family manager, and a subresult famMan = doc.FamilyManager famResult =  # Start a Revit transaction t = Transaction(doc, docT) t.Start() # Get all parameters in the document params = famMan.Parameters # For each parameter for param in params: # Get the parameters name p_nam = param.Definition.Name # If the parameter is in your list of names if p_nam in paraList: # Try to remove it, else pass try: famMan.RemoveParameter(param) famResult.append(p_nam + " deleted from " + docT) except: famResult.append(p_nam + " failed to delete from " + docT) # Finish a Revit transaction t.Commit() # Append the outcome results.append(famResult) # Close and save the document doc.Close(True) # Preparing output to Dynamo OUT = results
No problem! Thank you for your replies.
Gavin thank you so much!!! It worked. I’ve been beating my head around this for a couple of days now… Thank you for helping out the community.
I’ve got a Dynamo graph I created that generates a shared parameter report for a directory of families. After attempting to strip out “COMMON ID”, 3 families retain the shared parameter element. Do you know of a way to reset this binding so that it won’t appear in the report. Also, when you open any of the families still showing that parameter, it doesn’t show up anywhere in the family types dialog, only visible through the report generation.
Not familiar with family binding errors like this, but try the method at end of this thread maybe:
A thought: It may have been created to only be visible via the API…
Hi @GavinCrump, I hope you’re well!
Sorry to bring up an old thread, I thought it would work as a base as all the descriptions are already here…
I am trying to do exactly what the alshammary.l was asking, except with .rvt files, not family files. I want to delete multiple parameters from multiple Revit project files without having to individually open each one. Can this be done quite easily from the base you provided with Python?
Thanks so much
It can be done but how easily depends on your experience with Python and Revit API. Working from model is quite different to from a directory and requires an edit family > make changes > load/close workflow instead. I’ve built tools like this where I work but they’re quite complex, and I am unable to share the products here.
The building blocks are here however, hopefully that helps leave some leads:
Edit family from document:
Get family manager from family doc:
Use family manager to delete parameter:
Load back to document:
Close family doc (save = false):
Thanks for your reply!
Sorry, I don’t think I explained very well…
I don’t need to do anything with families, literally just need to delete parameters from the revit project file itself… But multiple revit project files in one directory which all share similar parameters.
Ah gotcha… opening project files with dynamo is risky. Maybe try dynamo multiplayer by bird tools?
This is the way.