Dynamo Script + Bundle multiple document open

Hello,
help please, I put most of my dynamo script as a bundle in my tab, with icons, grouping hierarchy, use of Quick Access Toolbar, etc. All work great and is beautiful work without using the Dynamo Player…

… but only with one document open, with mode than one and switching to the new the scripts continue to work always on the first.

I made some test script to get the current document name and is always the same.

Same problem with the family editor too.

All my scripts works well from the Dynamo player without problem.
Any hints on where I’m wrong

Thanks

Hi Dario,
Never had that problem. Could you send a pushbutton folder containing script and bundle for me to try?
I have my own toolbar and use quite a few other pyrevit toolbar and never had that issue.

Hi Jean-Marc,

I’m having similar issue as well. I have 5 Revit documents opened. Whenever I run a Dynamo script from the custom tab via pyRevit, it only applies on the first model. It seems like it can’t identify my current Revit document. Is there additional config I can use to make sure the script is applied for the current document?

There is a set of possible options for the bundle.yaml file that clears the engine. It is documented in the wiki on notion if you look for dynamo and bundle.

You could also try to get the active document in dynamo, using the HOST_APP.DOCS then make a document selector by name.

1 Like

Sorry later i found another discussion on that topic here,
https://discourse.pyrevitlabs.io/t/pyrevit-and-multiple-open-models-problem/1752

but Jean-Marc already answer while I tipyng. :smile:

2 Likes

Thanks for the links, Dario and Jean-Marc :pray:

This might be a silly question but in which bundle.yaml file should I include the engine keyword? I tried it with the.yaml file inside the pushbutton folder but it doesn’t seem to work :sweat_smile:
image

title: |-
    Object ID
    General
tooltip: |
    Generate running numbers for CSD elements
    Supported categories:
    1. Cable Trays
    2. Ducts
    3. Pipes
engine:
    clean: false

Sorry, I try more than a year ago, remember that work but the time to reload everything again was to much.
So now i use a different approach. Quick tools on the ribbon and pay attention to have one document open, all the tools that normally work on multiple document, like operations inside the family editor, on the Dynamo Player that have a better handling of multiple scripts in the lastest versions.

Dario,

Thanks for the suggestion - I’ll adopt the same workaround. Guess this is one of the sign to migrate what we have to Python :laughing:

1 Like

i made a “Reload Dynamo Engine” button that has this yaml flag. the dynamo script itself was simply a dialog box that says “Dynamo Engine Reloaded” or similar. Just run that button every time you switch documents and then you are good to go. no need to reload for every button

2 Likes

Thanks for the tip!!!

this is the correct way