Today I needed to take a 2D survey and create a landscape in Sketchup.
I had the elevation data in the autocad file but it was in metres (I work in mm) and was just text, it had no Z axis data.
So I needed to get AutoCAD to generate the Z data from the text. However the text was in metres, so first needed to convert it to mm.
Using the Find (and Replace) command I searched the text for the dot or fullstop between the two numbers e.g. 84.51 and replaced it with nothing. So the text became 8451.
All it needed now was the trailing zero. That was easier said than done! I tried several text replacement applications, one was freeware and was completely useless as it required registration and the demo was limited to a small number of items. Others refused to work and some seemed to only work on mtext. Eventually I found one that works a charm, thanks Tharwat!
So now I had a load of text and blocks without any other data. There are a couple of lisp routines I found to assist with adding the Z data. One extracts the data into a text file (I found that I could not manipulate that data as point cloud in AutoCAD so I dismissed it) and the other takes the insertion point of the text (slightly out from the actual survey point but suitable for my needs). They are pntconv.lsp and Txt2pnt.lsp respectively.
I used quickselect to remove all the blocks and was left only with the text.
Then I ran txt2pnt.lsp, and selected all the text, for some reason it did not like that and only create some points. So I ran the lisp several times selecting smaller groups and that worked.
Viewing the point cloud in 3D there were a few stray points that I removed. Also I removed the original text to create a “pure” point cloud.
Now I had a point cloud that I could bring into Sketchup.
For this you will need points_cloud_triangulation.rb and the other Ruby file delauney2.rb which the first needs. delauney2.rb is available from Sketchucation. However the file needs renaming to delaunay2.rb when placing into the plugins folder (but works).
Then import the drawing into Sketchup, select all the points (make sure they are exploded) and run the plugin points_cloud_triangulation.rb!
Voila a mesh that can now be smoothed, edited etc!