Only show text tag when X = False

Hi, I’m having trouble with the last bit of something I’ve been working on. I have some original spot heights from a survey in 2D, grasshopper reads the 2D text, finds the nearest point, adds the value of the text to the Z value, and creates a point ± Z above/below the original point. This all seems to work ok.

Where I’m having trouble is highlighting places where the above doesn’t work for whatever reason. I’ve got it to compare the original text with the new point’s Z value… and that’s it really. I want to then take any that don’t match and display some text by the point saying “Error” or something. Some way to highlight that there’s a discrepancy between the original height and the new point. I’d really appreciate any help anyone can give!

Screenshot below and files attached.

Thank you!

spot heights test.3dm (2.5 MB)
height from text 2.gh (19.6 KB)

Edit: using Horster Reference from F4R

I think you might get what you want when you swap the Closest Point inputs, and then connect Pt (where you have “Spot height points nearest text”) to the “Brep all points”.

Thanks Adam, but I actually think I have a bigger problem to solve first… I just tried it with the complete 2000+ point data set, and it seems the text value is completely divorced from the point it is supposed to correlate to. I think I’m accidentally creating two separate streams of data, one is the points in 3d space, and the other is the text/height value. i.e. I believe the height that I’m moving the point up in the Z axis is not the same as the text value for that point, just some other text/height value from a different list. See painful screenshot below with the intended height for each point in black, and the new Z height in red.

I guess I should look into making the two lists share an index or something.

could you upload a bigger dataset of points?
to be fair it would also be pretty easy to generate some randomish datasets to make some test, but working on the real data might give some insights on some particular scenarios you would encounter “for real”…

it is not completely clear to me what kind of checks you want to perform :upside_down_face:

finding the Closest Point for each Text Tag could cause the very same Point to be the Closest Point of two -or more- different Text Tags, which means for the same Point to be moved by different amounts separately: could this happen for your data?

similarly, expecially if you have an amount of Text Tags that is lower than the amount of Points, but this could also happen if their ratio is 1:1, some Points might be not affected by any text Tag at all: could this happen with your data?

inno, I’ve uploaded my full data set below:

But I think I’ve also got everything to work. I found this very helpful post & Python script by @djordje from 2017. The python script works great, I just modified it a bit to work with my points being offset slightly from the text insertion point, and then added an error checking bit at the end.

it is not completely clear to me what kind of checks you want to perform :upside_down_face:

Just wanting to have a visual or numeric check that the new points with Z height are indeed the correct height above the original 2d points. I added in a numeric check, which is good enough for me (though a visual check would be nicer - e.g. highlighting any new points that are the wrong height).

Thanks both for your help!

height from text 4.gh (76.8 KB)
larger dataset.3dm (6.4 MB)

1 Like

opened your file, cristal clear and well organized, but there’s one thing…

you have more text tags (A) than points (B) :astonished:
by using Closest Point on the Text Tags, for each Text Tag it will find its closest Point (C) regardless if that point was already the closest of another Text Tag

so you know in advance that at least the amount of points (A-B) will result in duplicate instances (I say duplicate, but it does not necessarily mean they are 2… they are for sure 2+ but can be many)

if you want to know which ones are the points which are collecting multiple tags, you can do something like this, where:


height from text 4_inno.gh (82.8 KB)

RED marks = original points which are not Closest to any Text Tag, so they were not moved at all
GREENISH marks = original points which are the Closest Point of 2+ different Text Tags simultaneously (so will originate duplicates with same X, Y coordinates and different Z)

you’ll notice that over the head of each greenish point there are indeed 2+ different resulting moved points, for instance:


sometimes they are even impossible to notice because they share the same Z coordinate, but still they are double entities:

I don’t know it this was your original intent, but this is what comes up by using Closest Point :+1:


[edit] let me say first that I have no idea whatsoever what those points/heights represent in real life, but my head tells me that an alternative approach -which might easily be completely wrong- would be to compute the Voronoi (oh yes) diagram of the Text Tags, in such a way to identify for each Tag a sort of “area of influence” in the shape of its cell, and them I would push-up each original_Point that exists inside of each cell by the respective Cell_text_tag value

this is the Voronoi diagram of the Text Tags (after correcting a single text tag that did show “210” value, and because everything else was in the range 0.64 to 16.57 I thought it had to be 2.10 instead) green are lower values, red are higher ones

and this is how it looks after pushing up the Points depending on which cell they belong to (file is pretty calculation heavy, I guess around 20 seconds…)

reuploading also the Rhino file because it had many duplicates both in points and text tags

height from text 4_inno_Re.gh (71.9 KB)
larger dataset_without_duplicates.3dm (3.1 MB)

another approach (and I guess the best one) might be to mesh-triangulate the text tag points, then project your original Points onto that mesh in such a way to take into account linear height transitions… the way I presented the above Voronoi thing was more a “stair-step” approach, like if the whole cells were planar stair-steps and Points were just projected into those

(wow, actually doing that might save very much processing time lol)


(no it doesn’t :upside_down_face: )

here are the points projected on the Delaunay mesh created from the Text Tags, just for reference

height from text 4_inno_Re_Re.gh (67.3 KB)