[cad-linux-dev] Re: CAD data - YAML text file format

  • From: Bruno Postle <bruno@xxxxxxxxxx>
  • To: CAD linux development <cad-linux-dev@xxxxxxxxxxxxx>
  • Date: Sun, 5 Oct 2003 20:43:22 +0100

On Sun 05-Oct-2003 at 08:30:13PM +0100, Bruno Postle wrote:
> 
> This key->value format might not be expressive enough for a real CAD
> system, so I want to make some suggestions for different ways of
> doing it - I'll post them as follow-ups to this.

This first idea is to use an existing file-format standard that
resembles the system I invented; YAML has many of the same features,
and is much more mature:

    http://www.yaml.org/

The ad-hoc internal file format used by 'draft' is loosely based on
the RFC 822 email header format - This is the typical contents of a
'draft' file representing a simple line:

    0: 170
    0: 170
    0: 0
    1: 200
    1: 170
    1: 0
    Copyright: Bruno Postle <bruno@xxxxxxxxxx>
    License: http://creativecommons.org/licenses/sa/1.0/
    Units: millimetres

I chose this format because it is incredibly simple and fast to
parse, as well as being human readable.

Obviously this has all been done before, the same data structure
would look very similar with YAML:

    --- #YAML:1.0 !bruno.postle.net/line
    0: [ 170, 170, 0 ]
    1: [ 200, 170, 0 ]
    copyright: Bruno Postle <bruno@xxxxxxxxxx>
    license: http://creativecommons.org/licenses/sa/1.0/
    units: millimetres

YAML is a data serialisation language, not a markup language like
XML, so it is probably better in principle for CAD data and surely
expressive enough.

-- 
Bruno

Other related posts: