Skip to content

Revit Batch Processor FAQ

Dan Rumery edited this page Apr 27, 2019 · 24 revisions

Q) Can Revit Batch Processor process cloud-based models (BIM 360 Teams / Docs)?

A) No, although this capability may be added in a future version.


Q) My python script works in Revit Python Shell. Will it work as a task script for Revit Batch Processor?

A) Yes, with some modifications. Your will need to add the following initialization code to the top of the script:

import clr
import System
clr.AddReference("System.Core")
clr.ImportExtensions(System.Linq)

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

import revit_script_util
from revit_script_util import Output

sessionId = revit_script_util.GetSessionId()
uiapp = revit_script_util.GetUIApplication()
app = uiapp.Application

# NOTE: retrieving the document only makes sense when running in batch Revit file processing mode.
doc = revit_script_util.GetScriptDocument()

# NOTE: this is the *original* Revit file path (e.g. Central model file path if detaching from Central).
revitFilePath = revit_script_util.GetRevitFilePath()

# TODO: some real work here
Output()
Output("This task script is running!")

Note specifically that Revit Python Shell provides a global variable __revit__ that points to the UIApplication instance, whereas Revit Batch Processor requires you use revit_script_util.GetUIApplication() to obtain this object instead. Also, instead of using python print statements, you must use the Output() function if you want the output to appear in the Revit Batch Processor output (in the GUI console and the log file).

Clone this wiki locally