The process of importing contours from shapefiles is actually a two step process, since the results from Autodesk’s MAPIMPORT command does not elevate the resulting polylines. This is a step-by-step procedure on how to take a shapefile of contours to elevated polylines in AutoCAD (Map/Civil3D).
Shameless plug: Users of our MapWorks or C3DTools product can now simply use PolyContour > Shape Read. Select the shapefile, choose the elevation field and you’re done. Optionally layer imported polylines using fields in the shapefile data or by an interval.
In AutoCAD Map (or Civil3D) begin in a new drawing. If you know the coordinate system you are going to be working with, you can use the ADESETCRDSYS command to set it. Since that’s somewhat optional we won’t go into any more details on that. If you want to know more about ShapeFiles, click here.
Importing the flat contours (with object data):
- Issue the MAPIMPORT command.
- Navigate to the location of the ShapeFile (*.shp, *.dbf).
- Select the .SHP file and choose [OK].
- In the next dialog, follow steps 5 though 8 below.
- Check on “Import polygons as closed polylines” in the lower right
- In the grid in the center, click <None> under [Data].
- Set the radio button to “Create object data” and click [OK].
- Click [OK] again to continue. You should see a number of objects imported at the command area.
- Zoom Extents to see the contours.
- Save the drawing under a name on local drive C: like “C:\Temp\Source.dwg”.
If you have the PROPS dialog open, you will notice that if you click on a contour, the elevation is 0.00 but in the OD: section below that, you will see a field showing the proper elevation. Take note of the field name as you will use it in the next process.
Elevating the contours (with attached object data):
- Begin a new empty drawing or open the project drawing that you are sure the contours would appear at the proper place in.
- Issue the ADEDRAWINGS command so we can attach your previously created Source.dwg.
- Click the [Attach] button. You will notice that the only place you can look in (by default) is drive C: that’s why we had you save the file there. You have to create aliases to other locations and that’s not covered here.
- Navigate to C:\Temp and select the Source.dwg, click [Add] then [OK].
- Click [OK] to close the Drawing Set dialog.
- Issue the ADEQUERY command.
- In the lower left click [Location], click {OK} for “all”.
- In the lower center check on Draw mode.
- In the lower right (Options) check on the toggle, then click [Alter Properties].
- In the center of the Property Alterations dialog, turn on Elevation.
- Click the [Expression] button, expand Object Data, expand the table name, and choose the field we asked you to note above. Click [OK] to close that dialog, you will see the expression in the field. Click [Add] to add it to the top of the list.
- Click [OK] to close the Property Alterations dialog.
- Click the [Execute Query] button to begin the process. You should see the same number of objects queried at the command area.
Now if you zoom extent you should see your elevated contours ready to continue. While Map’s Drawing Attach & Query tools are very powerful, for common procedures there is a better way.