# BLOCK in AutoCAD

> How AutoCAD's BLOCK (B) makes a block, prompt by prompt: a name, a base point and the objects; redefining one, attributes. Try it free in your browser.

BLOCK stores a set of objects in the drawing under a name, so that [`INSERT`](https://mellowcad.com/docs/commands/insert.md) can place it again as often as you like, each copy a reference to that one definition. It asks for a name, then the insertion base point — the point every reference is placed by — then the objects. Enter ends the selection and defines the block, and the objects you picked become a reference to it, where they were. The whole command is one step that Undo takes back.

AutoCAD's BLOCK opens the Block Definition dialog, which MellowCAD does not have: here BLOCK asks at the command line what `-BLOCK` asks, as AutoCAD's console does. A name may hold spaces and up to 255 characters, but none of `< > / \ " : ; ? * | , =` nor a backquote: Enter alone or such a name says `Invalid block name.` and asks again. A name the drawing already has, in any case, asks whether to redefine that block, `Yes` or `No` (the default, which ends the command).

- **Command:** `BLOCK`
- **Aliases:** `B`, `ACADBLOCKDIALOG`, `BMAKE`, `BMOD`
- **Panel:** [Organize](https://mellowcad.com/docs/commands.md#organize)
- **Try it:** [Open the editor](/draw), type `B` 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.

A chair, a rectangle and a line, made the block B1: its name, a base point at the middle of its front edge, both objects picked.

```text
Command: BLOCK
Current settings: Object conversion=Convert
Enter block name or [?]: B1
Specify insertion base point: 20,40
Select objects: 1 found
Select objects: 1 found, 2 total
Select objects:
```

## Options

### `?`

Lists the blocks in the drawing: it asks which to list, `*` for all by default or a name with wildcards, writes the names that match and a count of each kind, then ends. Anonymous blocks, such as an array's, are counted, never named.

## What it does not do yet

AutoCAD's Block Definition dialog: BLOCK asks at the command line. At the base point, the Annotative and Mode options (Retain, Delete): the objects are always converted to a reference. ATTREQ 0, which skips the attribute values' box, and ATTSYNC, ATTREDEF, BATTMAN and BATTORDER: a redefined block leaves its references' attributes as they were, as AutoCAD does. ByBlock: an object inside a block cannot take the reference's own colour, linetype or lineweight, as one drawn ByBlock does in AutoCAD. In a turned UCS, AutoCAD 2027 moves the objects it converts; here they stay where they were, on purpose.

[What it does and still lacks, in detail (in English)](https://github.com/ovelilla/mellowcad/blob/main/docs/coverage/draw.md#block--b--bmake--bmod--acadblockdialog--block---b--es-bloque--bq--modblq--bmake--bmod--acadblockdialog--bloque---bq--pt-br-bloco--cb--acadblockdialog--criarb--defb--bloco---cb)

## Questions

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

`B`, then Enter or Space. In AutoCAD it opens the Block Definition dialog; here it asks at the command line, as `-B` (`-BLOCK`) does. `_BLOCK` works in any language of AutoCAD.

### How do I create a block in AutoCAD?

Type `B`, a name, then pick the base point — a corner, or the middle of the edge the block will sit on — and select the objects. Enter defines the block and turns the objects into a reference to it. A selection made before the command is taken too, after the base point.

### How do I redefine a block?

Run BLOCK with the block's name and answer `Yes`, then give a base point and select the new objects: every reference to the block shows the new definition. The objects cannot include a reference to the block itself; such a set is refused and the command ends.

### How do I make a block with attributes?

Define the attributes first with `ATTDEF`, then select them with the other objects: they join the block in the order you pick them. The reference that replaces them opens a box with a field for each attribute, labelled by its prompt and filled with its default: Enter applies the values, Escape keeps the defaults.

### How do I explode a block?

`EXPLODE` turns a reference back into the objects it shows, one level of nesting at a time, each on its own layer and in its own colour. Attributes come back as their definitions; the values are dropped.

## Related commands

- [INSERT in AutoCAD](https://mellowcad.com/docs/commands/insert.md)
- [ATTDEF](https://mellowcad.com/docs/commands.md#attdef): Define attributes
- [EXPLODE](https://mellowcad.com/docs/commands.md#explode): Explode
- [PURGE](https://mellowcad.com/docs/commands.md#purge): Purge
