Fwd: Re: generating 2D drawings

Bas Wijnen wijnen at debian.org
Sat Jan 15 11:06:49 EST 2011


Somehow this message didn't reach the list. I've now removed the
attachment and put it on my server:
http://a83-163-111-92.adsl.xs4all.nl/xmlgen

I hope that helps.

-------- Originele bericht --------
Op 13-01-11 10:05, Bas Wijnen schreef:
> Op 13-01-11 06:15, Jane Andreas schreef:
>> I would be more interested at this point in finding a 2d graphics
>> program that could generate objects based on equations/descriptions.
> 
> It is quite well possible to write svg by hand, that may be more what I
> (and you?) like. Since this is text-based, it is easily scripted in any
> scripting language as well. So you can for example write equations in
> python to construct paths, and add circles, rectangles and colours by
> hand and copy them unchanged into the output.

However, writing xml by hand is annoying, because of all the quotes and
brackets you need to type. So I just wrote a converter which takes a
python-style (in the sense that it uses indentation) input and produces
xml. It knows xhtml and svg headers so you don't have to remember them.

For example, from:

>svg
g stroke=black fill=none
	rect x=5 y=3 width=100 height=300 fill=yellow
	rect x=50 y=30 width=10 height=30 stroke=blue

It creates:

<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<g stroke="black" fill="none">
	<rect x="5" y="3" width="100" height="300" fill="yellow"/>
	<rect x="50" y="30" width="10" height="30" stroke="blue"/>
</g>
</svg>

I attached the converter (a python script). Use it for whatever you like
(as long as you follow the agpl3).

Thanks,
Bas
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: xmlgen
URL: <http://lists.en.qi-hardware.com/pipermail/discussion/attachments/20110115/455b9df5/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.en.qi-hardware.com/pipermail/discussion/attachments/20110115/455b9df5/attachment.pgp>


More information about the discussion mailing list


interactive