• 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

MATCHROT LISP: Rotate a Selection to Match Another Line

August 6, 2026

MATCHROT turns a selection so that one line in it ends up parallel to another line you point at. No angles to work out and none to type.

What MatchRotate does

For squaring a detail up to a wall that is not on a round number, lining a note up with a pipe run, or setting a north point to a site boundary.

ALIGN does something related but not the same — it moves and scales as well, and needs matched pairs of points. This only turns, about a base point you choose.

How to use it

  1. Load the routine with APPLOAD, or put it on your support file search path.
  2. Type MATCHROT.
  3. Select the objects to turn, and pick the base point to turn about.
  4. Pick the reference line in the selection — the edge that is to end up parallel to something.
  5. Pick the target line.

How it works

Two lines are picked. The first is the reference in the selection; the second is the target. The difference between their angles is how far everything turns.

Both are read with nentsel rather than entsel, so an edge inside a block can be used without exploding it. On a site plan the boundary you want to square up to is usually inside an xref, and that one choice is the difference between the routine being useful and being useless.

The rotation is worked out before ROTATE starts. Starting the command and then going off to ask three questions leaves ROTATE hanging at a prompt if anything goes wrong in between.

Notes and limits

  • Pick the reference line inside your selection first, then the target outside it. The other way round turns it backwards.
  • Nested edges work — blocks and xrefs do not need exploding.
  • ORTHOMODE and the pick aperture are restored, including on cancel.
  • One undo group covers the rotation.

Download and details

NameMatchRotate — rotate a selection to match another line
DownloadMatchRotate.lsp — 6.1 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandMATCHROT
Requiresthe ActiveX layer (loaded automatically by the routine with vl-load-com).
Source size6.1 KB, 146 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

  • SKEWBOX LISP — drawing square to something skewed in the first place
  • BASEPIN LISP — moving the point a block rotates about
  • 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