Data-Shapes UI - On error, return message to user and let them try again?

I have a check in my code when a user tries to create a family type with the same name as an existing type. I’d like to be able to return a message to the user and let them try again without the UI going away. Is that possible?

I don’t think it’s directly possible. But you could try a few other options.

  1. Use Player. Have the warning explain that the type can’t be created and they need to run the script again. This isn’t the best solution if the user has already made a bunch of selections or inputs and would have to do the same again.

  2. Give them one more chance. You can’t reuse the same UI dialog box but you could bring up a second one. If they give a unique name, great, move one. If they don’t, give them the warning and then bring up a copy of the original UI and let them try again. You’d have to decide what to do if they give a second duplicate name.

  3. Do what Revit does and if the user supplies a duplicate name append some value to the end of it and create the type. You could then return a different dialog explaining that the duplicate type was renamed. This seems like the most reliable option.

Sorry. New to Data-Shapes (and Dynamo, in general, really). How do I determine which UI runs first? How do I get the second UI to wait until after that duplicate detection occurs and then run?

Data-Shapes nodes have a Run bool that determines whether the UI gets executed or not. You would have an If statement checking for a duplicate value or not - that would be the bool for the second UI. If there’s a duplicate it runs, otherwise it doesn’t. You would then use a similar If statement to determine which output you use (UI 1 or UI 2) then continue your graph.


1 Like

Thanks! Ended up with this. Works great!

1 Like