FW: [PythonCAD] svg export and more

Eric Wilhelm ewilhelm at sbcglobal.net
Tue Jul 6 22:54:08 CEST 2004


# The following was supposedly scribed by
# Somerlot, Chris
# on Tuesday 06 July 2004 01:04 pm:

>I looked at it and I buy into the idea. But it sounds like the central
>hub data structure still needs to be worked out? If it is I would be
>happy to work on the svg reader and writer backends, and maybe flash.

First note that with the hub model, a node can be a hub as easily as it can be 
a node, so if we get it wrong the first time, we just move that hub into 
'node' status and keep moving forward (e.g. that hub becomes deprecated, but 
doesn't render huge piles of code useless.)

Yes, to make the central hub an on-disk data structure, there is some work 
left to be done.  My current line of thought is that the central hub would be 
in a YAML format where each entity lives in its own file.

As one possible example, we could have a database where everything is divided 
into a directory based on the type of object (rather than have an object-type 
property stored in every file.)

$tree db
db
`-- objects
    |-- meshes
    |   `-- spheres
    |       `-- 19.yaml
    `-- planar
        |-- circles
        |   `-- 1.yaml
        `-- lines
            `-- 2.yaml

$cat db/objects/planar/lines/2.yaml
--- #YAML:1.0
ID: 2
pts:
  -
    - 5.3326
    - -7.09
  -
    - 9.887
    - 0.876

This idea is still rather rough.  Also, as a first step, I'm planning to 
create a backend for my CAD::Drawing Perl module which implements saves in 
YAML (as shown above and maybe also as a single file.)

If you can code in Perl, you may want to check-out the CAD::Drawing module, 
since it already implements an in-memory data structure.  There are some 
warts on it (namely that ACI colors are used as the color value and some 
other dwg-specific issues.)  However, these have been staring me in the face 
for some time, so I'd be happy to remove them if I can find the time and 
motivation.

Given CAD::Drawing::IO::SVG and CAD::Drawing::IO::PythonCAD modules, we'd be 
already there (there is already a CAD::Drawing::IO::PostScript.)

You can get them on CPAN (in installable tarball) or grab the bleeding-edge 
versions from my svn server: 
http://ericwilhelm.homeip.net/svn/CAD-Drawing/trunk/code/

If you can't or don't want to code in Perl, we'd better get started with that 
on-disk model so you have something to shoot for.  There are YAML libraries 
available for Perl, Python, and I think C and C++, so I think it is a good 
format to shoot for.  Again, note that the hub-is-a-node concept allows me to 
connect all of the CAD::Drawing modules to the on-disk format just by writing 
a CAD::Drawing::IO::SplitYAML module.

Get in touch with me on-list, off-list, on cad-linux-dev or on #cadfs on 
irc.freenode.net.  (Art would have to say if on-list is off-limits.)

--Eric
-- 
The opinions expressed in this e-mail were randomly generated by 
the computer and do not necessarily reflect the views of its owner.
                                        --Management


More information about the PythonCAD mailing list