Wish - Adding multiple values to a special user text dictionary

My wish is to create a list of values based on a key, but multiple values that will be add using an option when prompting it…like a table
In fact my goal is to manage a multilanguage document…

Example:

KEY : Wood VALUE (0) OAK - (1) CHENE - (2) Oak name in german …

%<DocumentTextSPECIAL(“WOOD”(0))>% Return OAK
%<DocumentTextSPECIAL(“WOOD”(1))>% Return CHENE

In my dream this document text Special could define a CURRENT Column Index that could be change for the entire document… To be able to choose 1 for English columns, 2 for French ones…

Maybe already asked by past? Or an idea to think in future releases?

What wouldn’t work for you if you did it like this:

Wood - Oak
Bois - Chêne
Holz - Eiche

Hi @Gijs I understand, but in fact my goal, is to manage easily BlocksData.
I expect to work as a database, with the key as the parent (MATERIAL) and the values could be variants (ENG, FRA, GER…) …
Working by key and single value, could not work because MATERIAL key will exist in different blocks.

The actual solution is for me to work in multiplying KEY for each langage:
KEY:MAT_ENGLISH VALUE:OAK
KEY MAT_FRENCH VALUE:CHENE

And same process for each Data wich have to be translate, DESCRIPTION, LOCALISATION…

So that’s why I wish to know if it could be think the DATA more like database with multiple values with an Index.

I hope it is enough clear to understand my wish… :slight_smile:

You can add a list of values to a key, separated by comma’s. With a script you can then split this text and retrieve the value you need. Here’s a simple python example:

import rhinoscriptsyntax as rs
def main():
    id = rs.GetObject("select one object")
    if not id:
        return
    rs.SetUserText(id,"wood","Oak,Chene,Eiche")
    result = rs.GetUserText(id,"wood")
    woods = result.split(",")
    lan = rs.GetString("select language", "English", ["English", "Francais", "Deutsch"])
    if lan == "English":
        print "Your material is %s" %woods[0]
    if lan == "Francais":
        print "Votre materiel est %s" %woods[1]
    if lan == "Deutsch":
        print "Ihr Material ist %s" %woods[2]

main()

Another way to do this is making single key-value pairs and filter them on number

wood_0 - Oak
wood_1 - Chene
wood_2 - Eiche
then based on the language you filter on either _0, _1, or _2:
image

image

1 Like

:+1: :+1:

I like this approach - wanted to suggest the same.
(1)
it is more readable and more compatible with the current interface.
(2)
i would prefer to create multiple composed key (name & “_” & counter) instead of mixing multiple data-entrys in one value.
(3)
composing and decomposing the key can be easily handled with a function …

not sure on the initial post, if this is a developer / coding topic or not.

maybe update the tags / category ?