I have a script that works like it should through Dynamo Player, but I am wanting to integrate UI using Data shapes and create a button via PyRevit.
I can successfully run the script through PyRevit, but the order of how the script is run is affecting how it works.
Through dynamo player you select what letter you want to start with when reordering your sheets. You then run the script, click the views in order, and then hit esc.
When I run it through the UI it seems to select the letter as the script is running (which makes sense), but when I go and select the views and then hit escape they donât change. When I am looking at Dynamo when running the script and watching the UI, the âstarting letterâ doesnât appear in the Watch node until after I hit escape.
Is there something I need to put between the UI and the script? Is there a way to dictate the order in which the script is ran?
Here is a screenshot. You can see the Dynamo Player User input (currently disconnected) and then the UI workflow I created.
Here is the dynamo script, but Iâm not sure if it will work to test since I have the PyRevit folders on my desktop.
ReorderViews_script.dyn (44.0 KB)
Thanks,
kslifter
One thought I had was to use the âPassthroughâ node, but couldnât seem to get it to work.
Iâm not sure I understand exactly what youâre trying to do but I think I understand the issue youâre having. Dynamo executes node by node and then âcommitsâ all at once. Youâre not seeing anything in the Player output until the entire graph has executed because the commit is what actually gets sent to Revit/Player.
A passthrough node was a good guess, and while it may force the nodes to execute in a specific order, it still doesnât change that Dynamo isnât finished until everything has updated.
The good news is thereâs a really easy solution for this: create your own UI output. You can use Data-Shapes to create a custom output to state the starting letter as the graph updates since the UI node runs as part of the graph execution rather than when the final commit pushes the data.
Very cool, yeah that is the issue Iâm having.
I might need a nudge in the direction on how to do that though. I looked through the data shapes nodes and the only UI node that seemed customizable by the user was the âConditionalInput Dataâ node. Is that what I need to be using? I took a stab at it and got an error.
There should be a bunch of them under Data-Shapes
> UI
> Input
.
Youâd probably just use
TextNote Data
since youâre only dealing with a simple string.
Okay, yes I saw all of those and I was using TextBox Data successfully to give me my starting letter.
It took me a second to figure out you have to right-click to get to the edit custom node option. Is it as simple as creating an input like I have below?
You donât need to add anything to the node. Just provide a default value if you want. The node (combined with MultipleInputForm++
) produces a UI input when the node executes. This means that youâll get prompted for input when the node runs while the graph is still running. So you can provide an input value and continue to let the graph run with that value before finishing.
Depending on when you want to provide this input you may have these nodes in the middle of the graph with a default value pulled from somewhere else, allowing you to confirm the designated value rather than providing it from scratch.
Gotcha, sorry for still not following, because what you described is what I originally tried to do but it wasnât working.
Below is a link to a Youtube video I took of my workflow. When I run the script it prompts for the starting letter, I select it and run it. I then show in the video that there isnât any letter in the pinned drop down for the node. I selected my viewports and hit escape and nothing happened. When I go back to the script the letter A is under the data shapes node.
This is what prompted the original question because it appeared that it wasnât utilizing the selected letter until the run was complete.
Correct. The value in Dynamo wonât update until everything has finished. The values in Dynamo wonât get assigned to Revit until the graph changes are committed.
I guess I still donât understand why you need the graph to update before it commits to Revit. If the value (âAâ in your example) isnât being pushed to Revit, thatâs an issue with the graph, not likely the order in which things are executing. We would need to see the rest of your graph.
I was assuming it was an issue with the Data-shapes node since it works like it should when I use the dynamo player user input. Then when I noticed that it was showing the letter until after the script was ran I assumed it was an issue of the node not sending the letter through until the script was ran instead of pushing it through as it ran.
Here is a video of the working script through dynamo player and I show the rest of the script.
Thatâs very helpful for understanding what youâre trying to do. However I still donât understand what youâre expecting thatâs not happening. You assign a starting letter, âAâ, then pick the views to renumber, then the graph renumbers the views in selected order starting with the assigned letter. What are you expecting to update and when that isnât currently happening?
In the first video I run the script using data shapes, I enter my letter, I get the popup about hitting escape, I click my views in order, hit escape and nothing happens.
So I assume Iâm missing something when I try to run it through data-shapes and nothing happens. I donât necessarily get any errors, but the view numbers donât turn to letters like they should.
Player will get you almost nowhere when it comes to troubleshooting. Run the Data-Shapes graph in full Dynamo so you can confirm the nodes are running properly. Thatâs where weâd need to see the full graph running and what the nodes show after completion.
Here is a video of me running the data-script version through dynamo. There is one error at the top of the script, but this also occurs when I run the standard version of this script. It has to do with the fact that I am using letters instead of numbers. This script was originally to reorder the views using numbers. This part of the script temporarily changed them to letters so that there werenât issues of duplicate view numbers. Since I am changing them to letters itâs confused. The normal script runs fine with this error occuring, so I donât think it would be the issue.
So I figured out the issue.
I was trying to get a different script to work using Data-Shapes to use on my toolbar and I couldnât seem to get that to work either. I reached out to a person I follow and he pointed out that Data-Shapes outputs a list, so you end up with a list of a list. I hadnât noticed this when reviewing everything. I just needed to pull my data from level 2 and that solved it.
I came back to this to see if I was having the same issue and I was. I changed it to pull from level 2 and it worked like it should.
1 Like