.. index:: single: Blocks single: Block Definitions single: Attributes Blocks and Attributes ===================== A **block** is a named group of entities stored once in the drawing and placed any number of times as a **block reference** (an ``INSERT``). Moving or editing the definition updates every reference at once, which makes blocks the right tool for repeated symbols — manholes, trees, north arrows, title blocks, standard details. Blocks live in the drawing they are defined in. They survive a save to ``.iqz``, ``.dxf`` and ``.dwg``, and can be imported from another drawing through the Block Manager. .. index:: single: Creating a Block single: BLOCK command Creating a Block ---------------- 1. Draw or select the entities that make up the symbol. 2. Type ``BLOCK`` (alias ``B``) and press **Enter** to confirm the selection. 3. Click the **base point** — the handle the block is inserted by, and the point the reference is rotated and scaled about. 4. Type a name and press **Enter**. The selected entities are copied into the definition (with their coordinates made relative to the base point), removed from model space, and replaced by a single block reference at the base point. Nothing is lost: exploding the reference brings the geometry back. .. note:: Block names are unique per drawing and the check is case-insensitive. If the name is already taken, the command reports it and asks again rather than overwriting the existing definition. .. index:: single: Inserting a Block single: INSERT command Inserting a Block ----------------- - ``INSERT `` (alias ``INS``) starts a rubber-band insert of that block; click to place it. - ``INSERT`` with no argument lists the defined blocks and asks for a name. - ``BLOCKS`` (alias ``BL``) prints the block table — name and entity count — without inserting anything. - **Draw › Block Insert** on the menu does the same as ``INSERT``. A placed reference carries its own scale, rotation and array settings, all editable in the Object Inspector: .. list-table:: :header-rows: 1 :widths: 28 72 * - Property - Meaning * - **Block name** - The definition this reference points at. * - **Scale X / Y / Z** - Independent axis scales. Negative values mirror the reference. * - **Rotation** - Degrees counter-clockwise about the insertion point. * - **Columns / Rows** - Rectangular array count. A reference with more than one cell is the equivalent of AutoCAD's ``MINSERT``; it draws the whole grid but stays one object. * - **Column / Row spacing** - Centre-to-centre distance between array cells, in drawing units. .. index:: single: Block Editor single: BEDIT command single: BCLOSE command Editing a Block Definition -------------------------- ``BEDIT `` (alias ``BE``) opens the **block editor**: the drawing area switches to the block's own contents, drawn about its base point at the origin. Draw, modify and erase there exactly as in model space. ``BEDIT`` with no argument prompts for a name; typing ``?`` at that prompt lists every definition with its entity count. ``BCLOSE`` (alias ``BC``) saves the edited definition and returns to the drawing. **Every reference to that block redraws with the new contents.** .. index:: single: Block Manager single: BLOCKMANAGER command Block Manager ------------- ``BLOCKMANAGER`` (alias ``BM``) opens a dialog listing every definition in the drawing as a rendered thumbnail, with the selected block's details on the right: name, origin (base point), entity count, and the number of references placed. .. list-table:: :header-rows: 1 :widths: 24 76 * - Button - Action * - **Insert** - Closes the dialog and starts an insert of the selected block. * - **New** - Starts a ``BLOCK`` definition from the current selection. * - **Edit** - Opens the selected block in the block editor (as ``BEDIT``). * - **Rename** - Renames the definition; existing references follow the new name. * - **Delete** - Removes the definition. A block that still has references cannot be deleted — erase or explode them first. * - **Purge Unused** - Deletes every definition with no references left in the drawing. The same clean-up the ``PURGE`` drawing utility performs. * - **Import** - Reads block definitions out of another ``.dxf`` or ``.iqz`` file and adds them to this drawing. This is how a shared symbol library is moved between drawings. .. index:: single: Exploding a Block single: EXPLODE command Exploding a Block ----------------- ``EXPLODE`` replaces a selected block reference with independent copies of the definition's entities, transformed by the reference's own scale and rotation. An arrayed reference explodes to every cell. The definition itself is untouched, so other references are unaffected. .. index:: single: Attributes single: ATTRIB single: ATTDEF Attributes ---------- **Attributes** are text fields carried by a block reference — a manhole number, a pipe diameter, the fields of a title block — so that two references of the same definition can show different text. IQcad reads and preserves attributes on import: - An **ATTDEF** in a block definition (the template that names the field) is staged as text carrying its attribute **tag**. A tag is a label, not drawable content, so ATTDEFs are not drawn when the block is inserted. - An **ATTRIB** on a block reference (the filled-in value) is attached to that reference and drawn with it. Attribute values move, rotate and scale with the reference, and are included in its bounding box and in the result of ``EXPLODE``. - Attributes marked invisible are stored but not drawn. Attribute text round-trips through DXF and DWG in both directions. IQcad has no attribute-definition command of its own: a block with attributes is authored in AutoCAD (or a compatible program) and then used here. .. index:: single: Blocks and Layers Blocks, Layers and Colours -------------------------- Entities inside a definition keep the layer, colour and linetype they were drawn with. Entities drawn on layer ``0`` with colour and linetype set to **ByLayer** or **ByBlock** instead inherit from the reference — which is the standard way to build a symbol that takes on the layer it is inserted on. See :doc:`07_layers` for the inheritance rules. .. index:: single: Blocks in export formats Blocks in the File Formats -------------------------- .. list-table:: :header-rows: 1 :widths: 20 80 * - Format - Behaviour * - **IQML** (``.iqz``) - Definitions and references are written in full, with attributes. * - **DXF** - Written to the ``BLOCKS`` section as ``BLOCK`` / ``ENDBLK`` with ``INSERT`` references; read back the same way. * - **DWG** - Read and written natively, including ``MINSERT`` arrays, ``ATTRIB`` and ``ATTDEF``. See :doc:`14_dwg`. * - **PDF / SVG / image** - Flattened to their drawn geometry. The **Drawing Utilities › Purge…** command (**File › Drawing Utilities**) removes unreferenced definitions from the drawing, along with unused layers and styles, before a save.