Update Titleblock Attributes

Function Syntax utb (to run manually)
Current Version 1.9
Download UpdateTitleblockV1-9.lsp
View HTML Version UpdateTitleblockV1-9.html
Sample Drawing & CSV File Sample.zip

Program Description

This program offers the ability to automatically update drawing titleblock attributes (or indeed, any attributed blocks) with values sourced from a CSV file (a comma/character-separated-value file which may be opened & edited as an Excel spreadsheet).

The program is designed to run automatically when loaded and, after being correctly configured, may be added to the Startup Suite or acaddoc.lsp to enable drawing titleblocks or other attributed blocks to be automatically updated upon opening a drawing or running a script.

If loaded on startup, when a drawing is opened, a CSV file may be selected or automatically read by the program from a known location, and block attributes are automatically & silently updated using values corresponding to the rows associated with the active drawing in the CSV file.

The CSV file should take the following format:

|    DWG     |  Layout*  |  Block*  |   TAG1   |   TAG2   | ... |   TAGN   |
|  Drawing1  |  Layout1  |  Block1  |  Value1  |  Value2  | ... |  ValueN  |
|  Drawing1  |  Layout2  |  Block1  |  Value1  |  Value2  | ... |  ValueN  |
|  Drawing2  |  Layout1  |  Block2  |  Value1  |  Value2  | ... |  ValueN  |
|    ...     |    ...    |   ...    |    ...   |    ...   | ... |    ...   |

(*The Layout & Block Name columns are optional)

An example of a CSV file demonstrating the above format and an accompanying drawing containing a sample attributed block for use with the program is available to download from the link at the top of this page.

When the program is run: if the drawing name (with or without extension) appears in the first column of the CSV file (not case-sensitive), attributes with tags corresponding to the column headings will be updated with values from the row in which the drawing filename resides.

The Layout column is optional; if present in the CSV file, the flag at the top of the code must be set, else the Layout column will be treated as another attribute tag. If the Layout column is used, titleblock attributes will be updated for each layout in a row associated with the drawing filename.

Similarly, the Block column is also optional; if the Block column is used and the flag located near the top of the program code has been set appropriately, the program will only update attributed blocks whose block name resides in this column.

A block filter is also included in the settings at the top of the code so that the user may opt to update specific blocks within drawings. This block filter may use wildcards, i.e. "*BORDER". If set to nil or set to "*", all blocks with attribute tags equal to the column headings in the CSV Drawing Register will be updated with the corresponding values.




  • The program is currently set to run when loaded so that titleblocks may be automatically updated when a drawing is opened. To disable this autorun feature, remove or comment the line of code annotated at the end of the program source code.
  • If the block filter at the top of the code is left as nil or set to "*", all attributed blocks containing attribute tags equal to the column headings in the CSV file will be updated with the corresponding values.
  • The filename of the CSV file may be hard-coded into the settings at the top of the code, so that the file may be automatically read without a file selection prompt. If nil, the program will prompt the user to select a CSV file to read.
  • If the CSV file contains a Layout column (optional 2nd column), the 'Layout Column' parameter must be set to t.
  • If the CSV file contains a Block Name column (optional 3rd column, or 2nd column if no Layout column is present), the 'Block Name Column' parameter must be set to t.
  • The column headings of the Drawing, Layout, and Block columns are arbitrary and will not affect the program in any way.
  • All column headings are not case-sensitive.
  • Drawing filenames (1st column), Layout names (optional 2nd column), & Block names (optional 3rd column, or 2nd column if no Layout column is present) are not case-sensitive.
  • Please read the code header for more information.

Instructions for Running

This program is designed to run when loaded. The program may also be called from the AutoCAD command-line at any time using the syntax as noted above.

Refer to How to Run an AutoLISP Program for instructions on how to load this program.


increase · reset · decrease

Designed & Created by Lee Mac © 2010