Ryan Casper of Indiana e-mailed a request to add blocks to a drawing. After the blocks are added, an equipment list located at the top right of the drawing will be updated automatically with vendor part number, quantity, vendor, and a description. The vendor part number, vendor, and description are attached to the blocks as attributes that are constant and invisible. The equipment list already has item numbers, and some of the item numbers have been filled in with existing equipment. The program will automatically calculate the quantity of each item. All equipment symbols (blocks) are to be stored in an external drawing.
The AutoLISP Solution is ADD-BLOCKS.LSP and ADD-BLOCKS.DCL. The routine does all of the above, and it is flexible enough to handle blocks being added in any order and for the drawing to be revisited later if you want to add new blocks or modify existing blocks.
Get the Code!
Download the ADD-BLOCKS.LSP and ADD-BLOCKS.DCL files from Cadalyst's Get the Code! area and save them in AutoCAD's Support directory. Use the Appload facility by selecting Tools/Load Application and then use the browser to select ADD-BLOCKS.LSP. Casper wants to have the program available on startup, so you also can add the LSP file to the Startup Suite so it will be loaded automatically when any drawing is opened.