Integrating UI from Data-Shapes

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.
image

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