Mike Crowe

Mike Crowe
Waveland, MS
Occupation: Electrical Engineer, Software Developer, Owner, Head floor sweeper
email: mcrowe@gcdataconcepts.com
web: http://www.gcdataconcepts.com/,


XSLT to convert SVG to PCB

Here are some preliminary .xslt files and a bash script that converts an SVG to a PCB element list. I use xsltproc as my transforming engine, but any xslt tool should work.
The bash script takes an input file and runs it through two xsl stylesheets. The first sheet attempts to put the SVG into a form containing just the content type <lines>. The second xslt converts the <lines> to a PCB element list.
The xslt's process the supplied example .svg. The output appears to be correct, .... but the general case of converting a generic svg isn't there yet. Please feel free to help get it to work for the more general case.

TODO list

  • Handle other types of svg objects
  • Better handling of <svg:path> objects, d attribute needs work
  • Style attrib needs to be parsed to provide line end types
  • Line widths need work
  • Clearance widths are not correctly handled
  • Need to be handle output from other tools that output svg
  • To work with, download all the files below into the same directory. Then run the script. The resulting output is suitable for "file->load element data to past buffer" in PCB
    svg2svg_lines.xsl, takes an svg containing paths and converts to lines
    svgpath2lines.xsl, helper function for above stylesheet lines
    xsltmatrixtransform.xsl, scales, rotates, and offsets as per the svg matrix spec.
    svg_lines2pcb.xsl, takes an svg containing just lines to PCB format
    convert.sh, script to process above xslt's

    grb.svg is an example svg created with gerbv --export=svg --output=grb.svg
    It is a board outline 0.850 wide by 3.116 long. There are two 45 degree miters on the left hand side and cutouts on the right hand side (see image below)
    No SVG Support!
    svg2footprint.xsl, takes a specialized svg and converts it to a PCB footprint




    Copyright 2011, all rights reserved unless specified otherwise.
    gedasymbols.org is maintained by DJ Delorie