Announcements

Announcement: We’re aware of an issue affecting starting a new topic from category pages and creating new blog posts. New topics can still be started directly from the relevant board. Learn more here.

Open every family in a directory & sub directory, see if a nested family exists, if it does - swap it with another nested family

Open every family in a directory & sub directory, see if a nested family exists, if it does - swap it with another nested family

EATREVITPOOPCAD
Collaborator Collaborator
556 Views
2 Replies
Message 1 of 3

Open every family in a directory & sub directory, see if a nested family exists, if it does - swap it with another nested family

EATREVITPOOPCAD
Collaborator
Collaborator

The title says it all... 

 

I would like to make a plugin, that when executed will not affect whatever current open project is at all. Instead, it will go to a given directory and its sub-directories, open each RFA file, see if there is a nested family in it with a specific file name and if it exists swap it with another nested family by file name, and then saves changes. If the open family does not contain a nested family with a specific name, then it will just close the file without saving any changes.

 

Would like to get advice and pointers from this wonderful community. Is this easy as it sounds? Any similar examples out there? I've seen a few examples of doing this within the open Revit project, but not the way I described it above.

The definition of insanity is doing the same thing over and over again and expecting different results
0 Likes
557 Views
2 Replies
Replies (2)
Message 2 of 3

RPTHOMAS108
Mentor
Mentor

The opening and looking for nested families is easy in part*. The more difficult part is swapping the family without breaking existing functionality. The nested family may be used in a way where its parameters are driven through the host family. Swapping the family out would likely break that relationship additionally if the family is of a different category, then that will also affect the parameters that refer to it. So you would have to first build a map of existing relationships to then transfer those over to the replacement. I think also nesting level makes these kinds of tasks inherently complex. You may be ok if the linked parameters are like for like but you would have to test that since I wouldn't bank on it.

 

*In terms of comparing family file names the nearest you'll get to that is perhaps by editing the nested family and looking at the path. So in effect you would have to edit every single family to get the path in order to identify if it is the family you want to change. The family name alone would not be adequate.

 

 

Message 3 of 3

EATREVITPOOPCAD
Collaborator
Collaborator

Ahhh you shot my hopes down pretty quickly... It did sound easy until you mentioned this... I will dig around, hopefully a good chunk of them are placed with same origin and no constraints 🤞(ADA clearances at various elements) Thanks @RPTHOMAS108  

The definition of insanity is doing the same thing over and over again and expecting different results
0 Likes