Document.IsFamilyDocument - wants Revit.Application.Document

I’m using Rhythm’s Application.GetOpenDocuments to get all the open documents and then trying to filter out projects. The rhythm node gives Autodesk.Revit.DB.Document but the Document.IsFamilyDocument requires Revit.Application.Document. Is there a way to convert this or is there another node I can use to get open documents that provides the correct output?

Warning:
Warning: Document.IsFamilyDocument expects argument type(s) (Revit.Application.Document), but was called with (Autodesk.Revit.DB.Document).

Hmm. That might need a python node since I’m returning the core revit.db object. Last time I looked at it, the wrapper for ‘Revit.Application.Document’ was not public.

I think this should work. Let me know because I typed it on my phone. :sweat_smile:


# import common language runtime 
import clr
# Import RevitAPI
clr.AddReference('RevitAPI')
# Import the appropriate classes we need
from Autodesk.Revit.DB import *

def IsFamDoc(doc):
    return doc.IsFamilyDocument
    
docs = IN[0]

#return the results
if isinstance(IN[0], list): OUT = [IsFamDoc(x) for x in docs]
else: OUT = IsFamDoc(docs)

6 Likes

I’m getting this warning.

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 14, in
File “”, line 9, in IsFamDoc
TypeError: bool is not callable

ah ok, i edited it to match watch should work. Generally “is not callable” means to remove the ().

Also, I got this worked out and will be updating Rhythm shortly.

1 Like

Your a superstar. I haven’t had a chance to test the fix to the python you posted earlier but I will check both that and the package update as soon as I have time. Thanks.

1 Like

Sweet. On the package manager now.
image

End the week on a good note! Thanks

1 Like