I’ve been using pyRevit to set up a ribbon with some custom dynamo scripts. It works great.
I just set up a Dynamo script that allows me to change titleblocks on sheets without opening the sheets. The script works great if I run it manually, but I get strange behavior when I use pyRevit to run it (has to be set to Automatic).
The Dynamo script uses Data-Shapes UI. When run, a box pops up and let’s the user check any sheets (via Sheet Number param from all used titleblocks in the revit file) to change the titleblock on and then gives a list of titleblocks loaded in the file to choose from. Click the submit button and it changes the titleblock. That much works fine.
Then the UI pops back up on its own. Weird.
Then I realized if I change the titleblock manually (not using the script) by just clicking on it and changing its type, the Dynamo UI pops up again.
So, I’m assuming since the script is set to automatic, it just keeps running itself again each time the titleblocks in the Revit file change.
You should look at the pyrevit documentation and eventually fill an issue on the pyrevit github instead, you would get a more appropriate feedback. The issue might be in the custom nodes, or what they invoke to make the popup windows and that might be interfering with pyrevit.
I got some of my script to work as expected in pyrevit, like what you try to achieve. But you get better chances to get it to work if you change your UI workflow for a more pyrevit one. This way you will avoid having conflicts or unexpected behaviour using your script through pyrevit.
I posted a similar issue to the pyRevit github, but this happens even without invoking the script via pyRevit, so it’s not due to using that. If I just open Dynamo and run it there with it set to automatic, the same happens. I know the issue is with it being set to auto, but pyRevit needs it set to auto in order to run it via the ribbon.
I’ll check out Dyno as @Daan suggests. I didn’t know there was another option for getting Dynamo scripts on the ribbon.
It makes sense.
The use of pyRevit makes it more bullet proof for distribution of your script but Dyno is an excellent option, especially when you already have designed a UI for your script.
We use it in-house. See below
only Cons is that it needs to load dynamo in background at revit startup and therefore, it takes more time to load Revit (especially when you have a lot of custom packages installed in your library). Not a big bother when you spend your day on a single session of Revit, but that can become a bit annoying when you do a lot of tests and restart revit all day long like I do.
I actually kinda like that it loads Dynamo itself. With pyRevit, you have to remember to run Dynamo yourself before you click a tool. And, even when you have done that, when you click the tool I’m assuming pyRevit is opening it again in the background because it takes a few seconds before the script starts. Just kinda slow overall. Definitely wouldn’t fool anyone into thinking the tools on the custom riboon were native.
Trying to download Dyno now. Do you have to make an account on the PRORUBIM site to get it?
PyRevit launches Dynamo in boackground the first time you run a script from a DYN file, but once loaded, it sits there so the next script is running seamlessly/quickly
Yes you have to buy the free Dyno, so the account is needed