Strange svg export for bottom layers with python

Hi,

I am trying to export a svg file in python. I have the following code which should plot “B_Fab” layer and “Edge_Cuts” layer

import pcbnew

board = pcbnew.GetBoard()

pc = pcbnew.PLOT_CONTROLLER(board)
pc.OpenPlotfile(“TEST”, pcbnew.PLOT_FORMAT_SVG, “TEST”)
pc.SetLayer(pcbnew.B_Fab) #pcbnew.F_Fab works fine
pc.PlotLayer()

pc.SetLayer(pcbnew.Edge_Cuts)
pc.PlotLayer()

pc.ClosePlot()

It works just fine for all layers except B_Fab and B_Silk. With these layers, the svg file gets plotted and is not empty but the components are not visible (as in attached file svg_test). Also if I copy content of this svg file to another ‘normal’ file, its content dissapears too!

Am I missing some settings or how can I plot the bottom layer’s B_Fab and B_Silk? I am using the KiCad version (5.1.5)-3

Thanks

svg_test.7z (1.1 KB)

I have dig a bit deaper and compared the generated svg source files for F_Fab and B_Fab and it seems that the one for bottom layers has negative sign in textLength and font-size:

textLength="-728.286" font-size="-524" lengthAdjust="spacingAndGlyphs"

When the negative signs are erased, the svg shows as it should. So is this a bug or am I generating or setting something wrong? Also, it makes sense that this problem is only with the
‘Fab’ and ‘Silk’ layers because those are the only layers with text in them.

I am seeing the exact same thing with KiCad (5.1.5)-3 with my own file.
I am importing the SVG files into Inkscape. I also tried importing the bottom silkscreen file to Affinitiy Designer (an Illustrator alternative which a colleague uses) and it works fine on there. Equally, if I open the file in Internet Explorer (Windows 10 default file open action), the file displays correctly.
I don’t know anything about the SVG format, but I guess it could be a correct implementation in Pcbnew which Inkscape does not support.

Having gotten intrigued by the SVG thing, a quick hunt shows that a negative value for textLength is an error: SVG 1.1 TextLength
font-size took a bit more poking, because the property is derived from the CSS2 standard, but the SVG entry is here: SVG 1.1 font-size property
And the CSS 2 entry stating that negative lengths are illegal is her: CSS2 font-size property

Should a bug report be raised?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.