Web Version
Intelligence Extractor for CAD Drawings

CART DXF2CSV Intelligence Extractor

This is a utility which takes a CAD .DXF file and extracts any intelligence the drawing may have into a .CSV file that can be loaded into your favourite spreadsheet.

Designed for building a CART database from an existing drawing, it should also be useful for drawing audits, a much neglected area (if in fact it is even acknowledged).

Give it a try and let me know what you think. Just put it in a directory full of .DXF files and run it. It is pretty much self explanatory (if you acept the defaults for what you want to extract).

Demonstration version (dxf2csv.zip)


The help, accessed by typing a "?" at the first prompt, will provide the following:

******************************** Caution ********************************

This is experimental software and has not been much tested.

I don't think it will break anything or damage your DXF files but if it does all you can expect from me is that I will try to fix the problem (not the files). So make backups!

******************************** DXF2CSV ********************************

This utility is intended to quickly extract any intelligence that may be in a DXF file and create a comma seperated (.CSV) file that can be loaded into a spread sheet for analysis.

It will take arguments either from the command line or interactively.

The first argument, "Input file" requires the name of a valid .DXF file The second, "Output File" would typically have a .CSV extension

The third argument is optional and is the name of a .INI file specifying which elements of the drawing you want extracted. The defaults contained in "DXF2CSV.INI" will be used if no file is specified here.


The first part of the .INI File deals with ENTITIES, the second with CCODES


// e | ENTITY TYPE | Y/N // COMMENTS
//-----|--------------|----------------
e | 3DFACE | Y //
e | ATTDEF | N // Usually represents an exploded block
e | ATTRIB | Y // Handled as a part of the parent block
e | ARC | N //
e | CIRCLE | Y //
e | DIMENSION | N //
e | INSERT | Y //
e | LINE | Y //
etc...

This should be a complete list of AutoCAD Entities (in UPPERCASE)
The " e | " preceeding is mandatory as is the "|" following

Anything other than a "N" following the final "|" will cause that entity type to be included in the output

New Entities found in your .DXF files will be added to the current .INI file and will be picked up when the program is rerun.


// CODE| HEADING | Y/N // COMMENTS
//-----|--------------|----------------
# | No. | // point number
0 | Entity | // entity type
1 | Value | // text or attribute value
2 | Name | // block name
3 | v3 | N //
4 | v4 | N //
5 | Handle | // handle (a unique value)
6 | v6 | N //
etc...

This is a complete list of AutoCAD Codes for the Entities chosen)
The CODE field is the numeric value of the code in question
The HEADING field is the text string you want as Column Header when you import the .CSV file into the spreadsheet

Anything other than a "N" following the final "|" will cause that entity type to be included in the output

New Codes found in your .DXF files will be added to the current .INI file and will be picked up when the program is rerun.

Running the program on a .DXF file produces output like the following:
|.......|.....px.|......pxxx.a|.......pxxxpx.a||.......a
where
"|" indicates the start of an Entity, "." a Code processed,
"p" an EED Package, "x" an EED Value and "a" an Attribute.

You can then open the resulting .CSV file using your favourite spreadsheet where you will need to:
Adjust the rows to accomodate the length of the strings
Lock the headings (the top row of cells)

Typically the real intelligence (if it exists) is at the end of each row following the standard CAD stuff, Attributes first followed by up to 10 packages of Extended Entity Data (EEDs)

If you need to customize the output from different sources you should create custom .INI files.

If it exists a .INI file of the same name as the .DXF file is offered as the default. To create this file copy DXF2CSV.INI to ????.INI and edit the latter file until you get the output you want

Please send Bug Reports and the file: dxf2csv.log along with the offending .DXF and .INI files to:

Steve Nickerson steve@icomos.org

For Updates keep an eye on the web site: http://nickerson.icomos.org/steve/


Up Reload

Inquiries to: steve@nickerson.icomos.org

Generated by: CART
(Sat Dec 11 21:19:27 2004 )