libredwg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libredwg] Strategies for TestSuite and DWG write support


From: Felipe Sanches
Subject: [libredwg] Strategies for TestSuite and DWG write support
Date: Sat, 8 May 2010 06:05:35 -0300

Our friend Guruprasad Rane has suggested that we create an XML report based test suite and I think that it is a great idea. I have also been thinking about the DWG write support work that Anderson Cardoso will be doing with us as part of his Google Summer of Code project. So here are some thoughts I've just had about how these 2 efforts can interact:

== test suite thoughts ==

Just van Rossum has created a tool called TTX:
TTX decompiles TrueType and OpenType fonts to an XML-based text format (also called "TTX") and back, enabling you to edit fonts with a plain text editor.
http://www.letterror.com/code/ttx/index.html

I think that we want to do just the same for DWG files. I don't think it would be much useful to look into TTX source code because TrueType files are not really much related to our CAD work here. So, I think that TTX server more just as an inspiration for us, and as a precedent in this kind of approach, so that we can feel more confident of it being a good idea to have an XML equivalent representation of a binary file format.

We could use the name CXD for "CAD XML Dump" or something like that. Let's avoid using "DWG" in the name. This XML format (and the AutoCad script that generates it) could even serve as a data exchange tool. It would be interesting to allow LibreDWG to parse and to output in this XML format, perhaps. Free software CAD tools would benefit from being able to read it, so that it could be an easier path for breaking AutoDesk's lock-in and allowing users to migrate their projects to other CAD tools.

== strategies for DWG support ==

Imagine this scenario:
* We get a complex DWG file from a contributor.
* We run our hypothetical AutoCad script that generates an XML report
* We implement a tool that reads this XML report and that uses LibreDWG routines to create a DWG file with that content.
* We load the resulting DWG into AutoCAD again and generate a second XML report
* We compare both reports to check whether they differ or not.
* In case they differ, then this write support testcase is considered to have failed, and we can inspect the reports to try to fix our DWG write routines.

TODO:
- Figure out the legal aspects of this approach. I believe that it is ok to do it if we get a legal user license for AutoCAD, since we are simply running a custom script on it - that shouldn't be restricted at all. Perhaps we should contact FSF lawyers
- define the XML schema of our CAD XML Dump format. Ideally it should map directly to the way datastructures are organized inside a DWG file. (follow the TTX example)
- implement an AutoCAD script (either in autolisp or vba) that generates XML output based on a given DWG file
- implement a libredwg application that reads an XML report and outputs a DWG file
- implement a script that compares XML reports and decide whether the test has passed or not

Unfortunately, I think that it is not possible to automate this process since it involves running AutoCAD. Unless it is possible to run AutoCAD in a virtual machine in an automated way. But that could possibly infringe some AutoCAD EULA terms, so we better check that before trying to automate the process. Doing it in a non-automated way must not be illegal, I think.

I am waiting for your comments.

Happy Hacking,
Felipe "Juca" Sanches

reply via email to

[Prev in Thread] Current Thread [Next in Thread]