Using Spreadsheets to Generate Script Files

August 8, 2018 Matt Miyamoto

Creating a script file can be an easy way to automate tasks in AutoCAD based applications.  Scripts can be as simple as a couple of lines to change a variable, or complex to the point of generating an entire template’s worth of background settings.  Anything you can manually enter via the keyboard can be pre-programmed into a script, saving you time and energy when going through repetitive tasks.

For simple script files, a basic notepad type application will do, but for longer scripts, or scripts with repetitive commands, Excel® and other spreadsheet applications can be a big advantage.

Leveraging AutoFill, formulas and built-in sequencing can be a huge time saver.  Here are some tips for creating scripts using a spreadsheet.

  1. Each Cell represents a keyboard-based command or option
  2. Each Row represents individual commands, and sequential cells are options in that command
  3. Add a ‘ symbol at the beginning of cells that include other symbols
  4. Use Base commands that being with a “-“ symbol to trigger keyboard entry
  5. Leave the first cell blank cell to repeat a command in consecutive rows
  6. AutoFill or copy and paste to quickly repeat command options
  7. Test the command string manually in AutoCAD and repeat keyboard entry in cells of each row
  8. Copy and paste numerical data or use formulas to fill in X, Y, Z and other values.
  9. SaveAs a Text(Tab Delimited) .TXT file and change the extension to .SCR to create the script

Here’s a quick example of a script file that creates multiple layers and sets their color automatically. The Base command -Layer is being used to create a New layer with a user defined name, and a Color is also being set for that layer in process.  A symbol was used ahead of -Layer to avoid any automated formula errors in Excel®.

1

AutoFill was used for the second and fourth rows, and Copy/Paste was used for the third and fifth rows.  The more rows or columns you use, the more you can leverage use of a spreadsheet.

Exporting to a Tab Delimited text file produces this:

2

And changing the .TXT to a Script (.SCR) file and dropping into AutoCAD produces this:

3

Although this was a basic script file example, this workflow can be expanded to work with any type of repetitive keyboard entry.  An added bonus is that the spreadsheet can be edited quickly and easily and re-exported to update the script file.

Next time you run into some repetitive tasks in AutoCAD, consider using a spreadsheet to quickly generate a script file.

About the Author

Matt Miyamoto

Project Manager - Civil Solutions<br><br>With over 15 years of experience in the civil engineering industry, Matt provides training, consulting, technical support, and implementation strategies for organizations transitioning to Civil 3D. Matt is a licensed civil engineer, an Autodesk Certified Instructor (ACI) as well as an Autodesk Certified BIM Specialist: Roads and Highway Solutions. Additionally, Matt is an Autodesk Certified Professional for AutoCAD and AutoCAD Civil 3D.

Follow on Linkedin More Content by Matt Miyamoto
Previous Article
InfraWorks Model Builder & BIM 360
InfraWorks Model Builder & BIM 360

One of the more recent updates added a link to BIM 360 to InfraWorks to generate and store cloud-based models.

Next Article
InfraWorks Keyboard Navigation Quick Tips
InfraWorks Keyboard Navigation Quick Tips

Matt Miyamotto | Team Manager Here at Ideate + IMAGINiT, we are constantly testing and reviewing the tools ...

×

Sign up for email updates

First Name
Last Name
Country
Thank you!
Error - something went wrong!