I have created a button for my Dynamo script following the instructions here:
My script requests user input as its first node to select items within the model. I would like for my script to request user input selection every time the script is run, without needing to open Dynamo and select the “Change” button shown here on this node.
I feel like I didn’t do a good job explaining my problem in the initial post. All I want is for this Select Objects node to “refresh” every time the Dynamo script is run (without needing to press the “Change” button). Or in other words, I want the command prompt to ask the user for input every time the script is run, like the image here shows:
I don’t think this is going to be possible given the way those UI selection nodes work. You’ll notice that they don’t actually require the graph to be run in order to return an output (i.e. it still works when the graph is set to Manual instead of Automatic). There might be some way to capture an event that fires when a run is complete and then reset the node upon hearing that event, but now we’re talking about a change in the fundamental way that the node is designed and how the results are cached.
You could abandon this node and try a Python approach, but you’d need to make sure that you convert the native AutoCAD/Civil 3D object types into their corresponding Dynamo types. It would also probably require some type of toggle that would have to be changed by the user in order to run the selection again, which doesn’t seem any simpler than just clicking “Change” on the Select Objects node.
Like Jacob said, you might try another package or go with Dynamo Player. But even with a Dynamo Player approach the user would still have to click the reset button to clear the selection. The downside is that if the graph has other user inputs, those would be reset as well.
So after all that…I think it might be easiest to click ‘Change’.
My script is so close to being perfect! Thanks @mzjensen for helping resolve this issue. However, I just have a quick question on Dynamo Player. I am now able to refresh the Select Option but the output is greyed out. I know the script works because it runs fine in the Dynamo Watch Node. I have followed the steps as identified in this thread:
(Meaning, I have set the watch node as “Is Output” and Renamed the Watch Node.) However when I try to run in Dynamo Player the result tab is greyed out as shown here: