Learn how to simplify contour polylines and generate a terrain mesh from existing contour lines in AutoCAD Map or Civil 3D using Plex-Earth. This tutorial explains how to reduce unnecessary vertices from contour polylines using MAPCLEAN or WEEDFEATURES to improve performance, then create a terrain mesh by selecting the contours with the Terrain From Objects command.
In some cases, contour lines used for terrain modeling come from external sources such as surveys or other software. These contours can contain a very large number of vertices when imported into AutoCAD, which may slow down performance or even cause the software to freeze when generating terrain surfaces.
To avoid these issues, the contour polylines should first be simplified by reducing unnecessary vertices. After simplifying the contours, you can use Plex-Earth to generate a terrain mesh from the contour lines.
This tutorial covers two processes:
Part A. Reduce Vertices of Existing Contour Polylines
Contour polylines imported from surveys often contain too many vertices, which can significantly affect AutoCAD performance and increase the number of triangles generated during terrain creation.
The process of simplifying polylines by removing unnecessary vertices is called weeding.
Below is an example of a drawing with contour lines acquired from a local survey.
If you zoom into a typical contour polyline from survey data, you may notice that the line consists of many small segments. These extra vertices are usually unnecessary for terrain modeling and should be reduced before creating the terrain surface.
Step 1. Run the Polyline Cleaning Command
If you are using AutoCAD Map 3D, type the following command: MAPCLEAN
A cleanup dialog window will appear.
Select Select Manually, choose the contour polylines you want to simplify, and click Next.
📢 Note: If the contour lines are very complex, selecting too many at once may freeze AutoCAD. It is recommended to process them in smaller groups.
Step 2. Weed the Polylines
In the Cleanup Actions list, select Weed Polylines to add in Selected Actions → Next
In the final window, select Modify Original Objects → Finish
This process removes unnecessary vertices from the contour polylines.
If the contours are still complex, you can repeat the weeding process multiple times until the polylines are sufficiently simplified.
Below you can see the difference in a contour line, by applying the process five times.
Tip for Civil 3D Users
If you are using Civil 3D, you can simplify the contour lines using the command:Â
WEEDFEATURES
Select the contour polylines and repeat the process as needed until the desired level of simplification is achieved.
Part B: Create Terrain from Contour Lines
After simplifying the contour polylines, you can generate a terrain using the same workflow described in Create Terrain from Existing Points and Contours, but using only contour lines as input.
- Go to the Plex-Earth ribbon → Contextual Data panel → Create Terrain dropdown button → Terrain: From Objects. Alternatively, type inÂ
PXV_TERRAIN_FROMOBJECTSÂ in the command line. - Select the objects when prompted:
Press Enter to skip Points.
Select the contour polylines when prompted for Breaklines.
Optionally select a Boundary polyline to define the terrain extent.
Optionally select Holes if areas should be excluded from the surface.
After completing the selections, Plex-Earth generates the terrain based on the contour lines, which can be inserted as normal CAD drawing objects (mesh, points, etc.). To insert as a mesh, click on Edit → Insert → As Mesh.
📢 Tip: For a better 3D visualization of the terrain mesh, switch the drawing Visual Style to Realistic.
FAQs
Why do I need to simplify my contour polylines before creating terrain?
Contour lines from surveys or external software often contain a very large number of vertices — far more than are needed to represent the terrain shape accurately. When Plex-Earth generates a terrain mesh from these contours, each vertex contributes to the triangle count of the mesh. Too many triangles can slow AutoCAD down significantly, cause freezing during terrain generation, or trigger an eOutofRange error. Simplifying the polylines first reduces the vertex count while preserving the overall contour shape.
AutoCAD freezes when I run MAPCLEAN on my contours — what should I do?
This is expected behaviour when the contour lines are very complex. Do not try to process all contours at once — select and weed them in smaller groups instead. Run MAPCLEAN on a subset of contours, complete the process, then repeat for the next group. This reduces the load on AutoCAD and avoids freezing.
Which command should I use — MAPCLEAN or WEEDFEATURES?
It depends on your CAD version. Use MAPCLEAN if you are on AutoCAD Map 3D, and WEEDFEATURES if you are on Civil 3D. Both achieve the same result — reducing unnecessary vertices from the contour polylines — but the interface and workflow differ slightly between the two. Standard AutoCAD does not include either command.
I am getting an eOutofRange error when creating terrain from my contours — how do I fix it?
This error means the contours still contain too many vertices, making the resulting mesh triangle count too high for AutoCAD to process. Run the weeding process several more times on the affected contours using MAPCLEAN or WEEDFEATURES until the polylines are sufficiently simplified. If the error persists even after repeated weeding, break the area down into smaller sections and create the terrain in parts.
Related Questions
This article explains how to simplify contour polylines and create a terrain mesh from existing contour lines in AutoCAD Map 3D or Civil 3D using Plex-Earth. You may have searched for:
- How to reduce vertices in contour polylines in AutoCAD
- How to create a terrain mesh from contour lines in AutoCAD or Civil 3D
- AutoCAD freezing when creating terrain from survey contours
- eOutofRange error when generating terrain mesh in AutoCAD
- How to use MAPCLEAN or WEEDFEATURES to simplify polylines for terrain