Updating AutoCAD Block Attributes using Microsoft Excel Excel Attribute

Updating AutoCAD Block Attributes using Microsoft Excel

Block Attributes are an integral component of nearly every AutoCAD-based project I've worked on. Beyond the ubiquitous title block, Block Attributes are commonly used for Room Tags, to display calculations, and more. Whilst it isn't too difficult to update a couple of Block Attributes, when the blocks to update ventures beyond that - the task quickly becomes as tedious as it is time-consuming.

I've long wished AutoCAD had a command that would let you link a block to something like an Excel spreadsheet. Although that wish has never been granted, the next best thing exists in the form of AutoCAD's Express Tools. Two of my favorite Express Tool commands are ATTIN and ATTOUT. Put simply, the commands will export Block Attribute values to a Tab-Delimited text file (ATTOUT), and update Block Attribute values from a Tab-Delimited text file (ATTIN). In the video above I demonstrate how to use these commands in tandem with Microsoft Excel to quickly renumber the room tags in a floor plan.

Tips for Updating Attributes with Excel

Whislt the blocks can be anything you wish, there are a few tricks to using this method in production:

  1. Blocks are updated based on their Handle ID: Every object (including blocks) are assigned a unique Handle ID. No two objects in an AutoCAD drawing will have the same Handle ID, and the ID itself is designed to function as a unique identifier in the DWG database. This means you can move a block anywhere you wish in the drawing (even a different Layout tab), but you cannot erase the block. Erasing the block will change the Handle ID for the object, and thus break this method.
  2. You may combine multiple TXT files: The ATTOUT command will generate a separate TXT file each time you run the command. Especially if you're updating the same block (not to be confused with block insertion), you can combine multiple TXT files into a single TXT file if you wish. Using the example in the video, you may export the Room Tag block attribute values for each floor in your design - thus resulting in a TXT file for each floor. You can combine these TXT files into a single TXT file to simplify things a bit.
  3. Save as Tab Delimited Text File in Microsoft Excel: I will typically create an Excel spreadsheet that performs various calculations. When exporting your data from Excel, be sure to select tab delimited as the file type.
Identify Drawing Changes with AutoCAD Compare Result

Identify Drawing Changes with AutoCAD

Despite our best efforts to avoid it, at some point in a project you'll likely end up with two drawing files that are supposed to be the same, but aren't. After running into this issue several times over the years, I learned about the incredible "Compare" feature within the Autodesk Design Review application. Although this has proven to be a great solution over the years, as I mention in my blog post from several years back, using Design Review requires you make DWF's of your DWG's. This isn't exactly a paralyzing step, but I've always wished AutoCAD had this feature built-in so I didn't have to convert from DWG to DWF. AutoCAD Architecture users have enjoyed this functionality for years now, but this feature has been curiously absent from the base (aka vanilla) version of AutoCAD and it's related verticals such as AutoCAD Civil 3D.

Introduced with AutoCAD 2012, Autodesk launched the App Store they call the Autodesk Exchange. There both Autodesk and third-party developers contribute to an ever-growing library of tools. With many of these tools being free of charge, I've come to refer to the Autodesk Exchange as the Express Tools of the 21st century. Among the incredible tools on the Autodesk Exchange is a free DWG Compare utility from Autodesk. The utility is nearly identical to the DWG compare feature in AutoCAD Architecture, but is now compatible with a range of AutoCAD versions including the base (vanilla) and Civil 3D releases.

To download apps from the Autodesk Exchange:

  1. Click the X icon on the InfoCenter toolbar to open the Autodesk Exchange for AutoCAD.

    Opening the Autodesk Exchange for AutoCAD from the InfoCenter Toolbar
    Opening the Autodesk Exchange for AutoCAD from the InfoCenter Toolbar
  2. You can browse to or search for the app you want. In this case the app we're looking for is named DWG Compare.

    Searching for an application from the Autodesk Exchange home page.
    Searching for an application from the Autodesk Exchange home page.
  3. After you locate the app you're interested in, click the buy (or Free in this example) button. This will guide you through a standardized installation process that will also add the utility to your version of AutoCAD.

    Autodesk Exchange Application Page
    Autodesk Exchange Application Page
  4. Once installed, you can use the utility by clicking it's button on the Plug-ins Ribbon tab in AutoCAD.

    Plug-ins Ribbon Tab with DWG Compare utility installed
    Plug-ins Ribbon Tab with DWG Compare utility installed

To use the free DWG Compare utility from Autodesk:

  1. Click the DWG Compare button from the Plug-ins Ribbon tab to open the Drawing Compare palette.

    Drawing Compare Palette with drawings selected.
    Drawing Compare Palette with drawings selected.
  2. Select the base or original version of your drawing file.
  3. Select the newer version of your drawing file.
  4. Click the green checkmark on the right side of the Select Drawing banner on the Drawing Compare palette.

From there the DWG Compare utility will take a moment to do its magic. Once complete unchanged drawing elements will change to a light gray color, whereas modified elements will be colored. Here's a sample of the output you can expect.

Result of the Drawing Compare
Result of the Drawing Compare

In this example the offices were stretched out a bit, and the drawing compare feature has highlighted deleted lines in red and added lines in green. In addition to these visual queues, it is also possible to select objects in the Drawing Compare palette and see the original and modified location as shown below.

Using the Drawing Compare Palette to analyze block modifications.
Using the Drawing Compare Palette to analyze block modifications.

While certainly one of my favorites, there's a whole range of applications available to you from the Autodesk Exchange for AutoCAD. If you haven't checked it out, go have a look, and let me know in the comments what favorite apps you find.

 

Custom Linetypes the Super Simple Way

Creating LinetypesLinetypes play an integral role in visually separating certain elements of our designs. Most of the time one of the 40+ linetypes that come with AutoCAD will suffice, but what do you do when you need a custom linetype? While its true linetypes must be developed, the good news is that it’s not as difficult as it sounds.

In their most basic form, an AutoCAD linetype is really nothing more than a .txt file with a .lin extension. It’s completely possible to create linetypes using nothing more than your bare hands and Notepad (the digital variety that comes with MS Windows). For those who prefer a more graphical approach, check out the Make Linetype (MKLTYPE) tool found on the Express Tools Ribbon tab > expanded Tools panel. If you know how to draw and trim lines in AutoCAD you can also create custom linetypes.

Becoming a Keyboard Warrior – The Command Alias Editor

image As much as I love the enhancements to the ribbon inside AutoCAD 2010, I have a slight confession to make. I hardly click buttons, navigate menus, or even browse the ribbon to launch many of my most used commands. Instead I revert to a simpler time before such user interface enhancements - the keyboard. Call it archaic, but with minimal effort, you too can become an AutoCAD keyboard warrior! How you ask? To find the answer you need to look no further than the beloved Express Tools.

Looking to the old Express menu, the lesser known Command Alias Editor is tucked away under Express > Tools > Command Alias Editor. Users of AutoCAD 2010 do not have to look far at all as the Command Alias Editor is the biggest button on the Tools ribbon panel on the Express Tools ribbon tab. As you may have guessed, the Command Alias Editor is the secret to configuring your keyboard like an AutoCAD pro!

Sequentially Number AutoCAD Text with TCOUNT

image Among the comments recently left on The CAD Geek was one asking if I could help them out with a script to sequentially number text.  The solution is perhaps easier than one may think. In fact, chances are, you already have such a tool at your fingertips.  Housed within the infamous Express Tools is a command known as “Automatic Text Numbering”, or for the command line warriors – TCOUNT.

The TCOUNT command has a bunch of hidden secrets contained within it.  Sure, it knows how to count 1, 2, 3, 4, 5, …, but what about 2, 4, 6, 8? Those writing cheers with AutoCAD will appreciate the fact the TCOUNT command can indeed do this.

Beyond that what other tricks does the TCOUNT command have up its sleeve? Well it also has the ability to prefix or suffix your text with a number, or of course replace it altogether. So enough talk, how does one use this hidden gem?