Parameter Renaming

I am working on a basic script that can update room parameters, but I’m encountering something odd. When trying to update the Name parameter it will sometimes create a new room instead of updating the Name of the selected room. It doesn’t do this everytime. I’m guessing it’s probably something simple, but I can’t seem to see it.

I do have it setup with inputs/outputs for Dynamo Player if that matters. Typically I open Dynamo player and run it without a parameter name so that it populates the rooms and parameters list. Then you can input the integer of the room you want to update, type in the parameter, and the parameter input.

Here is the script.
00_Rooms - Set Parameter.dyn (39.2 KB)

Haven’t looked at the dyn, but off the top of my heard i’d say you are encountering duplicate names in your rooms.

Can you show a screenshot of your graph in action (with node preview bubbles pinned) so we can see what’s happening?

Here is a quick screen recording. You can see that there is only 1 BIKE STORAGE, then when I run the script the name doesn’t change. I then ran it again with the parameter empty so it would refresh the list and you can see the new room that was created.

Can you post an image of the entire graph? (Export as image with nodes legible, not a screenshot please)

Something weird is going on but I don’t think you’re creating a new room. Nowhere in your graph is that an option. What you’re actually looking at is unique names (keys) for rooms. The initial room name is in all caps and then you overwrite the name in camel case. This then shows that you have a room named in all caps AND one in camel case. The weird part is that your room list shows that you only have the one room by that name, so somewhere, the wrong room is being overwritten. I’d first start by suggesting you not run your graph with no parameter value. That could be causing some confusion. If you want to update the list without changing anything then just disconnect the node entirely.

I don’t think it would make a difference, but you might start by making sure you don’t have any unplaced rooms, and if you do, remove them from your list. Again, this shouldn’t have any effect on your logic, but it’s worth confirming.

1 Like

Looks like there is something going on with the sorting. I ran it again and then had it show me the room that changed in the model and it was a room that was named ‘DOUBLE’ that changed.

I copied the script and removed the sorting node and the correct room changed.

Sorted:

Not sorted:

So much for trying to be fancy by sorting the room names

Try just using SortByKey instead of GroupByKey. I’m thinking the grouping is doing something weird, although it really shouldn’t.

1 Like

I think that list.sort before your GroupByKey is the problem. One input has had its order modified, the other hasn’t. I’m not sure what list formatting you’re after, but you either need to remove the list.sort node or replace it with a SortByKey (and potentially remove the GroupByKey depending on the final result you’re after).

2 Likes

Thanks @Nick_Boyts and @Hamish, swapping in the SortByKey node fixed the issue.

I didn’t even see the Sort node. That’s definitely the culprit.

1 Like