Converting External Reference Path Types with Action Macro's

In my last blog post I wrote about the new External Reference tools you (probably) didn't know about in AutoCAD 2014. As someone who uses external references nearly everyday, it goes without saying these new features are among my favorites in this release. More specifically, the ability to convert full path references to relative path references has proven invaluable.

Automating External Reference Path Type Conversion

Although the External References Manager does a great job at allowing you to convert the path type of individual references, what if you have multiple references you would like to convert at once? The easiest way to accomplish this is with the new PATHTYPE function within the -XREF command. I briefly suggested using this function for the purposes of scripting, but the good news is you can take advantage of this function even if you're not familiar with scripting AutoCAD.

Introduced back in AutoCAD 2009, another frequently forgotten feature of AutoCAD is the Action Recorder. The beauty of the Action Recorder is that you can start automating certain functions within AutoCAD even if you know nothing about scripting or programing. I find the Action Recorder especially useful for automating simple routines like converting full path references into relative path references.

Creating an Action Recording

Automating such a procedure is easier than you might think:

  1. Navigate to the Manage Ribbon tab, and click the Record button within the Action Recorder panel.
    Doing this will start a new Action Recording meaning anything you do in AutoCAD will be recorded for playback later.

    Creating a new Action Recording
    Creating a new Action Recording
  2. Type -XREF and press Enter to start the command-line version of the external references command.
  3. Choose the pathType function

    Choosing the PATHTYPE function at the command ine
    Choosing the PATHTYPE function at the command ine
  4. Enter * the designate all external references at the Enter xref name(s) to edit path type: prompt.
  5. Choose the Relative function at the Enter new path type [Full/Relative/None]: prompt.
  6. Click the Stop button within the Action Recorder panel on the Manage Ribbon tab.
  7. Stopping an Action Recording will open the Action Macro dialog. From this dialog you can specify how this recording will perform the next time you play it back. In this example I'll name my Action Macro C2RPATH, and uncheck Check for inconsistencies when playback begins.
  8. Click OK to save your Action Macro.

Applying Action Macro's

Action Macro Configuration
Action Macro Configuration

After creating an Action Macro you have a couple options for actually using it. Perhaps the most obvious method is to click the Play button on the Action Recorder panel of the Manage Ribbon tab. While this method works, it does require you to switch to the Manage Ribbon tab.

A lesser known method for playing back Action Macros is to enter its name at the command line. I named my Action Macro C2RPATH in the example above. Since Action Recordings also function as AutoCAD commands, that means I can also play my external reference macro by entering C2RPATH at the command line.

Automate Sheet Setup with Action Macros

Although there's no shortage of ways to customize AutoCAD, nearly every one requires some familiarity with programming. Given the barriers of learning a programming language, I find so many of the AutoCAD users I come across simply survive with the tools they already have verses learning to create new ones. This is the fundamental reason I love Action Macro's so much; they allow users, with or without programming experience, to create new AutoCAD tools in an instant.

The beauty of Action Macros is the way that anyone who can use the command line inside AutoCAD can also customize AutoCAD. Given how simple they are to create, I have found a wide range of ways to create and apply Action Macros over the years. One of my longtime favorites is using them to automate the setup and creation of new drawing sheets.

The best way to ensure all of the sheets for a project plot the same is to create every sheet from a common layout template with the same page setup applied. While the procedure for doing this isn't especially hard, it does involve several steps, and frequently becomes cluttered among the library of different sheet sizes used by most companies (Letter, Ledger, Arch D, etc). Using Action Macros I can dramatically simplify this process by creating a series of custom commands that will automatically create a new layout tab at the desired size.

autocad zoom macro

Easy Zoom Shortcut Macros with the AutoCAD Action Recorder

I can't speak for the other vertical products out there, but both Land Desktop and Civil 3D have a handy assortment of Zoom Macros. These Zoom macros include things like ZE for Zoom Extents, ZP for Zoom Previous, and so on. Although both LDT and Civil 3D are built atop the beloved AutoCAD platform, these Zoom Macros cannot be found inside regular AutoCAD. That is until you learn how easy you can build them yourself using the Action Recorder in AutoCAD 2009 and AutoCAD 2010.