Extract Text from Data List

Hello, forum,

I wonder what would be the way to to extract text from data list? I’ve found some similar cases where python was used to solve this issue. However, trying it myself gave no result because script had to be adapted and I know no code at all.

Thank you in advance

extract-text-from-data-list.gh (32.7 KB)

Something like this? (updated)

Extract Text_Numbers.gh (11.2 KB)

1 Like

Extract Text from Data List VR 1.gh (38.7 KB)

:sweat_smile:

I need to learn how to program. I feel like this should be easier with the native Grasshopper components. Maybe there is something I don’t see in the text components that could help me?

This is my approach. Illegal, but works.

3 Likes

:clap:

Clever.

I’m guessing the problem lies in detecting decimal numbers.

I suspect he only wants the number after the ø and the value between the brackets. The first line is the name of the connection. The second is the bolt diameter and quantity. List item will reduce the problem to the specific numbers needed. Once found, one can re-assemble the tree to contain the data in a more useful format for equipment downstream in number format or a string. Maybe:

1: Name

2: Diameter

3: Quan

Guys, way behind here—how did you get that specific list of text shown in the original post and your solutions?

This:

When I open the original file I do not see that anywhere.

Steal it from Cumberland’s solution.

1 Like

I did, that’s why I’m asking haha

I mean, if that’s the way it is, and the structure is predictable, you could just target the second item of the list and use the appropriate separators for Split Text… I am guessing this is what you are saying.


Extract Text from Data List VR 3.gh (18.9 KB)

It means he doesn’t want to “extract text”, but rather extract the numbers from the symbols.


It is a problem (for the general solution) that he used the letter "Ø" instead of the symbol "⌀", Unicode U+2300
1 Like

Still perplexed—stole the text from Cumberland, yet Piotr shows a slightly different version? Oh well, I’ll die in my ignorance

1 Like

I’m guessing they have similar data sets in their daily work. Structural engineers?


I used the ability to upper/lowercase as a check for letters.


Extract Text from Data List VR 2.gh (23.1 KB)

1 Like

Is there someone out there who, for the love of all that is holy, can script a component that outputs the domains of a RegEx search match instead of simple booleans?

1 Like

I should have looked closer before. My mistake.

This is a very odd problem. He seems to be trying to extract information from dimension text. I do not follow that. Presumably the dimension text was to individual circles or groups of circles. To me the more logical approach is to get the data needed from the objects to avoid an error if some of the text is changed. I will wait to see the reason here.

I asked Claude and it was suggested to paste the text from the panel and copy the diameter symbol from that. I think I have split out the data now. I am not sure about the first line of data.

extract-text-from-data-list-brad.gh (29.8 KB)

2 Likes

Tried out 1st reply and it did the work. Thank you

Although the OP has marked this as a solution, it should be noted that it only works with ASCII characters and fails with their posted data which has unicode characters lying outside the ASCII range:

1 Like

It’s from the Tx output of the Text Entity component in the OP’s upload.

Hate to see a man perplexed. :wink:

1 Like

Here’s a solution using a couple of regex components from the current beta release of Greg, the Grasshopper Regex plug-in.

The first is using the \w shorthand for unicode word characters to find the individual words in the input strings; the second is stripping out the Ø (the ‘Latin O with stroke’ character, U+D8, rather than the diameter symbol, U+2300, which is why it is passed as part of a word by the first component).

The Greg beta is available in the Package Manager for Rhino 8 and the WIP.

2 Likes