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).


Q) I have two versions of Dynamo for Revit installed. Which version will Revit Batch Processor use?

A) Revit Batch Processor won't run Dynamo task scripts if two versions of Dynamo are installed on the system. This is due to the fact that the Dynamo modules aren't loaded in Revit until a Dynamo version is selected in the UI. Unfortunately I haven't found a reliable method to automate the version selection yet, so you must have EXACTLY ONE version of Dynamo installed.


Q) I am seeing strange error messages starting with [REVIT ERROR MESSAGE] in the console output. What are they?

A) Revit Batch Processor reads the internal Revit error stream and logs it to the console. Such messages are either coming from Revit application itself or from other addins. More often than not these messages can be safely ignored because they are internal debug messages.

However, in the case of a Revit crash or other serious error, they can provide useful information for troubleshooting, so I chose to log these messagesin the console, just in case.

Clone this wiki locally