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…
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?
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_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.
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
id = rs.GetObject("select one object")
if not id:
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
if lan == "Francais":
print "Votre materiel est %s" %woods
if lan == "Deutsch":
print "Ihr Material ist %s" %woods
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:
I like this approach - wanted to suggest the same.
it is more readable and more compatible with the current interface.
i would prefer to create multiple composed key (name & “_” & counter) instead of mixing multiple data-entrys in one value.
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.