- flex and bison files for limited conversion from autocad dxf to POV-RAY format.
- whole DXF flex syntax is there as of that timeframe.
- I tried my best, but I am not an expert in flex and bison.
- files are huge.
- written for gnu C, flex and bison (mingw works)
- limited conversion from autocad dxf to POV-RAY format.
- unfinished, took it as far as I could.
- source files are huge
- practically whole DXF syntax as of time of writing (12/2008)
- bison file does the very simplified syntax conversion to POV (could be expanded), flex file does the reading of the dxf file, but dxf file must be in text format.
- additional personally written converter written in C/C++ to do conversion from DXF to POV
- due to the fact that the test files were from a copyrighted disc, cannot include them. dxf files are available all over the internet as stock 3d objects.
MinGW compiled executables with sources [windows 32+64-bit]).
The project is under the GPL3 license and is available as a dxftopov.zip file. lsm file.
This project is unfinished. If someone starts coding in it, it it will probably progress beyond my ability to maintain it (but at least it will be done). I have some 1993-era test files. I hope you have more recent test files.
- a BNF Grammar for Autocad DXF files, though incomplete, since the below bison grammar is more complete.
- a C/C++ lexical analyzer for Autocad DXF files. this one works. it is capable of lexical analysis of binary and ASCII DXF files.
- flex+bison grammar, compiled. I have 68 questions left to be answered on this grammar because of the dxf ref which is ambiguous and has missing things. the bison grammar has also turned out to be impossible due to the ambiquities of the flex file. I am also running into a problem where the resulting file dxftopov.exe errors on the end of file. There are notes in the parser.y file that are not in the BNF grammar. The parser.y file is also more accurate because the dxf reference failed to mention a number of codes that it uses in its listings and I had to clean out the errors.
This project is based on what information I could get for free: the Autocad DXF Reference for Autocad 2009. Please note that this is *not* a formal specification document and certainly doesn't read like one. (I could really use a DXF spec if I could get it if anyone can help me). Critical information for software development is missing from the reference, information is left dangling with no instruction on what to do with it, and a number of descriptions are vague. The lexical analyzer works on real autocad files dated 1993 - sorry it's all I have. I have tried it on >100 nearly-similar files that I was able to scrounge from an old windows 3.1 Virtual Reality program, and it reads all the way until the end and finishes properly with 0 END. Because Virtual Reality is a commercial program, the DXF sample files are not licensed for me to distribute with the zip file. The parser fails on all of the test files and I don't know why. All I can get so far from the parser is a pass/fail response. I don't seem to be able to get at the error tokens.
The DXF Reference doesn't appear to contain rigorous sequencing information. All I know from reading it is that any code can follow from any code with a few exceptions.
PARSING: I have no clue how to get from a Autocad syntax tree in memory to POV output. walking that tree is going to be a real pain. So at this point, the parser will be pretty much half-done if I can get that far. I haven't written a compiler in years. Currently the best I can do is create a deque of tokens that can be walked (and cleared). because of the way yytext works, I am unable to get the tokens I want when the semantic analysis is done. yytext gives you all the text from the last token in a desired sequence to the end of file. what would be best for me is if it started at the beginning of the sequence - then I could extract what I want. I am speaking of the C version of the code, which is in win\c\ and only compiles under gcc/djgpp (Borland C++ 5.5[.1] doesn't like it).
The C++ code includes a working hand-coded C++ lexer (lexical_analyzer), however, I have not fully interfaced it to bison yet. it handles binary files (with the exception of booleans, which I could not get proper specs on).
- 3DFACE (what does this convert to? somebody help me out here!)
- VIEWPORT (convert to camera)
- SECTION (object)
- SOLID --> POV triangle? what's the 4th corner for?