This procedure will walk through the process of using Microsoft Excel to create script files to be read into AutoCAD. Tabular information is often present in the spreadsheet that needs to be transferred to CAD.

The example explained here is a table of layer names with colors and linetypes. It could quickly be adapted to use point coordinates to create inserts. This example provides Excel specific explanations, but users of other spreadsheets should be able to adapt the instructions to their particular product. The following instructions will reference the next example.

A B C
1 PROPOSED RED DASHED
2 EXISTING GREEN CONTINUOUS
3 ANNOTATION 255 CONTINUOUS

The goal is to populate column D with concatenated values appropriate to pass to the AutoCAD command line.

  1. Make cell D1 current.
  2. Enter this expression in cell D1.
    =”N “&TRIM(A1)&” C “&TRIM(B1)&” “&TRIM(A1)&” LT “&TRIM(C1)&” “&TRIM(A1)
    It is very important that the spaces be included. Note that just as in the command line layer command, we must pass the layer name after each designation such as color to tell AutoCAD to assign that color only to the current layer. This explains the multiple references to A1.
  3. Copy that expression down to all the valid lines.
  4. Highlight the entire column D and copy it to the clipboard.
  5. Choose File/New to create a new empty sheet.
  6. Choose Edit/Paste Special, choose Values.
  7. Insert a blank row at the top of the file and enter this:
    ‘-LAYER
  8. Choose File/Save As, choose Save As Type, then choose Text (OS/2 or MS-DOS)(*.TXT).
  9. Enter the script filename such as D:\PATH\FILENAME.SCR.
  10. When prompted that the selected format does not support multiple sheets, choose Ok.
  11. Excel has the file locked down in the operating system, and AutoCAD can’t even run it, so we must close it first. Choose File/Close, choose No to the next dialog. This was just a temporary workbook anyway.
  12. Back in AutoCAD, make any preliminary settings as necessary, such as loading linetypes.
  13. Issue the SCRIPT command, choose your script. When its done you will may have to press enter once.
  14. Check the layer table. It should be populated with the information from Excel.

Comments are closed.

Post Navigation