AutoCAD – Drawings

The ERASE command in AutoCAD: remove the right things, and get them back without losing your work

The erase command in AutoCAD is the first thing anyone learns, yet few use OOPS to restore objects without losing what they drew after, as U does. Five cases.

  • TS. Đỗ Quốc Hoàng
  • 8 min read
Which selection removes which lines, and the difference between OOPS and U when you want an erased object back Photo: Diagram by the Institute of Information Technology in Civil Engineering

Erasing is the first thing anyone learns in CAD. Yet two situations still catch experienced users out: a selection window that takes lines you meant to keep, and an accidental erase noticed only after drawing several new lines, when undoing feels too risky. The erase command in AutoCAD has an answer to both, and few people use it.

This article works through five examples, each with a concrete result. For the whole editing toolkit, the Institute runs an AutoCAD course for construction.

What ERASE does, and where to start it

Autodesk sums it up in one line: "Removes objects from a drawing."

Read straight from the 2027 configuration files, there are four ways in.

Entry pointWhat to use
Full commandERASE
AliasE, and also DELETE
RibbonHome → Modify → Erase
Classic menuEdit → Delete

The quickest route of all is to select objects first and press the Delete key.

The PICKFIRST variable

Selecting first and then giving the command works because of the PICKFIRST variable. In a new drawing it is 1, which allows selection before the command.

If one day you select objects, type E, and AutoCAD asks you to select again as though nothing were selected, check PICKFIRST. At 0 AutoCAD accepts only command-first, select-second. Set it back to 1 and the select-first habit works again.

The prompts, step by step

StepThe promptWhat you do
1Select objects:Select what to erase
2Select objects:Enter to erase

At the Select objects: prompt, three letters are worth knowing. According to Autodesk's ERASE page, you can type "L to erase the last object drawn, p to erase the previous selection set, or ALL to erase all objects".

TypeWhat gets erased
LThe last object drawn
PThe set selected by the previous command
ALLEverything in the drawing, including what is off screen

Be careful with ALL: it takes things you cannot see. There is almost never a reason to use it on a real drawing.

Example 1: erasing one object

Draw three parallel lines 1000 long, 200 apart, at y = 0, y = 200 and y = 400. Type E, pick the middle one, Enter.

Two lines remain; the middle one is gone. This is the basic method, fine when only a few objects need to go. You can keep picking before pressing Enter, and every object you pick is added to the set that will be erased together.

Where several objects overlap at the spot you want to click, hover first and watch which one highlights. Picking the one underneath by mistake is the most common slip when erasing one at a time.

Example 2: window and crossing selection

This is where people lose lines they meant to keep. Set up three lines as follows.

LineFromToRelation to the box
A100,0400,0Wholly inside
B300,300900,300Partly inside, partly outside
C1200,6001500,600Wholly outside

Use a selection box from 0,-100 to 600,400.

Window, dragged left to right. Type E, drag that box from the left corner to the right, Enter. Only line A is erased, because only A lies wholly inside. Line B merely touches the box and survives.

Crossing, dragged right to left. Set up the same lines again and drag the box from right to left. Both A and B go, because a crossing box also takes objects that merely touch it. Line C remains.

How you dragWhat remains
Left to rightB and C
Right to leftC only

This matters most on a crowded floor plan. Suppose you want to clear the furniture from one room. A crossing box dragged right to left over the room will also catch the walls, doors and dimension lines that cross its edge. A window dragged left to right, drawn just inside the walls, takes only the furniture that sits wholly within the room and leaves everything else alone.

To avoid ever getting this wrong, watch the fill colour of the box. Both box types and every other way of selecting are covered in our article on selecting objects in AutoCAD.

Example 3: OOPS versus U

This is the example most worth trying. The situation is familiar: you erase the wrong line, carry on drawing a few more without noticing, and now want the erased line back without losing the new ones.

Follow three steps, twice, restoring a different way each time.

StepRun 1Run 2
1Draw line A, then E to erase itDraw line A, then E to erase it
2Type L and draw a new line CType L and draw a new line C
3Type OOPSType U
ResultA comes back, C staysC disappears, A stays erased

Run 2 shows what U really does: it steps back exactly one operation, and the last operation was drawing line C. To get A back with U you would have to step back again, losing C.

Run 1 is the right way. The oops command in AutoCAD is described by Autodesk as follows: "OOPS restores objects erased by the last ERASE command." It remembers only the most recent erase, but it does not care what you have done since.

That is how to recover an erased object without sacrificing the work you have done since.

The same page mentions a second, less obvious use: "You can also use OOPS after BLOCK or WBLOCK because these commands have options that can erase the selected objects after creating a block." If you turned some geometry into a block, chose to delete the originals, and then realised you still needed them in place, this is the command that Autodesk points to for bringing the originals back. Stepping back and forward through many operations is covered in our article on UNDO in AutoCAD.

Example 4: erase the last object

Draw two lines, the first at y = 0 and the second at y = 300. Type E, then L, and press Enter twice.

The last one drawn, the line at y = 300, is erased. The other stays.

This is handy when you have just drawn a wrong line on top of several others and it is hard to pick. No picking needed: L finds the newest object for you, wherever it happens to be.

Example 5: "was on a locked layer"

Draw a line on a layer and lock that layer. Type E, pick the line, Enter.

The line stays, and the command line reports 1 was on a locked layer. Objects on locked layers are skipped, and AutoCAD tells you how many it skipped.

That is a feature, not a fault. Locking the title-block layer, the grid layer and reference layers is the surest way to stop a hasty selection window from taking them. To erase such an object, unlock the layer first. Locking and unlocking layers is covered in our article on layers in AutoCAD.

ERASE versus other clean-up commands

ERASE removes only what you select. Three other clean-up jobs sound similar but are different commands.

JobUse
Remove what you selectERASE
Remove duplicate, overlapping linesthe OVERKILL command
Remove a layer and everything on itdeleting layers

Autodesk notes one limit of OOPS: "You cannot use OOPS to restore objects on a layer that has been removed with the PURGE command." Once a layer has been purged, this route no longer works.

Three things often repeated that are not true

Often heardWhat the 2027 release actually does
Erased by mistake? Just press UU undoes the last operation; if you have drawn since, you lose that too
OOPS works only straight after erasingYou can draw more first and still OOPS; the new lines stay
Every selection box erases the same thingsLeft to right takes only what lies wholly inside; right to left also takes what touches

Frequently asked questions

What is the alias for the erase command in AutoCAD?

E. Or select objects first and press the Delete key.

I erased something by mistake and then drew more. How do I get it back?

Type OOPS. It restores the most recent erase without touching what you drew afterwards.

Why did my selection box erase lines I wanted to keep?

You dragged right to left. That crossing box also takes objects that only touch it. Drag left to right to take only what lies wholly inside.

What does "was on a locked layer" mean?

The object is on a locked layer, so it was not erased. Unlock the layer and erase again.

How do I erase something I have just drawn but cannot pick?

Type E, then L to select the last object drawn.

About the author

TS. Đỗ Quốc Hoàng — Vice Director of the Institute of Information Technology in Civil Engineering, Hanoi University of Civil Engineering, and a specialist in software development for construction