tracespace / tracespace

⚡️generate beautiful and accurate SVG renders of printed circuit boards
https://tracespace.io
MIT License
831 stars 104 forks source link

clipPath for outline breaks in Firefox if outline has clear layers #302

Open attie opened 5 years ago

attie commented 5 years ago

I've got a couple of boards that have a somewhat complex outline, and unfortunately they don't render well...

I suspect that this is an issue with drawing filled SVG Paths, and the fact that this outline is actually rendered as a number of <path> elements, but I'm not fully sure. I imagine that rendering the board outline as a single path would resolve this issue.

Extract from top.svg: (lines are truncated)

<path d="M 100380.3 -28920.1 100379.4 -28920.1 100378.6 -28920.9 100376.1 -28921.8 100371.9 -28922.6 10
<path d="M 99766.3 -28587.7 99583 -28587.7 99583 -28816.8 99755.4 -28816.8 99761.3 -28816 99767.9 -2881
<path d="M 95174.9 -28582.7 94960 -28582.7 94960 -28795.1 95155.8 -28795.1 95161.6 -28794.3 95174.9 -28
<path d="M 98730.7 -28743.5 98724.9 -28743.5 98720.7 -28744.3 98715.7 -28745.1 98709.9 -28746 98696.5 -
<path d="M 98233.3 -28743.5 98227.5 -28743.5 98223.3 -28744.3 98218.3 -28745.1 98212.5 -28746 98199.2 -
<path d="M 96943.6 -28743.5 96938.6 -28743.5 96934.5 -28744.3 96930.3 -28744.3 96924.5 -28745.1 96912 -
<path d="M 95698.1 -28743.5 95692.3 -28743.5 95688.1 -28744.3 95683.1 -28745.1 95677.3 -28746 95664 -28
<path d="M 96382.1 -29152.5 96312.1 -29152.5 96312.1 -29084.2 96311.3 -29085.1 96309.6 -29087.6 96306.3
<path d="M 100908.5 -28742.7 100909.3 -28741.8 100911 -28740.2 100914.3 -28736.8 100918.5 -28732.7 1009

These gerbers are produced using Altium Designer.

image

image


mcous commented 5 years ago

Thanks for the report! I gave this file a look over, and here are some initial thoughts:

In tracespace, I can get this outline to render properly if I do the following:

attie commented 5 years ago

It looks like the way Altium encodes text into Gerber breaks the SVG outline clipping tracespace uses. Until we can address that somehow, I recommend that you don't put anything other than the outline itself in your outline layer

Oh, I didn't even think about that! Thanks very much for looking in to the issue - I'll keep that in mind.

I'll leave the ticket open (I feel it's something worth addressing - lots / all of my boards have text outside to identify the layer), but if you disagree, please feel free to close it.

mcous commented 5 years ago

Did some more investigating, and this is a very interesting pair of issues! I really appreciate you taking the time to write them up.

There is probably some interaction with #302 going on here, but the most pressing issue I can find here is that in Firefox (my browser of choice), clear masks in the outline <clipPath> break the outline entirely, whereas in Chrome the clipPath still works. I agree that this ticket should stay open for that reason.

In terms of the other stuff:

attie commented 5 years ago

Hey, no problem - thanks for such a great response!

Just to clarify, I've tried removing the text / layer label from the gerber, and I'm seeing the same issue. I edited the gerber, rather than editing the source document and re-exporting.

Chrome 77.0.3865.90

Firefox 69.0.3

mcous commented 5 years ago

@attie, sorry I should've been more clear, because there's a few things going on:

The fill is funny because the lines and arcs, as described in the Gerber file (and possibly as drawn in Altium), have tiny gaps. For example, here's an extreme zoom with the tool size modified:

Screenshot 2019-10-10 17 06 34

tracespace can fill gaps to a point, but at the end of the day (and for the v4 release line) I don't think you can expect it to work in all cases of "bad" data.

In this case, I would recommend:

In the v5 release line, I'd like to play with teaching tracespace how to recognize that an outline it has isn't likely to fill properly, and enable/disable the board outline render accordingly. I have no idea how that's going to happen, though, and it will likely involve me writing at least one or two new issues. I also have no idea when v5 will be ready

attie commented 5 years ago

Hi @mcous, I understand now - thanks very much for the additional information... I'll review my outline placement!