PyRevit Cli multiple models

Hi All,

Been trying to get a command working with cli but with no avail. I have read the documentation which lists to set models to a list of file paths.

models is set to a list of model file paths

for model in models:
uidoc = HOST_APP.uiapp.OpenAndActivateDocument(model)
doc = uidoc.Document

When trying to make this work using the following command for the script: models = [“C:\Users\helmy\Desktop\Rvts\test.rvt”, “C:\Users\helmy\Desktop\Rvts\1234.rvt”] and for the cli command
pyrevit run C:\Users\helmy\Desktop\Rvts\ C:\Users\helmy\Desktop\Rvts\models.txt --revit=2022
I get an error that the “File is not a structured storage file”. However if I do this with a single model, it works absolutely fine.

Any help is appreciated. Thanks

adding --models= before the path of your models might help
pyrevit run C:\Users\helmy\Desktop\Rvts\ --models=C:\Users\helmy\Desktop\Rvts\models.txt --revit=2022

also, not sure if it changes anything but in your code, it should be
for model in __models__:

Life saver, thank you Jean

1 Like