Learning how to handle background documents in Python

Hello!

I am learning more Python and am having trouble working with docs- I cant iterate over a list of docs to open them all. I can open and close one doc though. Any idea why that is?

import clr

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager

clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

def tolist(input):
    result = input if isinstance(input, list) else [input]
    return result

filePaths = tolist(IN[0])
modelPaths = [ModelPathUtils.ConvertUserVisiblePathToModelPath(path) for path in filePaths]

doc = DocumentManager.Instance.CurrentDBDocument
app = doc.Application

docs =[] 

#for m in ModelPath:
    #docs.append(app.OpenDocumentFile(m, OpenOptions()))

OUT = ModelPath

ModelPath is the Revit class. You defined your list as modelPaths.

3 Likes

haha thats it. type-o. oof. need to use my IDE more. thanks!