Since pyRevit allows running .dyn scripts from Ribbon I figured it is possible. I’ve tried reading pyRevit source and looking in Internet but without any luck.
Thanks for help!
import clr
clr.AddReference('PyRevitLoader')
from PyRevitLoader import ScriptExecutor
import pyrevit
py_executor = ScriptExecutor()
print(py_executor.ExecuteScript("d:\\test.py"))
# this succedes
dyn_executor = ScriptExecutor()
print(dyn_executor.ExecuteScript("d:\\test.dyn"))
# this does not
Result
Succeeded
Failed
Currently I’m stuck with setting up dynamo engine for ScriptExecutor.
in my opinion, that amount of daisy chaining will more often than not cause Revit to crap on itself and crash. also, the execution time is going to be slower - since there are more wrappers between the script execution and Revit.
I would advise combining the 2 dynamo scripts into1 and then executing through a pushbutton
We have a policy to go with Dynamo whenever it is possible. The reason is that there aren’t that many Pythoners available at hand to hire and I am the only one currently in my company. Dynamo is usally easier for newcomers.
I still need to programatically chain run Dynamo graphs as it will speed up things greatly.
Let’s just say that I don’t care about the overhead. Secondly Revit craps when code is poorly written.
That’s not a solution for me. Our Dynamo graphs are complex enough already and adding more makes them unmanagable and almost impossible to imporve later on. I have been into Dynamospaghetti world once and I’m not coming back.