Lots of Data, Little Overhead

I’ve been sitting next to Dana every day for the past week and I seem to have caught a mild case of the blogging disease she’s afflicted with. I don’t know how long it will last, so I figured I better post as much as I can before it wears off and I fall silent again like Charlie Gordon in Flowers for Algernon. 

One problem often encountered is the difficulty in making a surface from a huge amount of data generated from Lidar topographic surveys. It should be no secret that if you have access to the point file (ascii format will do) you can use the file as data for your surface without importing all the points into your dwg file. Under the Definition collection for your surface, right-click on Point Files, select Add, select format and your ascii file. The result is a surface without all the Point Object overhead. Well, what to do if you don’t have the ascii file? What if you only have a huge dwg with polylines that represent the contours? You use this nifty little bit of code, that’s what…

Of course you know you can build a surface from contour data. But all those vertices weigh heavy on the drawing file size and, more importantly, on drawing performance (pan, zoom, regen, etc). So, you could weed the contour vertices and reduce the data, but you paid for all that data (or someone did) and by god you want to use it all so you get your money’s worth. Wouldn’t be cool if you could write out the XYZ coordinates of each polyline vertex to a ascii file? You could then use the technique described above.

Peter Funk whipped this little macro up while I ran for a cup of coffee. Yes, he’s that good. And after some extra tweaking by Rob Todd (see Jason’s post about Survey extension for a real example of Rob’s mad programming chops), this thing was ready for prime time. Try it and of course, use at your own risk.

  1. load the macro
  2. select all the polylines FIRST
  3. run the macro
  4. file is saved to C:\polyline.txt

For dwgs with lots of polyline vertices, it can take several minutes to export all the data. However, after that, it takes very little time to create a surface. The data set I was working with had 947,648 vertices. The surface was built in 50 seconds. It took another 60 seconds to apply 1′ contours. Not too shabby. Beware though, looking at a surface this big in Object Viewer will likely cause a crash. Hey, I never said the world was a perfect place.

Polylinethingy Vertex Extractor

Enjoy!

6 comments

  1. Jason Hickey says:

    WOW – nice!

    BTW, this is exactly what the toolbox was designed for – now it’s a permanent addition to my toolbox.

    I did modify the file a bit to give you an “OK” dialog box when you finish the export. As it is right now, it doesn’t LOOK like it’s doing anything, so I just wanted some confirmation…

  2. jfs4977 says:

    wow!!someone does care, you like us you really do like us. Thanks

  3. A. Marsh says:

    Hey I dont suppose there is a routine that exists that does the same as above but creates the file from 3d triangle faces instead of polylines?

  4. A. Marsh,
    I dont know of any code to do this.
    Can you convert triangle to plines and go from there?
    I know this is not the best solution, but it may fit your needs.

    Mark

  5. Scott Duffin says:

    All,

    I am struggling with a massive surface that is crashing everything when I go to ISO View and try to apply a material. Sounds like just what I need. However, I clied on the polyline vertex extractor and is says it cannot find the link. Can you let me know where I can download this utility?

    Thanks!

  6. Justin Ziemba says:

    Scott, probably a little late, but try this link:

    http://www.civil3d.com/2007/02/son-of-the-polylinethingy/

    The zip file contains both the original and the “son of” versions.

    enjoy.