Getting Family Category & DWG Import Query From .rfa Files

I am trying to build a graph that would check all of a .rvt project’s families for any imported DWGs. I started off trying to get the graph to export all of the .rfa files as part of the process, but abandoned that, and will just have people save their .rfa library out from within Revit.

Now - 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). To help clarify the results, I wanted to use the “read text” trick mentioned in this thread to get the family categories for the problematic families, and include them in the output.

Now - 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, because the files were all being used by some other thing at the time.

I tried adding a passthrough node to try to get the two parts of 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)

UPDATE: I discovered i couldn’t edit (rename, delete, etc) any of the families in the folder i had made, until i closed my Revit session. Windows gave me the same error message, that the files were being used by another process.

I tried running the graph in Dynamo Sandbox, since the operations were being performed on files in a directory, and not in an open Revit Document, but the Bimorph Node: CAD.ReportInstances doesn’t work in Sandbox.

I then tried running the graph in Dynamo with only a blank revit file open (rather than the project from which the families came. But I got the same error at the File.ReadText node:
Warning: File.ReadText operation failed. The process cannot access the file ‘[first file name in the list]’ because it is being used by another process.

If the node that is accessing and locking down the .rfa files is the Bimorph Node CAD.ReportInstances, then i am wondering if i can rearrange the whole graph and have it read all the Model Category info first and compile a list, use the passthrough then, and filter the list down later after the CAD.ReportInstances node runs its course. I suspect that even if this approach works for a single running of the graph, i will get busy errors again if i try to run the graph a second time before restarting revit.

i am curious if there is a flaw in the Bimorph node that is keeping the .rfa files active after it has grabbed the info it was looking for.

I realize I am just talking to myself, but I am hoping - if nothing else - others may find this process helpful.

Reordering the operations worked as i had hoped, and my suspicion that it would fail if re-run was confirmed as well. It seems all of the .rfa files are being left open in the background of Revit, because neither closing Dynamo, nor closing the Revit file i had open at the time was sufficient. I needed to close all of Revit (which took extra time, since it had to close all of the invisible background documents) before i could run the graph again.

SO, NEW QUESTION - Is there a way to get Dynamo to close all of the background documents in Revit, without closing the active document, let alone Revit or Dynamo?

See what happens if you wire a true boolean into the ‘close’ input in the ‘cad report instances’ node.

I’ve been trying to work out certain issues that I keep running into, and would like to discuss this with you so I can understand a little more of what I am doing - Let me know if you can help

1 Like