Text from block name

I want to know whether if possible to get a text from a block name in a way that I can split the text into items/components with a separator and get only a slected items/components in the resultant text.
Please find an example. What I want here is to get here is the text below from the text above.
In this case a block is named DAVID-ALVARO-DIEGO. I want to extract only the items 0 and 2 (David and DIEGO) from a list created from sppliting the name using hyphens as separators to get the bottom text.


1 Like

If you can read the string from the block, e.g. using a rhinoscriptsyntax helper function, (as long as it contains true ascii hyphens, not other unicode code points that resemble them), then you can call:

str_from_block = "DAVID_ALVARO_DIEGO"
names = str_from_block.split('-') 
assert names[0] == 'DAVID'
assert names[2] == 'DIEGO'
1 Like

Hi James,

could it be made in a way such that all this happens automatically inside the text object? Your way, if I understand well, might need extra scripting that wouldn’t work inside the %<>% formulas.



You both will have to test it yourselves, but try calling Rhino.RhinoApp.ParseTextField.

1 Like