tracespace / gerber-to-svg

gerber-to-svg development moved to tracespace/tracespace
https://github.com/tracespace/tracespace
MIT License
81 stars 20 forks source link

Difference between gerber-to-svg and tracespace viewer #41

Closed davidworkman9 closed 6 years ago

davidworkman9 commented 6 years ago

First off, thanks a bunch for this!

I'm getting a different rendering out of the tracespace viewer and gerber-to-svg. I believe the issue is because the board is filled completely, then traces are etched away. Here's a small section taken from the tracespace viewer: screen shot 2018-02-26 at 10 57 48 am

Using gerber-to-svg the entire board is filled.

EDIT: Seems to be related to the mask#<layer_id>_clear-1 elements. They're not showing up at all when rendered via gerber-to-svg, even if I change their fill and stroke colours.

davidworkman9 commented 6 years ago

Turns out the issue is an ID fed to gerber-to-svg with a space in it. I use the file name of the uploaded file as the ID. Spent way longer than I'd like to admit to find that out! 🙈

mcous commented 6 years ago

Oh weird, using a space in the ID shouldn't cause problems! I'll investigate on my end, too. Sorry about the wild goose chase there. Are you using the CLI or the JS API?

davidworkman9 commented 6 years ago

No problem, JS API.

davidworkman9 commented 6 years ago

I found it. It's the attribute mask=url... on g elements. It needs to have single quotes around the URL in order to support spaces as well. E.g. <g mask="url(#Bump Sensor Board.GTL_clear-2)"> to <g mask="url('#Bump Sensor Board.GTL_clear-2')">.

Hope that makes sense, my SVG knowledge is limited.

While I have your attention, is there an easy way to remove this kind of stuff?

screen shot 2018-02-26 at 3 34 24 pm I noticed that the "board view" on the tracespace viewer does it but I couldn't figure out what the code was that was responsible for removing it.

mcous commented 6 years ago

Good catch! Shouldn't be too hard for me to find some time to get that fix in.

I'm not quite sure what you're asking to remove from that image, but I assume you're talking about anything that's outside the board outline? pcb-stackup (along with pcb-stackup-core) try to optimize what they identify as the outline layer (using gerber-to-svg's plotAsOutline option) and then they apply the optimized outline as a clip path to the rest of the layers.

Just in case it helps, here is where pcb-stackup-core creates a node in <defs> that's the contents of the outline layer's SVG, to be referenced by ID later in the overall image group's clip path attribute.

I'm also happy to answer any questions via email or on Gitter