Grasshopper text to line

Hi there,

is there a way to define a line via a text string?

The same way we can do this for points, is there also a syntax for lines?

Thanks,
Jacob

Not sure but alternative you could use the line component and define the two input points as text

my guess - the line component can not phrase a string
it looks tempting to do it with c# or extract the point-pattern with regex. (T Match)
Suggesting a vanilla grasshopper-component only solution.
Phrasing text to numbers / geometry can be error prone - so this suggestion might not work if you need a robust approach.

EDIT:
Text Split is splitting by single characters.
This is why i first replaced the text β€œto” with β€œx” and then split by β€˜x’.
and because it is not very readable to use " to " in a panel - starting with space and ending with space - i used the trim component to get rid of the spaces. (which might not by necessary for the phrase to point).

hope this helps - kind regards - tom

text_to_line_00tp.gh (7.6 KB)

2 Likes

nice approache - simplyfied it a little bit


for what ever reason it creates empty items but works perfectly fine
text_to_line_00tp.gh (4.4 KB)

Thanks for all your responses, I know I could also simply use a ghPython component to parse this.

I was actually hoping to get a zero-component answer. I thought maybe there is an undocumented way in which in how a text string needs to be formatted such that it can be parsed into a line. (same way that it works for points, which is probably also not documented).

:face_with_symbols_over_mouth:
as far as I understand + I tried to somehow come along with the limited text functionality of native gh:

the text split component uses separators = single characters
β€œto” is interpreted as two separators β€˜t’ and β€˜o’.
this is why you get empty items.

I explained my approach in the initial post to keep things together:

1 Like

Sorry overread this an thanks for the explanation!

… I edited the post- to have the info at the right place - it was not there when you first read it - so you overread nothing… kind regards - tom