BrianMorse.com
Home Page Journal Page Services Page Tips Page eStore About Page

 

Creating an ASCII Point File from the Insertion of any Block with Attributes

 

Summary

AutoCAD Commands.
ATTEXT – Attribute Extraction command. (see AutoCAD help file and search for extracting attribute information)
EATTEXT – Enhanced Attribute Extraction command (comparison with ATTEXT and discussion on some limitations)

This document discusses the use of ATTEXT command in AutoCAD to export data from Block Inserts in a .DWG file.  The focus is on how to develop a template file for use with the ATTEXT command. The desired output is a comma delimited ASCII text file. The desired data to extract from the block and it's attributes are Point Number,Northing,Easting,Elevation,Description (PNEZD). This file format also known as a "point file" is used for importing points to the point database in Land Desktop. It is a standard format supported by all the major Civil/Survey software packages

 

The Template File Format

(some information is taken from the AutoCAD Help file)

The template file used to control output from the ATTEXT command uses a combination of these 15 possible fields to extract block properties...

BL:LEVEL          Nwww000   (Block nesting level)
BL:NAME           Cwww000   (Block name)
BL:X              Nwwwddd   (X coordinate of block insertion point)
BL:Y              Nwwwddd   (Y coordinate)
BL:Z              Nwwwddd   (Z coordinate)
BL:NUMBER         Nwww000   (Block counter; same for MINSERT)
BL:HANDLE         Cwww000   (Block handle; same for MINSERT)
BL:LAYER          Cwww000   (Block insertion layer name)
BL:ORIENT         Nwwwddd   (Block rotation angle)
BL:XSCALE         Nwwwddd   (X scale factor)
BL:YSCALE         Nwwwddd   (Y scale factor)
BL:ZSCALE         Nwwwddd   (Z scale factor)
BL:XEXTRUDE       Nwwwddd   (X component of block extrusion direction)
BL:YEXTRUDE       Nwwwddd   (Y component)
BL:ZEXTRUDE       Nwwwddd   (Z component)

...and this syntax is used to extract attribute data. 

numeric           Nwwwddd   (Numeric attribute tag)
character         Cwww000   (Character attribute tag)

 

The desired output file in this example is a comma delimited ASCII text file. This table will help you to construct the template file used with the ATTEXT command to match the desired (PNEZD) output format.

Field Numeric Data Max Field Length Decimal Places
Point No. N 003 000
Northing N 016 004
Easting N 016 004
Elevation N 016 004
Description C 032 000

 

 

 

 

POINT, ELEV, and DESC are Tag names within the block definition.

 

The Procedure

The following steps will show you how to use the ATTEXT command to create an ASCII point file from attributed blocks in a drawing file.

A Softdesk Point Block for example contains block attributes named POINT, ELEV and DESC.  Create a text file using the format shown below. This Template file will be used during the ATTEXT command to produce the output file formatted in a Point,Northing,Easting,Elevation,Description (PNEZD) format.

ATTEXT command Template File

 

Not using a Softdesk point block?  No problem.  Substitute the names (POINT, ELEV, DESC) of the attributes in the "template" file shown above for the corresponding attribute name in your custom block. Run the ATTEXT command using your template file specific to your block.

 

Comparing the new command EATTEXT to the old command ATTEXT

A template used with EATTEXT command in AutoCAD 2002 (and AutoCAD 2004) has a .blk file extension.

Just to see if there is any compatibility with the old format I tried using a template I used for ATTEXT named ASCIIPNEZD.TXT.  I renamed it to ASCIIPNEZD.BLK and got the following error when I ran EATTEXT.

 

After clicking OK I was able to continue in the wizard but could get no output.

 

 

I restarted the command from scratch. I cleared the unnecessary check boxes and continued to produce an output file successfully - not exactly to the specifications I desired but the data was extracted to a comma delimited file.

 

More output formats are available now in EATTEXT command found in AutoCAD 2002 (and AutoCAD 2004).

 

 

 

 

ATTEXT dialog.

 

 

Pros and Cons of ATTEXT

 

Conclusion

Use the ATTEXT command when you need to control the field order in the output file. I still favor the old command over the new because of this feature.  If EASE OF USE is the most important factor to you in this process then use EATTEXT. You will have to accept the rigid field order offered by this command. Both commands do essentially the same thing.  They allow you to export block insertion and attribute information to a file. The bottom line, you have avoided having to type coordinates in manually and you had fun doing it too. Woo Hooooo!

 

Brian Morse is a certified Autodesk instructor specializing in Land Desktop. He does training, consulting, contract drafting and design for Land Surveyors, Civil Engineers, Planners, Architects and you, the avid web surfer.

 

Copyright 2000-2003 by Brian Morse.
15:38 05/23/00 Original
07:48 07/09/00 Updated
08:44 10-23-2003 Updated
23:17 11-30-2003 Formatting and minor edits
15:25 12-13-2003 Edits made for clarity of purpose and procedure (and also fix some boo boos).

 

Back to Tips page.