I am trying to create a drop-down list in Dynamo so the user can assign the color for each piece of furniture using a list of items from Excel. The problem is that when the code is run, the list starts at Index 0 and assigns the next value on the list to the next item until it reaches the end of the list and places blanks for the remainder of the items.
I would like to have all the parameter values default at “Select Color” so I can choose which color to assign from the drop-down list.
I’ve tried to nest list, list cycle, lacing, and a few other things to see if I could create a default list that the drop down will reference but it seems like those attempts won’t get the solution.
@Schasfoortyoeri, thanks for making the example. I’ve tried the solution but the default value doesn’t seem to stick. When lacing is set to shortest for “Element.SetParameterByName”, “Set Value” becomes the only drop down item. If lacing for that same node is set to Auto, the first piece of furniture gets the item at 0, the next one gets 1, and so on…until it reaches end end of the list. Then the rest of the parameter values are left blank.
You could also include the furniture elements in a selection so you can apply them to specific groups only. Then you can use lacing if needed. This may require you to run it a couple times depending on your need.
The ultimate goal is to have the user be able to select one option from up to 60 different options form the drop-down menu. The “Select Color” default value is needed so that the user knows that they need to select a value for the Parameter.
Could you elaborate on running “Count” and “List of Repeated Item”?
@SeanP thanks for that suggestion. Unfortunately, what I’m trying to come up with needs to have Parameter values changed by the user after they click on the element.
With default value you mean the “Set Value” ? If so, i would take that out and make the list colors only.
You can easy add note’s like i did by using the UI.TextNote (for writing a manual how to use the script for example)
you dont need the list of repeated item and count i suppose, i just tried the script it works…
@SeanP, I guess I didn’t explain very well what I’m trying to get as I’ve confused both of you.
@Schasfoortyoeri, I got your example to work perfectly for setting a single color on all furniture. …however, I’m trying to set a different color on each individual piece:
What I’d like to have (but with “Set Value” as the default value before the user assigns the correct value.
What we currently have
The issue with the drop-down list shown in the first image is that values are “randomly” assigned. One piece of lounge chair (for example) will be assigned Red. Then the next one, Orange. The one after that, Yellow, and so on.
When the end user needs to assign the parameter values from the properties panel, they need to know which parameter values they had assigned and which ones they hadn’t yet, hence the need for either a blank or “Assign Color” to act as the default value before the user makes an appropriate selection.