C2P: Effortlessly Convert AutoCAD Circles to Polylines with AutoLISP
Program Description
The CircleToPolyline (C2P) AutoLISP utility is a focused productivity tool built for AutoCAD users who routinely need to convert CIRCLE entities into editable polylines without degrading geometry.
In standard drafting, circles are quick to create but limited when it comes to downstream operations. They don’t support segment-level editing, variable width, or reliable behavior in CAM, CNC, or GIS pipelines. That becomes a problem when files move outside AutoCAD or into fabrication workflows.
This routine solves that cleanly.
Instead of breaking circles into multiple line segments (which is what commands like EXPLODE or poorly written scripts often do), C2P uses a two-arc polyline structure. Each circle becomes a closed LWPOLYLINE made of exactly two semicircular arcs, defined using bulge values.
That means:
- No approximation
- No faceting
- No geometry drift
You get a true circle equivalent, but with all the advantages of a polyline.
On top of that, the routine preserves key object data:
- Layer
- Color (ACI)
- Linetype
- Lineweight
- Elevation (Z)
- Extrusion vector (UCS-safe orientation)
This is not just a conversion tool—it’s safe for production drawings.
Download the script here.
How to Use: Step-by-Step Guide
The command integrates directly into a normal AutoCAD session. No special setup beyond loading the LISP.
1. Load the Script
Save the file as:
CircleToPolyline.lsp
Then in AutoCAD:
- Run APPLOAD
- Browse and load the file
Reference: Autodesk documentation on loading LISP https://help.autodesk.com/view/ACD/2024/ENU/?guid=GUID-7B3C2B3D-5E3B-4D6D-8A6E-9E5D9E3C7B2F
2. Run the Command
Type:
C2P
Press Enter.
3. Select CIRCLE Entities
- Pick individual circles
- Or use window/crossing selection
- The filter ensures only CIRCLE entities are processed
4. Execute Conversion
Press Enter to confirm selection.
The routine will:
- Read geometry and properties
- Build a 2-vertex LWPOLYLINE with bulges
- Replace the original CIRCLE
No prompts, no extra steps.
5. Verify Output
Each circle is now:
- A closed polyline
- Editable via PEDIT
- Compatible with offset, width, trimming, CAM export
Program Code (CircleToPolyline.lsp)
;;; ==========================================================================
;;; Command: C2P (Circle to Polyline)
;;; Description: Converts selected circles into closed lightweight polylines
;;; made of two arc segments (semicircles).
;;; ==========================================================================
(defun c:C2P (/ ss i ent entData center radius layer elevation extrusion pt1 pt2 color ltype lweight polyData)
(vl-load-com)
;; Prompt user to select circles
(princ "\nSelect circles to convert to polylines: ")
(setq ss (ssget '((0 . "CIRCLE"))))
(if ss
(progn
(setq i 0)
(while (< i (sslength ss))
(setq ent (ssname ss i))
(setq entData (entget ent))
;; Extract base circle properties
(setq center (cdr (assoc 10 entData)))
(setq radius (cdr (assoc 40 entData)))
(setq layer (cdr (assoc 8 entData)))
(setq extrusion (cdr (assoc 210 entData)))
;; Extract optional properties (color, linetype, lineweight)
(setq color (assoc 62 entData))
(setq ltype (assoc 6 entData))
(setq lweight (assoc 370 entData))
;; For LWPOLYLINE, points are 2D. The Z-coordinate is handled by elevation.
(setq elevation (caddr center))
;; Calculate two 2D vertices (left and right edges of the circle)
(setq pt1 (list (+ (car center) radius) (cadr center)))
(setq pt2 (list (- (car center) radius) (cadr center)))
;; Construct the base LWPOLYLINE entity list
(setq polyData
(list
'(0 . "LWPOLYLINE")
'(100 . "AcDbEntity")
(cons 8 layer)
)
)
;; Append optional properties if they exist on the original circle
(if color (setq polyData (append polyData (list color))))
(if ltype (setq polyData (append polyData (list ltype))))
(if lweight (setq polyData (append polyData (list lweight))))
;; Append polyline-specific geometry and bulge (arc) data
(setq polyData
(append polyData
(list
'(100 . "AcDbPolyline")
'(90 . 2) ; Number of vertices (2)
'(70 . 1) ; Closed polyline flag
(cons 38 elevation) ; Z-axis elevation
(cons 10 pt1) ; Vertex 1 (0 degrees)
'(42 . 1.0) ; Bulge for semicircle 1
(cons 10 pt2) ; Vertex 2 (180 degrees)
'(42 . 1.0) ; Bulge for semicircle 2
(cons 210 extrusion) ; 3D extrusion direction (for proper UCS handling)
)
)
)
;; Create the new polyline and delete the original circle
(if (entmake polyData)
(entdel ent)
)
(setq i (1+ i))
)
(princ (strcat "\nSuccess: " (itoa i) " circle(s) converted to polylines."))
)
(princ "\nNo circles selected.")
)
(princ)
)
(princ "\nCircleToPolyline.lsp loaded successfully. Type 'C2P' to execute.")
(princ)
Under the Hood: What the Routine Actually Builds
Each converted object is:
- 2 vertices
- 2 bulge values = 1.0
- Closed flag enabled
A bulge of 1.0 = 180° arc, so:
- Vertex 1 → semicircle
- Vertex 2 → second semicircle
Together, they form a perfect circle, not an approximation.
This is the key difference from typical scripts using:
- 8 segments
- 16 segments
- or straight-line tessellation
Those approaches increase file size and introduce precision issues.
SEO Optimization & Technical Benefits
Why Converting CIRCLE Entities to Polylines Matters in Real Projects
This is not theoretical. It solves real production issues.
Global Width Control
Polylines support constant or variable width:
- Road centerlines
- piping diagrams
- schematic diagrams
You cannot do that cleanly with CIRCLE entities.
CNC / CAM Workflow Compatibility
Many CAM systems struggle with true circle entities and prefer:
- continuous polyline paths
- or explicit arc definitions
Examples:
- AutoCAD exports to CAM
- Fusion 360 toolpaths
- Mastercam machining
Using polylines avoids:
- broken toolpaths
- unexpected segmentation
- post-processing errors
Reduced File Size and Cleaner DWG Structure
This routine creates:
- 2 vertices only
Compare that to:
- 16-segment approximation → 16 vertices
- exploded circle → dozens of lines
Result:
- lighter DWG files
- faster regeneration
- better performance in large drawings
3D and UCS Integrity
The routine preserves:
- Group Code 210 (Extrusion Direction)
- Elevation (Z)
That matters when working in:
- rotated UCS
- 3D modeling contexts
- imported geometry
Without this, converted geometry can flip or flatten.
Reference on DXF group codes: https://help.autodesk.com/view/OARX/2024/ENU/?guid=GUID-12540DAE-C84B-4BDB-AEEC-DDFE5BE3C42A
Better Editing with PEDIT
Once converted, you can:
- Join with other polylines
- Offset accurately
- Add width
- Trim or extend cleanly
Command reference: https://help.autodesk.com/view/ACD/2024/ENU/?guid=GUID-0C422AA9-23DD-4650-AD66-68E9D7989E3F
Comparison: Standard Methods vs C2P
| Method | Result | Issues |
|---|---|---|
| EXPLODE | Lines/arcs | messy geometry |
| PEDIT (Join) | segmented polyline | approximation |
| Third-party scripts | multi-segment arcs | heavy files |
| C2P | 2-arc polyline | clean, exact |
Practical Use Cases
- Preparing DWG for laser cutting
- Converting survey data for GIS systems
- Cleaning imported geometry from STEP/DXF files
- Standardizing geometry for block libraries
- Preprocessing drawings for automation scripts
Limitations You Should Be Aware Of
- Only processes CIRCLE entities (not arcs or ellipses)
- Original circles are deleted after conversion
- Fixed method: always 2 semicircles (no segmentation option)
These are deliberate design choices.
FAQ
Does this method reduce geometric accuracy?
No. The polyline uses true arc definitions via bulge, not straight segments. The result is mathematically identical to the original circle.
Why not just use PEDIT on circles?
Because CIRCLE entities are not polylines. PEDIT won’t convert them into a single optimized polyline without intermediate steps or segmentation.
Can I keep the original circles?
Not in this version. The routine replaces them. If needed, duplicate the selection before running C2P.
Will this work in 3D drawings or rotated UCS?
Yes. The routine preserves the extrusion vector (210) and elevation, so orientation remains correct.
Is this better than approximating with many segments?
Yes. Fewer vertices means:
- smaller files
- faster processing
- cleaner geometry
And no loss of precision.
Can this be extended to arcs?
Yes, but it requires a different approach. Arcs need:
- start angle
- end angle
- correct bulge calculation
This routine is intentionally limited to circles for reliability.
Does it affect layer standards or CAD compliance?
No. It preserves:
- layer
- color
- linetype
- lineweight
It integrates cleanly into controlled CAD environments.
Feedback and Next Steps
If you’re working with fabrication, GIS, or automated workflows, converting CIRCLE entities to polylines avoids problems later in the pipeline.
If you need a version that also handles ARC entities, or one that gives control over segmentation (2 arcs vs multi-arc smoothing), leave a comment or reach out.

