eplisp

AutoCAD Cable Routing LISP: Orthogonal Runs Along Walls

Draws cable runs between your clicks, parallel to the nearest wall with clean 90-degree turns.

Commands: CABLEROUTE CABLEROUTE-SET

Load the downloaded .lsp file with the APPLOAD command in AutoCAD or GstarCAD, then type the command name. How to load a LISP file

Download all tools in one file (138 KB)

CABLEROUTE is an AutoCAD cable routing LISP that speeds up drawing cable runs on electrical plans. Instead of joining your clicks with straight lines, it runs the cable parallel to the nearest wall line at a fixed offset. The route is made only of horizontal and vertical segments with 90-degree turns, so you get tidy runs without hand-drawn wobble.

For each pair of points, the tool finds the LINE or LWPOLYLINE segment closest to the imaginary line between them and places the cable on that segment's offset line, on the side you clicked. The default offset is 6 drawing units, which is 6 cm on a plan drawn in centimetres. Corners use the intersection of the previous and next offset lines, so turns meet cleanly without notches. If the start or end point is well away from the offset line, the route drops a perpendicular segment to reach it.

Existing cables also act as references. When a new run passes close to a line already on the cable layer, it aligns with that cable instead of the wall, so runs that share a corridor stay in neat parallel bundles.

You can draw one cable after another without restarting: left click adds a point, right click finishes the current cable and starts the next, and ESC exits. The segment count and length of each cable, and the overall total, are reported in drawing units. Cables are drawn as separate LINE objects on the E-CABLE layer in red by default.

Use CABLEROUTE-SET to change the offset, layer, color and reference search radius. The search radius (150 units by default) controls how far around your points the tool looks for walls, so adjust it and the offset to suit drawings in millimetres or at other scales.

How to use it

  1. Load cableroute.lsp with APPLOAD.
  2. If needed, run CABLEROUTE-SET to set the wall offset, cable layer, color and search radius.
  3. Zoom so the walls and your route are visible on screen, then run CABLEROUTE.
  4. Click the start point of the cable; endpoint, midpoint, intersection and nearest snaps are active for this first point.
  5. Click points where the cable turns, staying on the side of the wall the cable should run along.
  6. Right-click after the last point; the route is calculated, drawn and its length reported.
  7. Click the start of the next cable to continue, or press ESC to exit.

Notes and tips

  • Only LINE and LWPOLYLINE objects are used as references. Walls inside blocks, xrefs or old-style POLYLINEs are not detected; explode them or trace a copy with lines if needed.
  • The wall search works on what is visible on screen, so keep the working area in view while you route.
  • Routes are always horizontal and vertical; an angled wall is treated as horizontal or vertical depending on its dominant direction.
  • Arc segments in polylines are treated as straight segments.
  • All cables drawn in one run of the command form a single undo step, so U removes them together.
  • CABLEROUTE-SET values last for the current session and reset to the defaults when the drawing is reopened.

Frequently asked questions

The cable runs on the wrong side of the wall. How do I fix it?

The side is decided by where you click relative to the wall. Click your points on the side where the cable should run, close to the wall. If another line is closer than the wall, it may be taken as the reference instead.

How do I change the distance from the wall?

Run CABLEROUTE-SET and enter the new offset in drawing units. On a plan drawn in centimetres 6 means 6 cm; on a millimetre drawing use 60 for the same distance.

Why do some segments report 'no reference'?

No LINE or LWPOLYLINE was found within the search radius around those two points, so the previous segment's reference is reused. Increase the search radius with CABLEROUTE-SET, or check whether the walls are inside a block or an xref.

Can I get the total cable length in metres?

CABLEROUTE reports length in drawing units. For totals in metres grouped by layer and color, use the BOQ tool; for a quick check, select the cables with SUMLEN.