Get Family Category from Rfa

Hi All,

This was a request on Twitter, I’ve had a play and I can’t get it to work with @erfajo and @john_pierson 's awesome nodes and there doesn’t seem to be any access to the family category from a document in the Revit API…? Forgive my Python failings!

http://www.revitapidocs.com/2018.1/87546ba7-461b-c646-cbb1-2cb8f5bff8b2.htm
http://www.revitapidocs.com/2018.1/9a38d78f-5d4f-b59b-52b4-197017d2038a.htm

Any help would be very gratefully received!

Cheers,

Mark

ReadFamilyWriteToExcel.dyn (16.6 KB)

1 Like

Reading the RFA’s text value seemed to work well for me. This means Revit doesn’t have to open it. :slight_smile:

GetFamilyCategoriesWithoutOpening.dyn (13.6 KB)

3 Likes

Nuts, I just went to bed! I can’t look until the morning :frowning:

Thanks for that awesome speed of response, if the rfa was a window called StoneSurround (I kid you not, just today I found one) would it still work? :slight_smile:

Thanks for all your incredible work!

Mark

EDIT: This is much more sophisticated than I guessed, who knew you could open an .rfa as a text file?! I will investigate!

Looking forward to seeing what you’ve been up to @erfajo! Hopefully there will be another great linked-in post, or even better a simulcast!

2 Likes

Fantastic, thanks!

If the families are named properly (via Dynamo) and you have millions of them, John’s would probably be the fastest, so definitely a good solution…

But I would be very interested to know your method! I expect the code will be locked away in a zero touch node, but would you mind showing us how you do it when you post the node?

Have fun at the DUG, Copenhagen is such a wonderful city!

Cheers,

Mark

Here’s my graph and John’s solution working for me…

GetFamilyCategoriesWithoutOpening-MKA.dyn (24.7 KB)

4 Likes

Glad it worked out! Apologies if I wasn’t clear what it was doing in the first place. The graph was reading the full text data of the RFA and getting the category name within than text. I might have made it incorrectly seem like it was relying on filename.

Thanks for sharing! This was super helpful for my team and I. I made a modification to include subfolders. In other words, this version of the graph will “obtain the family files from the directory [and its sub-directories] without opening them”. I hope this helps:


GetFamilyCategoriesFromFolder SubfoldersWithoutOpening.dyn (53.2 KB)

2 Likes

I was trying to take some pieces of this and apply it to a Graph i was making that would check all Project Families for any imported DWGs. I was able to get the graph to function, but the Output names of the families could sometimes be confusing as to what family type a particular family was (better family naming conventions might help… but that’s beside the point).

So - i wanted to use the “read text” trick to get the family categories for the problematic families, and include it in the output.

The problem I am having is twofold… Originally, i was getting error messages that the .rfa files couldn’t be read by the File.ReadText node, becasue the files were all being used by some other thing at the time.

I added passthroughs to try to get the two part sof the graph to work in sequence, but then i started getting warnings that “Cyclic Dependencies Exist Between Two Variables”

I am not sure if that is now why the .rfa files aren’t being read - or if the issue is still that the files are “busy”

Anyway - here is my graph and .dyn file. Any thoughts?
Check Project Families for CAD.dyn (26.6 KB)