I’m trying to import a .txt file in Rhino, containing some coordinates from a survey.
I’m modifying the .txt file to set the points in x,y,z.
Additionally, I would like to put the description, the surveyor has attached to that specific point.
Can anyone tell me what is the correct “order of things” is, to attach the description as the point id/object name, so that I can annotate it and have the description displayed in the viewport?
Is there any easy way to do this? Maybe there is a plugin that I cannot find?!
I need to see the description in the viewport next to each point.
I’m guessing that I can add the description in one column and rhino will add it as the name of that point?!
x,y,z,(description) / x,y,z,point_name
I understand that I can do this with Grasshopper.
But I need to pass it along to someone with very little knowledge of Rhino and explain it as simple as possible to them the core process of the order of things so that they can work and edit the .txt document and just import it in Rhino.
In Civil, when importing, I can pick my custom point file formats and set what each column represents in the text file.
Using a small python script this is fairly easy to do.
I made an example txt file: test.txt (72 Bytes)
formatted like so: x,y,x,description
eg 12.8646,3.895,2.89,my point name
with this python script ( load in in the editor via command EditPythonScript and hit run - green arrow-) import_point_description.py (335 Bytes)
import rhinoscriptsyntax as rs
file_path = rs.OpenFileName('select txtx file with points description')
with open(file_path) as pointfile:
lines = pointfile.readlines()
for line in lines:
x,y,z,description = line.split(',')
id = rs.AddPoint(float(x),float(y),float(z))
rs.ObjectName(id, description)
does this make sense?
if not let me know what is unclear
Sure you can use it sny way you want.
If you want to have this functionality with Grasshopper you can best ask at the grasshopper category. Or edit this post to that category.
I came back to the project that I had the problem with and noticed that the definition I uploaded was completely wrong since it was based on running @Willem’s script first, and then running the definition in order to preview the point name.
I don’t want someone to find this and still be stuck [if he/she want to solve it through GH) so here is a way to solve it.
I import the coordinates into a panel and add the descriptions to another one - open the Gh def. and you’ll figure it out. It’s pretty straight forward.