Contours From Shape Files With Elevations

kick it on CadKicks.com

Murph has written an excellent post on creating contours from shape files with elevations. I have been using this method for a while now. In fact I have written and to automate importation of contour data into my drawings.

Simply start a blank drawing, import the ESRI contour shape file using Map 3D, save the drawing as “contour.dwg” (without quotation marks), and close it.

Then customize a script to import the contours and automatically put them on actual elevations based on their object data. Here is an example script to import contours from another drawing:

cmddia
0
ADEDRAWINGS
at
C:\[path-to-folder-with-contour-drawing]\contour.dwg
x
adequery
c
p
on
d
e
:ELEV@Default_contour
x
x
d
l
all
p
and
la
*
x
e
d
ADEDRAWINGS
de
contour.dwg
x
cmddia
1
 

First, copy and paste the above code into Notepad (or similar text editor) and change the path:

C:\[path-to-folder-with-contour-drawing]\contour.dwg

…to point to where your contour drawing is stored.

Second, find the code:

:ELEV@Default_contour

…and modify it. This is a Map 3D expression and it should be modified to match the object data embedded in your contours. To figure out how to create your own expression to work with your data, let’s break it down. The basic expression is as follows:

:[FIELD]@[TABLE]

The code [FIELD] is a field name in an object data table called [TABLE]. If you were to type ADEEDITDATA on the command line and select a contour polyline, you would see something like this:

Notice the table name in this case is called “Default_Contour” and one of the field names is called “ELEV”. Hit OK to close the “Edit Object Data” dialog box.

Another way to look at object data is through the Properties palette. Click on a contour polyline, right-click and select “Properties…”

At the bottom of the “Properties” palette you will find the object data section that looks something like this:

In this example you would take this expression:

:[FIELD]@[TABLE]

…and replace [FIELD] with ELEV, and replace [TABLE] with Default_contour so it looks like this:

:ELEV@Default_contour

Save the file with a .scr extension. Type SCRIPT in AutoCAD to browse for your script file and open it. It will run immediately and you should see your contour data come in on the correct elevations.

Share and Enjoy:
  • Digg
  • Technorati
  • LinkedIn
  • Facebook
  • del.icio.us
  • TwitThis
  • StumbleUpon
  • Live
  • Google

1 Comment so far

  1. Sign up at Gravatar.com to add your picture. CadKicks.com on October 27th, 2008

    Contours From Shape Files With Elevations…

    You’ve been kicked (a good thing) - Trackback from CadKicks.com…

Leave a reply