Rich Smith e-mailed me a request asking how to add blocks to an AutoCAD drawing using a transformation matrix to place the blocks in the correct position and orientation. In his scenario, a series of block names and values of a 4x4 transformation matrix are to be input from a comma-delimited (CSV) file.
The AutoLISP Solution is INSBLOCK4.LSP. The routine requests the location of the CSV file and reads the name of the drawing (block) to be inserted and 16 values representing the 4x4 transformation matrix for any number of blocks. The blocks are then inserted and transformed to their final x, y, and z locations and orientations in the current drawing.
Get the Code
Download the INSBLOCK4.LSP file from Cadalyst's Get the Code! site and save it in AutoCAD's Support directory. Use the Appload facility by selecting Tools / Load Application and then use the browser to select INSBLOCK4.LSP.