• 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

BLOCKNOTCH LISP: Trim Lines to a Block Outline in AutoCAD

August 3, 2026

Drop a block onto a line and the line runs straight through it. BLOCKNOTCH cuts the line so the block sits in a clean gap — exactly as a valve sits in a pipe run, a door sits in a wall, or a switch symbol sits in a circuit. It rotates the block to match the line at the same time.

What BlockNotch does

Place a symbol on a sloping or curved line and the block turns to follow the line’s direction at that point, automatically, before the gap is cut.

Doing this by hand means BREAK with two carefully snapped points, twice over, plus a ROTATE with a reference angle — for every symbol. This replaces all of it with one pick.

Three commands. BLOCKNOTCH inserts a block, rotates it to the line and cuts the gap. NOTCHBLOCK cuts the gap around an existing block, repeatedly. NOTCHALL cuts the gap around every block in a selection — which is how you fix a drawing where the symbols were all placed first.

Arcs, ellipses, circles, lines, xlines, splines, polylines and lightweight polylines are trimmed. Anything else near the block is left alone.

How to use it

  1. Load the routine with APPLOAD, or put it on your support file search path.
  2. Type BLOCKNOTCH to place a new symbol, NOTCHBLOCK for one already placed, or NOTCHALL for a whole selection.
  3. Pick the insertion point on the line, or select the existing blocks.
  4. Type R at any selection prompt to toggle automatic rotation. The setting is shared by all three commands and survives between sessions.

How it works

1. The bounding box. The block’s true extents are measured by walking its definition and unioning the bounding boxes of the geometry inside. Text, MText and attribute definitions are deliberately excluded — a long label would otherwise inflate the box and gouge a gap far wider than the symbol. Objects on frozen layers and invisible objects are excluded for the same reason. Nested blocks are measured recursively.

Measuring the definition rather than calling GetBoundingBox on the reference matters: AutoCAD’s own bounding box for a dynamic block is frequently wrong, reporting the extents of the unmodified definition rather than the current state.

2. The rotation. Every curve near the block is tested and the one passing closest to the insertion point wins — but only if it passes within a ten-thousandth of a unit, so a block merely near a line is left alone rather than snapping to it. The curve’s first derivative at that point gives the tangent direction, which becomes the block’s rotation. The angle is then flipped if necessary so the block never ends up upside-down.

3. The cut. A temporary closed polyline is drawn around the block’s outline. Every nearby curve is intersected with it, the two intersection points furthest apart are found, and BREAK removes the span between them. The temporary polyline is then deleted.

Taking the furthest-apart pair is what makes this robust. A line crossing the box produces two intersections and either pair works — but a line crossing a re-entrant or rotated outline can produce four, and breaking between the wrong pair would leave a fragment inside the block or cut away far too much.

Notes and limits

  • The gap is rectangular and aligned to the block. A round symbol therefore gets a square gap. That is normal for schematic work, but it is worth knowing before you use it on something where it would show.
  • Rotation only happens within a ten-thousandth of a unit of a curve. A block placed near but not on a line keeps its rotation.
  • Automatic rotation is a shared, persistent setting. Toggle it with R at any of the three commands’ prompts; the change applies to all of them and survives restarts.
  • Only the listed curve types are trimmed. Hatches, text and other blocks near the symbol are untouched.

Download and details

NameBlockNotch — trim geometry to a block outline automatically
DownloadBlockNotch.lsp — 39.6 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandsBLOCKNOTCH, NOTCHALL, NOTCHBLOCK
Requiresthe ActiveX layer (loaded automatically by the routine with vl-load-com).
Source size39.6 KB, 927 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

  • BLOCKABSORB LISP — add geometry into a block definition in place
  • BASESNAP LISP — get the block’s base point where it needs to be first
  • 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