|LITIGATION GRAPHICS - COMPUTER ANIMATION - TECHNICAL ILLUSTRATION - CAD DRAFTING - AUTOLISP PROGRAMMING
Copyright 2019 - Pixel Graphics, Inc. All rights reserved.
AutoLisp Program: Reducing the Number of Vertices in a Polyline
Overview of Program
This program reduces the number of vertices in a simple (non Splined or Curve Fit) polyline using
Visvalingham's algorithm (link to reference paper). It does this by calculating the triangular area formed
by the target vertex, the previous vertex, and the following vertex. The program iterates through all the
vertices calculating their effective area. Then the vertex with the smallest area is removed successively.
The theory is that removing the vertex with the smallest area will have the least visual impact on the
Below is an example of the program running, and reducing the number of vertices from 497 to 51 by
pressing the +/- keys.
Jeff Winship - Computer Graphics Consultant November 8, 2019
How to Download the Program
Download the AutoLisp program by clicking the link below. Remember where you put it so that you can
load it into AutoCAD.
After downloading the program, enter APPLOAD at the AutoCAD command prompt then select the file
"polysimp.lsp" to load it. Then simply type polysimp at the AutoCAD command prompt to run the
command. It will first ask you to select a polyline, after which it calculates the effective areas and puts them
in rank order from smallest to largest. Polylines with a very large vertex count will take some time for the
initial calculation. Then you repeatedly press the - or + keys to reduce the vertex count or restore it
If you download and use this program, please respect my work and the time I've put into it by keeping my
copyright info with the function, and giving me credit where it's appropriate. A link from your site would be
appreciated as well.
If you have any comments or questions regarding Autolisp program, or even find a bug, feel free to e-mail