It is often required to create a polyline or polygon from a set of points when working in CAD environment. The point data comes from the conventional terrestrial survey instruments like Total stations, GPS/GNSS equipment and other survey instruments. The data is then plotted in AutoCAD for cartographic purposes in the form of point objects.
These points are then connected by constructing polylines using polyline command in AutoCAD. This manual process to construct polylines is manual and time consuming.
In this blog, I am going to share a custom tool developed using AutoCAD .Net API to automate the process of construction of polylines. The .Net assembly (SpaTools.DLL file) can be downloaded via link provided at the end of this blog.
The assembly works well with AutoCAD 2013 and latest versions. To load the .Net Assembly follow these steps:
- In AutoCAD, at the Command prompt, enter netload and press Enter.
- In the Choose .NET Assembly dialog box, browse to the assembly file (SpaTools.DLL). Click Open
Once loaded, there are two custom commands which can be used to construct polylines and polygons from points. It should be noted that the input points should be Points only. (No any other object).
Type CPL or cpl on command prompt. Select the points and press Enter (Right Click or Space). A polyline connecting the points will be constructed.
Type CPG or cpg on command prompt. Select points and press Enter (Right Click or Space). A closed polyline will be constructed.
The .Net Assembly can be downloaded here.
In case if netload shows the error as shown below,
Unblock the DLL first. Right Click on the DLL file and check the unblock checkbox and apply.
Restart AutoCAD application and use Netload to load the DLL again.