[Search tip detail and code files using keywords, tip number, author name, etc ]
    For tip to function correctly, you must ensure that the downloaded file name matches the file name
    displayed in the Rename File To field. Please rename downloaded files when necessary.
Insert Blocks from a Database
Tip# ALSP 1103 By Tony Hotchkiss On 01-Nov-2003
Rated By 1 users Downloaded : 1178
Categories : Standard Blocks
Software type : AutoCAD
insblk.lsp, insblk.dcl. Program refers to database listing to place blocks.

Sean Serin e-mailed from Switzerland to request a routine that inserts premade blocks into a drawing sheet using information that comes from a Microsoft Access database. The solution is INSBLK.LSP and its dialog-box counterpart, INSBLK.DCL. The program inserts blocks from any comma- or semicolon-delimited file, or from a fixed-width-field format file. You can export all of these file types from Microsoft Access. The fields are assumed to be in the order of the local block name, then the x, y, and z coordinates, and then any other information such as a description and a unique ID number. The routine uses only the first four fields from the database, although the delimiter, if any, should follow the fourth field. If a fifth field isn't included, a fixed-field-width format is suitable.

The blocks are assumed to exist in a single drawing but not displayed in the drawing. You can insert the drawing into the current drawing before the program executes or access it from the Insblk dialog box during execution. Figure 1 shows the dialog box with a choice for Symbols Location, where you can select the current drawing or an external drawing. The dialog box also shows the Import file format with field type choices of Delimited or Fixed Width. If you select Delimited, the delimiter can be Comma or Semicolon. When you select Fixed Width, you can enter a field width or use the default 10.

If the symbols reside in an external file, a Symbols Drawing File dialog box displays (figure 2). You can browse to locate the AutoCAD drawing that contains the blocks. If the symbols are already in the current drawing, the Symbols Drawing File dialog does not display. In either case, the Import File dialog box appears (figure 3), and you can specify a delimited or fixed-width database file.



Average Rating:

User comments