XYZ file terrain modeling


#101

The version at Ruby Library Depot is quite outdated.

Download the updated version from SketchUcation.


#102

Open the Ruby console (Window >> Ruby Console) and paste the following text into it (then hit Enter):

data = File.open(UI.openpanel("Select TXT File", "~", "Text Files|*.txt;||"),"r")
while(t = data.gets)
  x,y,z = t.chomp.split(' ')
  Sketchup.active_model.active_entities.add_cpoint([x.to_f - 4431377,y.to_f - 5468639,z.to_f])
end

In the fourth line, I have subtracted the smallest X and Y values from each point to create them close to the origin. The coordinates are assumed to be in inches and the magnitude of your data places them at a great distance away (beyond the point where they begin to act funky).

image

image


#103

Thanks for your lines!
What will happen after I choose the File *.txt? In my case the Ruby Consol did not close and no points are available.


#104

It should create the points from the file or the console should give some sort of error. It you’re using the test file you posted, you will need to remove the blank lines.

It’s not supposed to close. If there were no errors, try zooming out to see if maybe the points were created somewhere off screen.


#105

Thanks again!
You are right. It depends on the input values where the point cloud is located.
Is there at last any kind of possibility to triangulate the point cloud?


#106

If you can post the entire file (if you don’t mind sharing it), I’ll see about creating a mesh from the data.


#107

It might interest you to know that earlier this year I wrote a DLL importer (for Windows) which takes a number of rectangular raster file formats (containing terrain elevation data) and displays the data in Sketchup. Its a free importer.
You can find it in the Sketchup Community forum Extensions category:
“Sketchup Importer DLL for Norwegian, Swedish and Swiss LIDAR height-data raster cloud maps”.
Note that there are several versions, please observe the latest version. And please observe the accompanying documentation file.
I did successfully test the importer using some very few available Swiss XYZ ASCII (.txt) terrain files, but - as XYZ ASCII (.txt) files was not my main target at the time - the tests were limited. From your very small example.txt it appears that the SWISS format is the same as the one you use, although the grid datum is different.
You might give it a try.


#108

Thanks Geo!
This Plugin works great!

For each of you who want to import ASCII-Files in SketchUp, use plugin Geo mentioned. This works for me for a more than 120.000 point cloud.