Naming values based on Grid location

Hi,

Challenge:
There is a grid, see below.
For now only the X-axis is important. We have the X-coordinates of the gridlines.
image

Question:
There is a list of values (x-coordinates) and I want to retrieve the corresponding grid axis.

I managed to retrieve the specific grid-line name when the value is exactly on a gridline. see below.

However there is 1 more thing I would like to do:
When the value (x-coordinate) is not exactly on a gridline (but in between 2 letters), I would like to give it a name corresponding to the X-axis which is crossed + a number.

The number corresponds to the number of items which are in the same ‘domain’ (in between these 2 letters), and sorted to the x-direction. so for example list below of values should be;

2020-04-22 Grid value name.gh (13.0 KB)

If it is exactly on the grid axes the number has to be no number.

Any suggestions?

Thank you in advance :slight_smile:

Grid value name_RE.gh (30.0 KB)

1 Like

Hi Jakinta,

Thank you for your help!
It does what I want :slight_smile:.
Maybe I am a bit of a nag, but the only thing is that creating the ± domain -0.01 feels a bit wobly and makes the script a bit long. The script will be implemented for analyzing a lot of points/values, so it has to be as short as possible :).

Again, it does work, so definitely thank you!
But if you have new thoughts/suggestions on making the script shorter please let me know!

Thanks again :slight_smile:

Doing this whole task is just better to do by hard-coding.
This is not a practical way to do it. And i do not code unfortunately.
But if it catches mice…

Just tested if for 10000 random numbers, it was computed in less than a second, so the definition is not slow at all.

Hi!

I tested it in the larger model, and it workst perfectly. So I must admit you are right! :slight_smile:

There is only 1 more thing what I ran into…
challenge:
Would it also be possible to adjust the model, that an input tree (with multiple lists) would work?

I tried several things, unfortunately I have a lack of experience.

2020-04-24 Grid value name_RE_re.gh (31.9 KB)

It would really help me if it would be possible :slight_smile:
Thanks again!

Check attached…

Grid value name_RE_v.2.gh (28.8 KB)

1 Like

Hi!

Thank you so much! :+1: :+1:

There was only 1 minor thing I had to change, for your info only:
I replaced the ‘Index command’ with the ‘Mass addition’ command, this way the values on a exact grid line are not counted as a 1,2,3 etc. for the next point. It works perfectly!

Thank you again!
You really helped me!

Thanks!

Hi!

I just ran into another challenge :sweat_smile:.
If there are multiple the same values in the input list, the output ‘names’ of these values has to be the same. (and only count as 1).

So for example see below;

Hope I don’t bother you too much, I really appreciate you help! :+1: :+1:

Thank you once again :slight_smile:

2020-04-22 Grid value name_RE_re_Re-re_re.gh (21.8 KB)

Here it is…

Grid value name_RE_v.3.gh (16.2 KB)