bvn-architecture / RevitBatchProcessor

Fully automated batch processing of Revit files with your own Python or Dynamo task scripts!
GNU General Public License v3.0
277 stars 75 forks source link

RBP Configuration #113

Open dgencheva1 opened 8 months ago

dgencheva1 commented 8 months ago

Hello,

I was wondering if it's possible in a scenario with multiple models and multiple scripts to configure the tool to open each model once and run all scripts on it sequentially, rather than opening each model separately per script in the queue?

habdirad commented 2 months ago

Hello,

I was wondering if it's possible in a scenario with multiple models and multiple scripts to configure the tool to open each model once and run all scripts on it sequentially, rather than opening each model separately per script in the queue?

do you mean a python script or a dynamo script?

dgencheva1 commented 2 months ago

A set of Dynamo scripts

habdirad commented 2 months ago

A set of Dynamo scripts

I am not sure if you can give a set of Dynamo scripts to RBP directly without Python. I used the template python script, imported the function that runs dynamo scripts, and used it to run multiple dyn files in a single run. Something like the following script that runs three dyn files. My small tests ran okay but you should test this alot more before using in production.

In summary, instead of a dyn file, you give RBP a .py file (with the scripts below) that triggers the run of multiple dyn files.

import clr
import System

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

doc = revit_script_util.GetScriptDocument()
revitFilePath = revit_script_util.GetRevitFilePath()

#HERE WE ARE IMPORTING THE FUNCTION THAT RUNS THE DYN FILES
import revit_dynamo
from revit_dynamo import ExecuteDynamoScript

#HERE WE CALL THAT FUNCTION MULTIPLE TIMES GIVING IT DIFFERENT DYN FILE PATHS
ExecuteDynamoScript(uiapp,r"D:\script1.dyn")
ExecuteDynamoScript(uiapp,r"D:\script2.dyn")
ExecuteDynamoScript(uiapp,r"D:\script3.dyn") 

Output()
Output(doc.Title+" Ran the scripts!")