Text in lists and selection of specific text strings


I have created a script which allows me to set the street profile based on the type of surface and it’s width. There are two things that I would like to improve, these are marked by red groups in the attached script.

I am not sure whether I prefer to type out the ground floor definition by name or by number. My script requires the numbers to work with, but I would atleast like to see the names displayed alongside their width values (so the text conversion could work both ways). Is there a way to compress the replace text boxed into just one component? Basically, the conversion should be in the way it is defined by the white panels.

Additionally, I would prefer to click the value list checkbox to select all surfaces that are of a certain type (set to a green colour). I currently set a value cycle, which allows me to select just one type, but can this somehow be changed to the value list checkbox?

Groundfloor-Definition.gh (15.7 KB)

Something like this is what you are after?

Groundfloor-Definition_re.gh (13.0 KB)

1 Like

Here is a slightly different solution that @HS_Kim solution:

Intuos.gh (25.1 KB)

1 Like

Thanks @HS_Kim and @Mahdiyar, I’ll be using pieces of both scripts to get the result I was looking for!

Check this as well

Groundfloor-Definition1.gh (21.0 KB)

1 Like

One more question: how do I go the other way around: from numerical input (0-4) to text name output (Pavement - Pond)? I would then use this as visual control for the width input in another panel.

E: I was about to post: Why isn’t this working the way I expected it to? — but then I saw the result I wanted in the screenshot. So never mind.

Is there a solution to bug-proofing the script in case of discontinuity of data? I have specified 10 street types, for which some are not used as inputs for this specific case (but they will be for other locations).
The problem I am running into is that the branches are selected by the value list, however, the indices no longer match up with the value list output.

Groundfloor-Definition_Discontinuity.gh (17.9 KB)