• 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

CORRAL LISP: Select Everything Inside a Polyline or Circle

August 3, 2026

AutoCAD gives you window and crossing selection, but both are rectangles. When the boundary you care about is an irregular site outline, a room, a zone or a circle, you are reduced to a fence or a lot of shift-clicking. CORRAL traces the boundary you point at and builds a WPolygon selection from it.

What Corral does

Two ways to use it. Type CORRAL at the command line and the objects inside the boundary are selected and gripped, ready for the next command.

Or type 'CORRAL transparently at any Select objects: prompt, and the enclosed objects are fed straight into the command already running. ERASE, COPY, MOVE and the rest can all use it as a selection method — which is where it earns its keep, because you are not selecting first and then deciding what to do.

How to use it

  1. Load the routine with APPLOAD, or put it on your support file search path.
  2. Type CORRAL to select and grip the contents of a boundary.
  3. Or start any command, and at the Select objects: prompt type 'CORRAL — with the leading apostrophe.
  4. Pick the polyline or circle to use as the boundary.

How it works

The picked boundary is traced and its vertices used to build a WPolygon selection — the polygon equivalent of a window, which AutoCAD supports but does not make easy to drive from an existing object.

The CMDACTIVE test is what distinguishes the two modes. If no command is running, the routine starts its own SELECT to collect the objects. If one is running, it feeds points into the selection prompt already waiting. One routine, two behaviours, decided by asking AutoCAD what state it is in.

It deliberately does not open an undo group. The routine only selects — it never modifies the drawing — so an undo group would push an empty entry onto the undo stack. Worse, when used transparently it would corrupt the undo record of the host command, so that undoing the ERASE you just did would not behave properly. Not opening one is the correct decision, not an omission.

Notes and limits

  • The boundary must be a polyline or a circle. It is traced as picked, so it needs to be a real closed object.
  • WPolygon selects what is fully inside. Objects crossing the boundary are not caught — that is window behaviour, not crossing.
  • The leading apostrophe matters for transparent use: 'CORRAL, not CORRAL.
  • It changes nothing, which is why there is deliberately no undo group.

Download and details

NameCorral — select everything inside a picked polyline or circle
DownloadCorral.lsp — 8.6 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandCORRAL
Requiresnothing beyond a CAD platform with AutoLISP.
Source size8.6 KB, 184 lines
Error handlingYes — a *error* handler restores every system variable it changed, on cancel as well as on error.
UndoNot needed — this routine only reads the drawing and changes nothing.
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

  • ZONE LISP — total polyline length or area by layer
  • TAPE LISP — total the length of whatever you have just selected
  • 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