Open dgencheva1 opened 1 year 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?
A set of Dynamo scripts
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!")
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?