eplisp

AutoCAD Swap Objects LISP: Swap the Positions of Two Groups

Swaps the positions of two groups of objects using a reference point for each.

Commands: SWAPOBJ

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)

This AutoCAD swap objects LISP adds the SWAPOBJ command. You select two groups of objects and pick a reference point for each. The first group moves from its reference point to the second group's point, and the second group moves the other way.

Swapping two fixtures, two labels or two detail groups by hand takes two MOVE commands and usually a temporary spot to park one of them. SWAPOBJ does it in one command, and since it is a single undo step, one U puts everything back.

How to use it

  1. Load swapobj.lsp with APPLOAD and type SWAPOBJ.
  2. Select the first group and press Enter.
  3. Select the second group and press Enter.
  4. Pick the reference point of the first group, for example a block's insertion point.
  5. Pick the matching reference point of the second group; the two groups trade places.

Notes and tips

  • Snap the reference points to matching spots on both groups; otherwise the groups end up offset.
  • Objects are only moved, never rotated or scaled.
  • Don't include the same object in both groups; it gets moved twice and ends up where it started.

Frequently asked questions

How do I swap two objects in AutoCAD?

Run SWAPOBJ, select the two groups one after the other and pick a reference point for each. The groups trade places using those points.

Does it only work with blocks?

No. There is no object-type filter, so you can swap lines, text, blocks or any mix of them.