# PURGE in AutoCAD

> How AutoCAD's PURGE (PU) deletes blocks no reference uses, by name or all at once, verifying each or not, nested ones included. Try it free in your browser.

PURGE removes what a drawing defines but does not use; here that is blocks. AutoCAD's PURGE opens the Purge dialog; MellowCAD has none, so PURGE asks at the command line what `-PURGE` asks, as AutoCAD's console does. It says the Nested items and Orphaned data settings, both off, and asks which type of unused objects to purge, offering only `Blocks`; Enter there ends it.

A block is in use while a reference in the drawing places it, or the definition of a block in use holds it, however deep. Erasing a block's last reference leaves its definition in the drawing, where [`INSERT`](https://mellowcad.com/docs/commands/insert.md) can place it again: PURGE is what deletes it. A block a kept block holds is never taken, and a chain of blocks that only hold one another goes in one run. With none to take, it says `No unreferenced blocks found.`. Each run is one step that `U` takes back.

- **Command:** `PURGE`
- **Aliases:** `PU`
- **Panel:** [Organize](https://mellowcad.com/docs/commands.md#organize)
- **Try it:** [Open the editor](/draw), type `PU` and press Enter.

## At the command line

The engine draws it and writes its history as you would type it: the prompts in AutoCAD 2027's order, with the same option letters.

Two blocks, TAG placed on a wall and BOX whose one reference was erased: PURGE, all names, not verified, deletes BOX alone.

```text
Command: PURGE
Nested items = Off    Orphaned data = Off
Enter type of unused objects to purge [Blocks]: B
Enter name(s) to purge <*>:
Verify each name to be purged? [Yes/No] <Y>: N
Deleting block "BOX".
1 block deleted.
```

## Options

### `Blocks` (`B`)

Asks the names to purge, `*` for every unused block by default, or names with wildcards, separated by commas. Then asks whether to verify each name: `Yes`, the default, asks about each block before deleting it, `No` deletes them all and says each name and how many.

## What it does not do yet

The Purge dialog, and every other type: layers, linetypes, text and dimension styles, groups, materials, multileader, table and visual styles, registered applications, zero-length geometry, empty text objects, orphaned data, and All. The Nested items and Orphaned data settings cannot be changed.

[What it does and still lacks, in detail (in English)](https://github.com/ovelilla/mellowcad/blob/main/docs/coverage/modify.md#purge--pu--purge---pu--es-limpia--li--limpia---li--pt-br-eliminar--elm--eliminar---elm)

## Questions

### What is the shortcut for PURGE in AutoCAD?

`PU`, then Enter or Space. `-PU` is `-PURGE`, the command-line form, which PURGE runs here too. `_PURGE` works in any language of AutoCAD.

### How do I purge unused blocks in AutoCAD?

Type `PU`, choose `Blocks`, press Enter for every name and answer `No` to delete them all without asking about each.

### Why can't I purge a block?

Because it is in use: a reference in the drawing places it, or a block in use holds it, maybe nested several levels deep. Erase its references, or explode the blocks that hold it, and PURGE can take it.

### How do I purge layers?

In AutoCAD, with PURGE's Layers type. Not yet here, where PURGE purges blocks alone; delete an empty layer in the Layer Properties Manager instead.

## Related commands

- [BLOCK in AutoCAD](https://mellowcad.com/docs/commands/block.md)
- [INSERT in AutoCAD](https://mellowcad.com/docs/commands/insert.md)
- [ERASE in AutoCAD](https://mellowcad.com/docs/commands/erase.md)
- [BLOCKSPALETTE](https://mellowcad.com/docs/commands.md#blockspalette): Show the blocks palette
