I am searching about the possibility to run a dynamo script automatically without a user interface.
I have a dynamo script that extracts data from an excel file and inputs them in Revit. Currently, the user has to run the script through dynamo player, I am looking into the possibility to trigger the script to run automatically.
For example, when an excel file is saved in a certain path or under a certain name (whatever might work), it will trigger the dynamo script to be excuted without the need for a user to manually run it.
I am not familiar with the possibility to do that through an Add-In or Revit API, any advice where to search and how to start?
Dynamo cannot be run via design automation for Revit (Autodesk Platform Services, formerly Forge) at this time.
You can make a local computer do stuff when something like a file modification happens though, but the hard part in this case is that you want to have Revit do some work, not a windows feature. Assuming your Dynamo graph automatically finds the excel files, uses them and moves them to a new location, then the simple option would be to write a tool which:
Checks for new excel files every N minutes
If one is found sends a playable journal to Revit which does the following four steps:
A) Opens the associated RVT.
B) Runs the .dyn.
C) Syncs.
D) Quits Revit.
This will require a CPU with it’s own Revit license sitting around waiting for the command to execute the tool every N minutes, which is expensive and difficult to maintain.
As a more reliable alternative you could move your Dynamo tool to a design automation tool (which I think might require a CSV instead of an excel file), continue to utilize an “on demand” tool such as Dynamo Player or PiRevit, or change the behavior of a common command which only occurs outside of an active transaction (such as Sync to Central) to have the loading happen at that time.
You’d probably need to consider three options here:
Automate via the cloud using APS services (hard)
Develop an add-in that you install on user machines that either runs at set system times/offsets from model open, or when events occur in Revit (hard-ish)
Look into the hook system in pyRevit, which also runs scripts off events (medium)
Package your scripts into a more readily accessible place using tools like pyRevit, Relay or Nonica (easy)
I am not advanced in this topic, could you please elaborate more on the alternative you mentioned? What kind of design automation tool?
Also, synchronizing the Revit file after the script is ran is not important (the script will export an IFC file), I don’t know if this makes it easier.
It would be great if you have any resources that I can learn more about this from.
The APS option although hard is appealing, would you have an example where something similar was done? I did some research but couldn’t find a starting point.
Unfortunately not, and that’s the hard part. Generally firms invest a lot of time and money into these solutions, so not many resources out there giving step by step instructions.
They do forge accelerator events sometimes where people get together to do this sort of thing, although not sure if/when they run now, and under what name (APS accelerator?).
The Dynamo roadmap has some insights into his topic, but that is still a ways out, and as always decisions ought to be informed by roadmaps but not counted on.