• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
blog.draftsperson.net

blog.draftsperson.net

the art of technical drawing

blog.draftsperson.net

VERTINJECT LISP: Add a Vertex to a Polyline Where You Click

August 3, 2026

PEDIT can insert a vertex, but only by walking the vertex list one step at a time until you reach the right segment. VERTINJECT puts a vertex where you click, and keeps prompting so several can be added in one go.

What VertexInject does

The polyline looks completely unchanged afterwards — which sounds obvious and is the entire difficulty.

How to use it

  1. Load the routine with APPLOAD, or put it on your support file search path.
  2. Type VERTINJECT.
  3. Click on the polyline where the vertex should go.
  4. Keep clicking to add more. Press Enter to finish.

How it works

Splitting a straight segment is trivial. Splitting one that has width and curvature is not, because both have to be divided so the polyline looks identical afterwards.

Width interpolates linearly. If a segment tapers from 5 to 15 and you split it a third of the way along, the new vertex takes width 5 + (a third of 10) = 8.33, and the two halves then run 5-to-8.33 and 8.33-to-15.

Curvature does not. It is stored as a bulge, which is the tangent of one quarter of the arc’s included angle. Bulge does not divide linearly, so it has to be converted back to an angle, split in proportion, and converted to a bulge again:

angle      = atan(bulge)        one quarter of included angle
firstHalf  = tan(fraction × angle)
secondHalf = tan((1 - fraction) × angle)

Get this wrong and an arc segment silently collapses to a straight line — which is exactly the bug that version 1.1 of the original was released to fix, on the closing segment of a closed polyline.

Notes and limits

  • LWPolylines. Heavy polylines and 3D polylines are a different object.
  • Width and curvature are both preserved, which is the whole point of the routine.
  • It keeps prompting, so several vertices can be added in one command.
  • One undo group covers the run.

Download and details

NameVertexInject — insert a new vertex into a polyline at a picked point
DownloadVertexInject.lsp — 10.0 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandVERTINJECT
Requiresthe ActiveX layer (loaded automatically by the routine with vl-load-com).
Source size10.0 KB, 222 lines
Error handlingYes — a *error* handler restores every system variable it changed, on cancel as well as on error.
UndoThe whole operation is wrapped in a single undo group, so one U reverses all of it.
CompatibilityAutoCAD (any release with AutoLISP), BricsCAD, ZWCAD, GstarCAD, ProgeCAD and other IntelliCAD-based platforms. AutoCAD LT needs a LISP enabler. No .NET, no ObjectARX, no installer.
AuthorYZ, August 2026
LicenceFree to use, supplied “as is” with no warranty.

References

  • PARTOFFSET LISP — the same bulge arithmetic, splitting a section to offset
  • SEGREPORT LISP — report every segment, width and bulge included
  • WIDTHTRACE LISP — turn a wide polyline into a real outline
  • More free AutoLISP routines on this site
  • Wisey’s Steel Shapes — free structural steel section drawing program

Filed Under: AutoLISP Routines

Primary Sidebar

Subscribe to our Youtube Channel

Post CAD drafting jobs on Freelancer.com. and get some free money to do this.

Categories

  • American Steel Industry (4)
  • AutoCAD Articles & Reference (30)
  • AutoCAD Bugs & Problems (19)
  • AutoCAD Tips (29)
  • AutoCAD Tutorials (54)
  • AutoLISP Routines (328)
  • AutoLISP Tutorials (15)
  • CAD Standards (7)
  • Civil 3D (7)
  • Civil Drafting (4)
  • Dimensions (2)
  • Drafting Funnies (71)
  • Drafting History (9)
  • Drafting Standards (84)
  • Electrical Drafting (2)
  • General IT reference (7)
  • Geometry (15)
  • GIS (2)
  • Hatch Patterns (12)
  • Office Life Hacks (3)
  • PT (1)
  • Revit Tutorials (54)
  • Steel Detailing (14)
  • Structural Drafting (26)
  • Technical Dictionary (61)
  • Useful Website Links (19)

Footer

Free downloads

  • Free AutoLISP routines
  • Free hatch patterns
  • SHX fonts & text styles
  • Numbering LISP collection
  • ISO 3098B font

Reference charts

  • AWS weld symbols chart
  • Steel detailing chart
  • Hole & slot sizes
  • Bolt edge distance
  • ANSI & ARCH paper sizes
  • How to fold an A1 drawing

Useful links

  • CAD blocks (DWG)
  • Revit families
  • structuraldrafter.com
  • cad-corner.com
  • About
  • Privacy policy

Provided for free with no warranty · Log in