TypeError: expected Document, got Document / Orchid


I have a problem when using Orchid nodes (for example Document.Purge, like in image bellow) :

  • if I use the node Document.BackgroundOpen (from Orchid) to open a .rvt file, I can use the node Document.Purge, BUT my python script does not work (TypeError: expected Document, got Document)
  • if I use another node to open a .rvt file (for example, rhythm node Applications.OpenDocumentFile), my python script works well, BUT the Orchid node Document.Purge (or another node from Orchid) does not work anymore

In my python script :

  • doc = IN[0]
  • I also tried with : doc = UnwrapElement(IN[0]), but the result is the same

the line 51 is :
importedlinks = Autodesk.Revit.DB.FilteredElementCollector(doc).OfClass(Autodesk.Revit.DB.ImportInstance)

It seems that the “type” of document is not the same in Orchid than in Dynamo, but I don’t know how to solve that problem. Is there a way to “translate” an Orchid document to “dynamo document”? I could then use the solution in my first example, with a slightly modified python script to make it work, for example (or intermediate node to make the conversion…).

I’m fairly new to dynamo, so maybe I miss something simple…

By the way, thank you a lot for the Orchid package, it’s really usefull!



The documents used by the Orchid package are an Orchid version of the documents and aren’t compatibles with other packages (which use the Document class of the Revit API).

Use the Purge Unused node instead which additionally has an option to remove unused view templates, view filters and imported line Patterns.
Purge Unused


Hi @Alban_de_Chasteigner,

Thank you for your quick answer. It seems to work!