-
Notifications
You must be signed in to change notification settings - Fork 86
Revit Batch Processor FAQ
Q) Can Revit Batch Processor process cloud-based models (BIM 360 Teams / Docs)?
A) (for RBP 1.60+) Yes, with limitations.
- For BIM360 hosted models, RBP requires that the Forge Project and Model IDs (Guids) to be specified in the Revit file list. These IDs can only be obtained via Forge API which is beyond the scope of RBP. So it is left to the user to obtain these IDs for their BIM360 project models.
- The format for specifying a cloud model in the Revit file list is:
<Revit version> <Project Guid> <Model Guid>
- Note: these three components must be separated by space(s) (not tabs!).
- e.g.
2020 75b6464c-ba0f-4529-b049-0de9e473c2d6 0d54b8cc-3837-4df2-8c8e-0a94f4828868
- RBP is not able to detect the Revit version of cloud models hence why the Revit version is specified explicitly.
- Special thanks to Dimitar Venkov (@dimven) for investigating ways of processing BIM360 cloud models for RBP!
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 it was decided to log these messages to the console, just in case.
Q) I have existing code written in C#, how can I execute this code using Revit Batch Processor?
A) You can execute functions in a C# DLL using a python task script!
When RBP runs the python task script, it adds the task script's folder path to the search paths so that if your DLL is in the same folder as your python task script you should be able to execute your functions as follows:
# For example assume your DLL is called MyUtilities.dll and you have a static function called SomeClass.DoSomeWork() in namespace MyNameSpace:
# Assume this python script exists in the same folder as MyUtilities.dll.
clr.AddReference("MyUtilities")
from MyNameSpace import SomeClass
# Invoke your static function, passing in any parameters you need.
SomeClass.DoSomeWork(doc)
Q) How do I Save or Synchronize changes to each processed file?
A) It is up to the Dynamo or Python script to take care of Saving or Synchronizing any modifications your script makes to the Revit file.
If you're using a Dynamo script you need to use a node that can perform one of these operations (there are several Dynamo packages out there with this functionality). If you're using a Python task script you can either use the Revit API functions directly, or look at using some of the Python helper functions that RBP provides by importing the module revit_file_util
and using some of the functions defined there (e.g. revit_file_util.SynchronizeWithCentral(...)
, revit_file_util.Save(...)
, revit_file_util.SaveAs(...)
etc.).
Q) RBP shows the Revit file version as NOT DETECTED!
but the file is a valid Revit file. Why is this happening?
A) It's possible that the Revit file is opened in another Revit session at the same time. Currently RBP can't extract Revit version information from a file that is already opened in a Revit session. (This may be fixed in a future release)