Assign different values to different indexes of an empty list

Hello everyone,

I’m making a tool to configure facades panels. It starts by generating a wireframe as shown below.

Each element of the facade is indexed, for example the main frame (“ossature”) is displayed on the left.
I want to assign a value for each index separately.

1/ create an empty list with as many indexes as there is elements in the main frame
2/ select some index of the list 
3/ assign a value for those indexes 
4/ update the list, and repeat 2/ and 3/ as many time as needed

I didn’t manage to get this right yet. The solution looks like this for now.

The list of indexes range from 0 to 19, and the values are also a set of integers (the value list below). It creates a tree with entwine, where each branch of the tree correspond to a value. Indexes are stored in those branches, thanks to a trick with some button and some freeze/gate components.

First, I’m far from the “simple” solution described above, creating a tree branch for each value isn’t the most elegant approach. Furthermore, my current solution doesn’t allow for a dynamic set of values and indexes, those are fixed and I want them dynamic as there will be a lot more of them. I assume some Python or C# would be nice here cause we will need some recursivity (?). But I’m no expert in those languages yet, and I don’t know how this would work out whit Shapediver.
(Also, I haven’t found the simple button toggle in the list of forbidden grasshopper component, I might be doing something wrong but those don’t show up in Shapediver.)

I’m struggling to design a solution that work smoothly in Shapediver. Any help would be more than welcome. :slight_smile:

Have a good day/night !

You seem to be in a typical scenario where you will not be able to use traditional inputs to achieve the flexibility you need. Please have a look at using the ShapeDiver Text Input component with JSON objects, this article and youtube video should help: JSON Objects Explained!

Thank for your feedback ! The implementation of JSON in Shapediver is really cool, but I don’t think I will need this for now.

I’ve come with this solution so far.

Using TSplit to create a selection from a single string input (ShapeDiverTextInput), which designate the index of the item to be replaced in a empty list of the length of the element (here a list of meshes) to which assign value. The Item to replace with is designated by a value list, that can be easily updated with a C# found here (I’m going to handle large amount of values). Each selection (fixed number of 3) has a value to assign.
This is a bit erratic, but I hope it will help someone someday. Files attached.

Grasshopper doesn’t allow me to work with a dynamic number of text and value list inputs, but maybe the Shapediver API will ? @mathieu1 (14.7 KB)

The only way to define a dynamic number of inputs is through the use of JSON data structures and the API. Even using the API, you will not be able to get around the number of values in your value list defined in Grasshopper. Of course you can always implement a workaround where your value list in Grasshopper has a huge amount of values and hide some of those in your application using the API, but you will end up with a solution that is far less tidy than you would with clean JSON objects.

Thank you for your help Mathieu, I will look into that !