I’ve got a script set up using Rhythm’s View.Viewport node. It all works great, until I start a new session. Whenever I open Dynamo and run the script in a new session, the View.Viewport node doesn’t pick up the set of views from the previous node. I can delete the view.viewport node, and place a new one in the same place, and it works again. But as soon as I close and open it again, the same issue.
Its obviously not a massive issue, because I know how to fix it and it works, but its a bit annoying. Any suggestions?
@Nick_Boyts that would probably work if somewhere in the script those new views are placed on a sheet. But if they’re not it would still produce empty lists.
They are placed on a sheet in another portion of the script. Should I rearrange the script so that this portion happens after they’ve been placed on sheets? Does this make a difference? I’ve only been working in Dynamo for about a week, so I’m obviously still learning.
But even with this, deleting and replacing the node works every time, which is odd. This is why I assumed the issue was with the node itself.
I also tried putting the Transaction.End node between the duplicate node and the view.viewport node. Still didn’t work on the first go in a new session. But again, after deleting and replacing the view.viewport node, it works.
As @viktor_kuzev mentioned, you need to make sure you’re graph is executing in the right order. The view will only have a viewport after it’s placed on a sheet. So the first step is to create the duplicate views. The second step is to place them on sheets. Then you’ll have to use a Transaction node to commit the new views to the project. Once they’re committed, you can get the viewports.