I recently conducted a survey of a building and obtained a CSV file containing x, y, z coordinates. I’m aware that I can easily import this data into points in Rhino. However, I’m wondering if it’s possible to import additional information, such as the point number, and create tags or text to label each coordinate. Ideally, the coordinates would be numbered according to the CSV row number.
This would greatly assist in identifying and verifying points during the redraw process.
A custom scripted .csv import can be easily made. Best would be to post a .csv (or a sample) and indicate what kind of output you want. Text labels with line (point) numbers are no problem.
That’s nice to hear. Unfortunately, I’m not able to script. I would greatly appreciate it if you could help me find a solution. Here you will find a .csv file and a screenshot of an example I have. The idea is to have the point number and to add a name if possible.
If it’s easier to work with one column, I could also imagine adding the name within the number column. In the end, I can imagine having the point in Rhino with the text attached to it in the form of a block? I’m not used to working with tags, but maybe it’s even better? Just naming the point object in Rhino with the name and number we attribute to the point in the .csv? I’m just wondering whether with labels it will display big names if I zoom out and then I won’t be able to see anything.
If you want to have a text block, then pretty much any formatting is possible, multiline is OK. It’s also possible with dots, the formatting possibilities are less but multiline is also possible.
The difference is that text is a fixed size and will zoom in and out with the view, while text dots are going to stay the same size on the screen no matter what the zoom level.
The name/number is combining the first two columns
The point object is named the same and grouped with the text
All of this is flexible and can be changed in any way you want.
The text is very small (0.025 units high) because the point coordinates are also very small. E5 and E8 are almost on top of each other anyway… ImportCSV-Test1.3dm (2.2 MB)
Thank you for your time! It seems to work well. The choice of text is indeed better. The fixed size of the dot may cause difficulties when drawing. It’s also great to have the object named according to the .csv.
The distance between the block of text and the point is perhaps a tricky one. When I was redrawing, I saw that there could be some confusion for the snap between the edge of the text block and the measurement point. Perhaps an offset between the text and the point would be more appropriate?
I don’t know if it would then be possible to move the text for all the points if necessary? I also see that this is a group, so perhaps a block would allow you to move the text for all the entities afterwards, unless this is also possible in a group?
For the E5 and E8 overlap, that’s part of the measures, so we’ll have to accept it that way.
Thanks @Japhy!
This also seems to be a good solution. Although I think I’m more comfortable with the procedure of loading a script than with Grasshopper, I’ll try to see how it works.
This is certainly possible, I simply used the point location as the insertion point for the text which is then bottom-left justified from it. It’s easy enough to add a fixed X+ axis offset to move the text block away from the point a given distance.
This is of course the limit of a scripted vs. Grasshopper solution. A script runs once and the result is added to the document. If you don’t like it you need to undo, change some parameters and then run the script again. With Grasshopper, you have a realtime preview/update as you adjust the parameters.
In the script I grouped the text with the point so that they would be selected together, but this is optional and can be changed. I’m not sure how blocks would help here as each individual point would be a different block. It is possible to move all the texts together (even while still grouped with the points) by using the SelText command to select them and then move with the Gumball for example.
Then the group solution seems to me to be a good and sufficiently flexible solution. Text changes can also be made easily by modifying the annotation style. And moving the text works well. It may not even be necessary to have an offset. It can be moved after the points have been imported if necessary.
However, I’ve tried the option to have the text perpendicular to the view, but it doesn’t seem to work for the left and right views? Is this normal or a bug? In the perspective view the text disappears as soon as you approach a left or right view.
“Normal”… yes. Text blocks are planar objects that lie in a plane. They are ‘designed’ to disappear when viewed edge-on - and I guess there is a certain angle tolerance there - IIRC maybe 10° +/- ?
Text dots are visible at any angle in any view, they are always parallel to the screen. But again, they are a fixed size.
Anyway, here is the script in its current form:
import rhinoscriptsyntax as rs
import Rhino
def ImportSurveyPointsSpecial():
start_folder=rs.DocumentPath()
#if not start_folder: start_folder=""
filepath=rs.OpenFileName("Open", "CSV Files (*.csv)|*.csv||",start_folder)
if not filepath: return
pass
rs.Prompt("Working...")
pts=[]
ht=0.025 #change later
with open(filepath, "r") as file:
for line in file:
line_data=line.split(";")
try:
x=float(line_data[2])
y=float(line_data[3])
z=float(line_data[4])
pt=Rhino.Geometry.Point3d(x,y,z)
pt_name=line_data[0]+line_data[1]
pt_id=rs.AddPoint(pt)
rs.ObjectName(pt_id,pt_name)
text=rs.AddText(pt_name,pt,ht,justification=1+65536)
group=rs.AddGroup("Point {}".format(pt_name))
rs.AddObjectsToGroup([pt_id,text],group)
except:
continue
ImportSurveyPointsSpecial()