SVG export ignores polyline width
Posted: Tue Aug 06, 2019 9:45 pm
I have exported a schematic diagram from the EAGLE printed circuit CAD program as a DXF file. I want to use QCAD-Pro to make some adjustments to that DXF and then export it as SVG for inclusion in documentation. The import into QCAD works fine. However, each line of the diagram is composed of three polylines, one for the length of the line and two arcs to make rounded ends on the line. The width of the line is controlled by the width parameter of the polyline. This renders correctly in the graphics view of QCAD, but in the SVG output the line is reduced to a simple line with width determined by the linewidth parameter and the arcs look like knobs on the ends of the line. See the attachments lc.dxf and lc.svg which are a single stroke taken from a vector-font character in the schematic scaled up by 100 for easier viewing of the SVG in Firefox. The corresponding screenshots are pro.png and svg.png.
It would be straightforward to achieve correct rendering in SVG by exporting the line segment as a rectangle with the length determined by the line length and the width determined by the polyline width using stroke-width:0 and filling with the polyline's color. Similarly the arcs would be rendered as closed, filled semi-circles. In fact, for this particular construction of lines using a linear polyline and two arc polylines, a further optimization would be to output just one filled shape composed of the two arc and the two sides of the rectangle. That's what I have done by hacking the SVG for this test image, producing lco.svg and hacked.png. But that optimization would not be necessary for correct rendering.
I wanted to try to implement this idea (and also investigate the problems I mentioned in https://qcad.org/rsforum/viewtopic.php? ... 322#p24286) so I updated my local repo from github. Then I came to realize that the community version does not support SVG export at all. In fact, the community version appears to ignore the polyline width parameter completely because it renders the graphics view in the same problematic way as the SVG output from QCAD-Pro, see community.png. Is there any way that I could work on this?
It would be straightforward to achieve correct rendering in SVG by exporting the line segment as a rectangle with the length determined by the line length and the width determined by the polyline width using stroke-width:0 and filling with the polyline's color. Similarly the arcs would be rendered as closed, filled semi-circles. In fact, for this particular construction of lines using a linear polyline and two arc polylines, a further optimization would be to output just one filled shape composed of the two arc and the two sides of the rectangle. That's what I have done by hacking the SVG for this test image, producing lco.svg and hacked.png. But that optimization would not be necessary for correct rendering.
I wanted to try to implement this idea (and also investigate the problems I mentioned in https://qcad.org/rsforum/viewtopic.php? ... 322#p24286) so I updated my local repo from github. Then I came to realize that the community version does not support SVG export at all. In fact, the community version appears to ignore the polyline width parameter completely because it renders the graphics view in the same problematic way as the SVG output from QCAD-Pro, see community.png. Is there any way that I could work on this?