March 27, 2017 | Bill Allen
I recently was working on a Revit template, and wanted to rename a lot families within the template. Now I could go through the manual and tedious process of renaming all the families. The other option would be to write a script that would do it for me (and for future projects).
Here is the full script. Very simple.
The "All Elements of Type" node paired with the "Element Types" node grabs all families whether placed or NOT. This is really critical as I always tend to use the "All Elements of Category" Node, however the "All Elements of Category" node only grabs placed elements, not unplaced elements. I wanted all families in the file, not just the placed ones.
Next I wanted to set up a filter, so I could target only the families I wanted to rename. In this case, the window families had a CSI prefix of 0842, so that became my filter criteria. You can pick whatever filter criteria you would like for your project.
Next, I needed to Find and Replace, so I could rename my families. It's worth mentioning I originally used the string from object node in lieu of the Element.Name. That didn't work, so John Pierson @60secondrevit told me to use the "Element.Name" node instead. This one is available in the Clockwork package
Finally I used the Element.SetName node (Also it the Clockwork Package) to push the change back to the families.
Again, here is the final script in it's entirety. Simple, but useful.
If you want this script, you can download it from here- Dynamo Script
Did you know EvolveLAB can host Dynamo Workshops at your office or build custom scripts for your project? Reach out to Bill at bill.allen@evolvelab-inc.com to find out more.
Bill Allen is the managing principal for EvolveLAB, helping Architects, Engineers, and Contractors be successful with their processes. Bill is also a regular speaker at Autodesk University, The BIM Workshops, and the Design Symposiums. If you would like to connect with Bill, reach out directly at bill.allen@evolvelab-inc.com
1 comment:
This is great.
Post a Comment