Extracting and Exporting Attribute Information AutoCad Help

Once you have entered the attributes into your drawing, you can extract the information contained in the attributes and use that information in other programs. You may, for example, want to keep track of the door information in a database manager. This is especially useful if you have a project such as a large hotel that contains thousands of doors.

The first step in extracting attribute information is to create a template file using Windows Notepad, Do not use Windows WordPad because WordPad will introduce special codes to the file that can cause the extraction to fail. The template file used with attributes is an ASCII text file containing a list of the attributes you wish to extract and their characteristics. You can also extract information about the block an attribute is associated with. The block’s name, x-coordinate and y-coordinate, layer, orientation, and scale are all available for extraction .

Determining What to Extract

In the template file, for every attribute you want to extract, you must specify the attribute’s tag name followed by a code that determines whether the attribute value is numeric or text, and how many spaces to allow for the value. If it is a . numeric value, you must indicate how many decimal places to give the number. If you are familiar with database management programs, you’ll know that these are typical variables you determine when you set up a database.

For example, to get a list of rooms containing the Bdoor type, you would create a text file with the following contents:

The first item on each line (D-ROOM and D-TYPE in this example) is the tag of the attribute you want to list. This is followed by at least one space, and then by a code that describes the attribute. This code may look a little cryptic at first glance. The following list describes how the code is broken down from left to right:

• The first character of the code is always a C or an N to denote a character (C) or numeric (N) value.
• The next three digits are where you enter the number of spaces the value will take up. You can enter any number from 001 to 999, but you must enter zeros for null values. The D-ROOM example shows the value of 005 for five spaces. The two leading zeros are needed because AutoCAD expects to see three digits in this part of the code.
• The last three digits are for the number of decimal places to allow if the value is numeric. For character values, these must always be zeros. Once again, AutoCAD expects to see three digits in this part of the code, so even if there are no decimal digits for the value, you must include 000.

Now you will use the Windows Notepad application to create a template file. If you like, you can use any Windows word processor that is capable of saving files in the ASCII format.

1. In Windows 95 and Windows NT, locate and start up the Notepad application from the Accessories program group.

2. Enter the following text as it is shown. Press ↵ at the end of each line, including the last.

D-NUMBER C005000
D-THICK C007000
D-RATE C010000
D-MATRL C015000

3. When you have finished entering these lines of text, choose File >Save, and then enter Door.txt for the filename. For ease of access, you should save this file to your current default directory, or the \AutoCAD2000\ directory.

4. Close Notepad and return to AutoCAD.

You’ve just completed the setup for attribute extraction: Now that you have a template file, you can extract the attribute data.

Text Editor Line Endings

. It is very important that the last line of your file end with a single .J. AutoCAD will return an error message if you either leave the .J off or have an extra ↵ at the end of the file. Take care to end the line with a .J and don’t add an extra one. If the extraction doesn’t work, check to see if there isn’t an extra .J at the end of the file.

Posted on November 7, 2015 in Storing and Linking Data with Graphics

Share the Story

Back to Top
Share This