From: Fred Lakin
Subject: need DXF parser
Date: 
Message-ID: <37B350AB.AD906B6@pgc.com>
I need a DXF parser so I can read files into graphics editor of my own
devising (written in Common
Lisp).

I have heard that the syntax of DXF files is "really simple". But after
looking at a sample ascii DXF
file, it doesn't seem so simple to me.

Can anyone help me out?

Best would be a parser written in CL. Then some other lisp. Then ptr to
documentation explaining
the format of DXF files in sufficient detail to write my own parser.

Thanks,
-f

·····@pgc.com

From: Kent M Pitman
Subject: Re: need DXF parser
Date: 
Message-ID: <sfwr9l8715p.fsf@world.std.com>
Fred Lakin <·····@pgc.com> writes:

> I need a DXF parser so I can read files into graphics editor of my own
> devising (written in Common Lisp).

Hi, Fred.  The probably-well-known Encyclopedia of Graphics File 
Formats gives this only cursory treatment, but the other book I use 
which most people seem never to have heard of is The File Formats 
Handbook, by Gu"nter Born.  It has a detailed description of the 
AutoCAD DXF format (and a zillion other interesting formats, not all 
just graphics).
From: Reini Urban
Subject: Re: need DXF parser
Date: 
Message-ID: <37b421af.281276584@judy.x-ray.local>
Kent M Pitman <······@world.std.com> wrote:
>Fred Lakin <·····@pgc.com> writes:
>> I need a DXF parser so I can read files into graphics editor of my own
>> devising (written in Common Lisp).
>
>Hi, Fred.  The probably-well-known Encyclopedia of Graphics File 
>Formats gives this only cursory treatment, but the other book I use 
>which most people seem never to have heard of is The File Formats 
>Handbook, by Gu"nter Born.  It has a detailed description of the 
>AutoCAD DXF format (and a zillion other interesting formats, not all 
>just graphics).

hmm, damned newsfeed these days, i missed the original one.

Fred, this is easy. 
there's an ascii format, where each junk has two lines, the first is a
number which denotes the type of the second line to interpreted.
binary dxf are not that common but similar.

full specs are at http://www.autodesk.com/techpubs/autocad/dxf/
--
Reini Urban
http://xarch.tu-graz.ac.at/autocad/news/faq/autolisp.html
From: Eugene Zaikonnikov
Subject: Re: need DXF parser
Date: 
Message-ID: <934798125.41402@lxms.cit.org.by>
Fred Lakin <·····@pgc.com> wrote in message ·····················@pgc.com...
[snip]
> I have heard that the syntax of DXF files is "really simple". But after
> looking at a sample ascii DXF
> file, it doesn't seem so simple to me.
The man who designed that format should be isolated from society.

> Best would be a parser written in CL. Then some other lisp. Then ptr to
> documentation explaining
> the format of DXF files in sufficient detail to write my own parser.
I wrote 2D DXF subset parser in C some time ago, that was an unforgettable
experience. I used
state machine (i.e. a lot of nested switch/case statements) to get rid of
DXF context-dependence
and unpredictable order of markers/sections appearance in the files.
IIRC, you can get some DXF documentation in WinHelp format from the Autodesk
site, but
perhaps it better to look for DXF books in a bookstore.

--
    Eugene.
From: Eugene Zaikonnikov
Subject: Re: need DXF parser
Date: 
Message-ID: <934798649.853660@lxms.cit.org.by>
Fred Lakin <·····@pgc.com> wrote in message ·····················@pgc.com...
[snip]
> I have heard that the syntax of DXF files is "really simple". But after
> looking at a sample ascii DXF
> file, it doesn't seem so simple to me.
The man who designed that format should be isolated from society.

> Best would be a parser written in CL. Then some other lisp. Then ptr to
> documentation explaining
> the format of DXF files in sufficient detail to write my own parser.
I wrote 2D DXF subset parser in C some time ago, that was an unforgettable
experience. I used
state machine (i.e. a lot of nested switch/case statements) to get rid of
DXF context-dependence
and unpredictable order of markers/sections appearance in the files.
IIRC, you can get some DXF documentation in WinHelp format from the Autodesk
site, but
perhaps it better to look for DXF books in a bookstore.

--
    Eugene.
From: Reini Urban
Subject: Re: need DXF parser
Date: 
Message-ID: <37b937cf.614620197@judy.x-ray.local>
"Eugene Zaikonnikov" <······@removeme.cit.org.by> wrote:
>I wrote 2D DXF subset parser in C some time ago, that was an unforgettable
>experience. I used state machine (i.e. a lot of nested switch/case statements) to get rid of
>DXF context-dependence and unpredictable order of markers/sections appearance in the files.
>IIRC, you can get some DXF documentation in WinHelp format from the Autodesk
>site, but perhaps it better to look for DXF books in a bookstore.

there's a really decent DXF parser written in forth, which even ships
with AutoCAD because because one of the founding members of Autodesk
wrote it. DXFIX. this is the "official" dxf parser and converter.
the state machine was much easier in forth without any c-typical switch
orgies, because the context was passed around, no globals.

the order of markers and sections is well-defined and predictable, only
some parts can be omitted and some special numeric groups were added
with the new ARX system to be able to derive c++ classes at runtime and
to establish dynamic links (reactors) between entities.
--
Reini Urban
http://xarch.tu-graz.ac.at/autocad/news/faq/autolisp.html
From: Eugene Zaikonnikov
Subject: Re: need DXF parser
Date: 
Message-ID: <934892889.512385@lxms.cit.org.by>
Reini Urban <······@xarch.tu-graz.ac.at> wrote in message
·······················@judy.x-ray.local...
[snip]
> there's a really decent DXF parser written in forth, which even ships
> with AutoCAD because because one of the founding members of Autodesk
> wrote it. DXFIX. this is the "official" dxf parser and converter.
> the state machine was much easier in forth without any c-typical switch
> orgies, because the context was passed around, no globals.
I had very limited experience with Forth, but it sounds believable.

> the order of markers and sections is well-defined and predictable, only
> some parts can be omitted and some special numeric groups were added
> with the new ARX system to be able to derive c++ classes at runtime and
> to establish dynamic links (reactors) between entities.
Perhaps I used wrong sentence to describe the problem. Here's an excerpt
from DXFR14 reference, DXF Group Codes/General DXF Conventions/Object and
Entity Codes:
"Programs that read DXF files should not assume that the groups describing
an entity occur in the order given here."

--
    Eugene.