I’ve been trying to follow the batch processing instructions here:
However, I encounter no luck with the inputting the *.txt file for the model list,
here is my test_model.txt file:
C:\test\test_family.rfa
C:\test\test_family2.rfa
here is the dummy.py file i followed based on the instruction on the web:
from pyrevit import HOST_APP
for model in __models__:
uidoc = HOST_APP.uiapp.OpenAndActivateDocument(model)
doc = uidoc.Document
# do something here with the document
print(doc.Title)
and this is the command i run:
pyrevit run “C:\CLI\dummy.py” “C:\test\test_model.txt”
it came with this error: Error: File is not a structured storage file
I have to do this workaround by running a “primer” Revit mode (a template revit model” and then put the list of models like so:
pyrevit run “C:\CLI\main.py” “C:\test\primer.rvt”
and in main.py i include a list of models to open:
from pyrevit import HOST_APP
import os
MODEL_DIR = "C:\revit_models_dir"
for model in os.listdir(MODEL_DIR):
model_path = os.path.join(MODEL_DIR,model)
uidoc = HOST_APP.uiapp.OpenAndActivateDocument(model_path)
doc = uidoc.Document
print(doc_title)
Then it works, but I can’t use doc.Close()
can someone advise what i’m doing is right?