On 05/07/2013 01:34 PM, Martin Owens wrote:
If it were me, I'd simply prefix the id somehow. It sounds hackish at first but I don't think it is as it fits existing svg, provides a more precise identity which you can use to identify the elements in code. [...] Layers and groups are designed for _editing_ a set of objects and allowing transforms on them. Since this isn't want you need, the group/layers in svg are not related to your PCB layers.
On 05/07/2013 07:41 PM, Chris Mohler wrote:
Say I had a group of objects called "pins". I give them a property called "depth" and assign a value of N. Then I include the "pins" group inside another called "chip" with no custom depth. At output time, a final set of layers is created by parsing all of the objects and copying them to the output layers. Objects with a custom "depth" attribute like the "pins" group would be output to N-1 layers below the input layer, along with the corresponding output layer.
Or how about a set of named colors? EG, "registration" color outputs to every layer, etc.
Perhaps I could use a topology like this: <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="pcb_top"> <g id="some_part" class="pcb_component"> <g class="pcb_layer_copper"> [...] </g> <g class="pcb_layer_soldermask"> [...] </g> <g class="pcb_layer_silkscreen"> [...] </g> </g> </g> This way I don't need to introduce any new attributes, I'm still using SVG groups like they were intended to be used and it maps OK to SVG's object order-based drawing. Since components on one layer normally do not overlap (at least in PCB design), the 'id="some_part" class="pcb_component"' group does not pose a problem. Since components on both sides of the PCB may overlap, I would organize each side into one Inkscape layer. PCB traces will have to be inserted at the bottom (not top) of the respective (Inkscape) layer not to overlap solder mask or silk screen drawings.
When SVG2 comes about, the classes can simply be assigned z-order attributes via CSS.