XML for CAD?

Those who do not learn the lessons of history will be destined to relive it - and those that save their data in a proprietary format are doomed to re-create it. It's simply bad business to lock up your precious information in a format controlled by a single manufacturer.

I have railed against proprietary formats quite a few times. For Word Processing and Spreadsheets, StarOffice now saves documents in generic, readable XML format (and the next version of Microsoft Office promises to follow suit). For Project Extranets I have recommended either in-house storage of data or the ability to import XML data. That leaves CAD and Email as important storehouses of information in proprietary formats.

There are many components of CAD data. The most obvious is the visual, graphic component - which is often the most troublesome to share.

I have written before about the efforts of the Open Drawing Alliance (www.opendwg.org)- the confederation of CAD vendors and users committed to making the AutoDesk's AutoCAD DWG format a truly open one. The tools and information made available to members of the Open Drawing Alliance (associate membership is free and allows in-house use of the tools and information made available) allows for easy use and translations of native DWG formatted files. This alliance improves teamwork between team members use different CAD programs.

These conversions do an excellent job of translating not only the line work of your drawings, but also the underlying structure (usually called 'layers' or 'levels'), links ('xrefs' or 'cells') and data (object properties or 'attributes').

The various free viewers available from AutoDesk and the Open Drawing Alliance allow you to view the drawings from a Windows desktop, and over the Internet but only for those using Microsoft Internet Explorer. The Open Drawing Alliance provides viewer components for the Macintosh, Linux and other computing environments - but some programming expertise is necessary to put them to use.

AutoDesk's web viewer technology also requires drawing conversion to make it web viewable. Since DWG files are notoriously large, you wouldn't want to try to view a file in it's native format over the web anyway - it would take much too long to open it with even a high-speed DSL connection!

But these viewers are still not exactly 'open', and many team members and owners are drawing consumers who do not need the complexity of manipulating layers and visibility - they just want to zoom, pan and print a drawing.

Web browsers need to use vector graphics for other things too! Modern web services need to display complex charts, graphs and diagrams generated from dynamic, volatile data. You've probably seen on-line trading systems with complex market analysis charts with the underlying data updating the chart every few seconds.

Well, it turns out that the W3C (the World Wide Web Consortium) - the group that establishes the standards that make web pages universally readable - has integrated SVG (Scalable Vector Graphics) into it's specification for all modern browsers. In addition, Adobe provides a free viewer for Windows, Mac, Linux and Sun Solaris computers. SVG implementations are also available for handheld browsers.

SVG is simply structured graphics data in XML format, and it's implementation to display even the most complex graphics is a testament to the flexibility of XML. As simple, human readable text it can easily be treated as data for analysis and conversion - as well as for display over the web. If you view an SVG file, you'll see a simple XML file with one line item for each graphic line, curve or whatever. The line describes the endpoints, color, and other geometric properties of the graphical element. The SVG standard includes specs for a compressed version - SVGZ.

How could we possibly convert our CAD drawings into this universally viewable format? There are a few toolkits available to convert DXF files to SVG - and at least one commercial product to convert directly from DWG to SVG for easy distribution and viewing.

Savage Software (www.savagesoftware.com) has a program to convert DWG files to SVG, and has another product which sits on your web server to convert CAD, Databases and other file formats to web viewable formats on demand. The viewer can be any SVG supporting browser - desktop, mainframe and even mobile devices are supported.

In addition to displaying graphical information, Savage Software has demonstrated that with a little javascript you can add layer display control and provide access to object attributes within a standard browser interface. Although the example's interface is immature, it illustrates that the data is there and is quite usable.

All in all, the SVG format has the advantages of being an open standard, readable on more platforms and devices, capable of associating data with graphics. As XML it is widely readable and can be easily imported and exported, and as binary SVGZ data it can be compact enough to download to a handheld of view over the web.

More information about the SVG format is available at the W3C organization's SVG page: www.w3.org/Graphics/SVG/Overview.htm8