Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RBP Configuration #113

Open
dgencheva1 opened this issue Oct 31, 2023 · 3 comments
Open

RBP Configuration #113

dgencheva1 opened this issue Oct 31, 2023 · 3 comments

Comments

@dgencheva1
Copy link

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
Copy link

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
Copy link
Author

A set of Dynamo scripts

@habdirad
Copy link

habdirad commented Apr 25, 2024

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!")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants