SVG-import doesn't respect stroke-width

Use this forum to ask questions about how to do things in QCAD.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
User avatar
Krischu
Premier Member
Posts: 150
Joined: Thu Jul 04, 2019 8:11 am

SVG-import doesn't respect stroke-width

Post by Krischu » Sun Mar 22, 2020 12:49 pm

I have drawn a rectangle and gave it the linewidth 0.
This seems to reflect in the source code (stroke-width:0).

But when importing the SVG later on, the rect is drawn with a line-width according to the layer. Is this intended?
If I give the layer the associated line_weight 0 it doesn't show in the SVG export.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!-- 2020-03-22 12:27:26 Generated by QCAD 3.24.3 SVG Exporter -->
<svg width="70mm" height="10mm" viewBox="10 -20 70 10" version="1.1" xmlns="http://www.w3.org/2000/svg" style="stroke-linecap:round;stroke-linejoin:round;fill:none">
    <g transform="scale(1,-1)">
        <!-- Line -->
        <path d="M10,10 L80,10 " style="stroke:#000000;stroke-width:0;"/>
        <!-- Line -->
        <path d="M80,10 L80,20 " style="stroke:#000000;stroke-width:0;"/>
        <!-- Line -->
        <path d="M80,20 L10,20 " style="stroke:#000000;stroke-width:0;"/>
        <!-- Line -->
        <path d="M10,20 L10,10 " style="stroke:#000000;stroke-width:0;"/>
    </g>
</svg>
Attachments
rect_lw_0.svg
(704 Bytes) Downloaded 359 times
--
Christoph

CVH
Premier Member
Posts: 3470
Joined: Wed Sep 27, 2017 4:17 pm

Re: SVG-import doesn't respect stroke-width

Post by CVH » Sun Mar 22, 2020 1:03 pm

A: What SVG export method?
One can preserve the overall look or the geometry.
B: Line_weight 0 = no weight in SVG and can not be shown.

Regards,
CVH.

User avatar
Krischu
Premier Member
Posts: 150
Joined: Thu Jul 04, 2019 8:11 am

Re: SVG-import doesn't respect stroke-width

Post by Krischu » Sun Mar 22, 2020 5:41 pm

CVH,

thanks. I used both Advanced SVG export

What do you mean by

"B: Line_weight 0 = no weight in SVG and can not be shown." ?
--
Christoph

CVH
Premier Member
Posts: 3470
Joined: Wed Sep 27, 2017 4:17 pm

Re: SVG-import doesn't respect stroke-width

Post by CVH » Sun Mar 22, 2020 7:07 pm

CVH wrote:
Sun Mar 22, 2020 1:03 pm
B: Line_weight 0 = no weight in SVG and can not be shown.
What it says: A zero weight in SVG is a line with no visible size.
Qcad among other CAD's display a minimum.

User avatar
andrew
Site Admin
Posts: 9059
Joined: Fri Mar 30, 2007 6:07 am

Re: SVG-import doesn't respect stroke-width

Post by andrew » Sun Mar 22, 2020 10:36 pm

This is an SVG import limitation. SVG import imports to the current layer (as SVG doesn't have layers) and sets lineweight and linetype to "By Layer". Only the color attribute is currently imported.

I wouldn't recommend to export / import SVG when working on a file. Always use DXF to preserve all information in the file.

User avatar
Krischu
Premier Member
Posts: 150
Joined: Thu Jul 04, 2019 8:11 am

Re: SVG-import doesn't respect stroke-width

Post by Krischu » Mon Mar 23, 2020 8:36 am

Yes, sure. DXF is the way to exchange back and forth. Nonetheless a bit more completeness in SVG import wouldn't be bad. For example, a fill (hatch) isn't imported either.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!-- 2020-03-23 07:36:57 Generated by QCAD 3.24.3 SVG Exporter -->
<svg width="70mm" height="10mm" viewBox="10 -20 70 10" version="1.1" xmlns="http://www.w3.org/2000/svg" style="stroke-linecap:round;stroke-linejoin:round;fill:none">
    <g transform="scale(1,-1)">
        <!-- Line -->
        <path d="M10,10 L80,10 " style="stroke:#ff0000;stroke-width:0;"/>
        <!-- Line -->
        <path d="M80,10 L80,20 " style="stroke:#ff0000;stroke-width:0;"/>
        <!-- Line -->
        <path d="M80,20 L10,20 " style="stroke:#ff0000;stroke-width:0;"/>
        <!-- Line -->
        <path d="M10,20 L10,10 " style="stroke:#ff0000;stroke-width:0;"/>
        <!-- Hatch -->
        <path d="M10,10 L80,10 L80,20 L10,20 Z" style="fill:#ff0000;fill-rule:evenodd;"/>
    </g>
</svg>
Attachments
rect_lw0_red.svg
(817 Bytes) Downloaded 365 times
--
Christoph

User avatar
andrew
Site Admin
Posts: 9059
Joined: Fri Mar 30, 2007 6:07 am

Re: SVG-import doesn't respect stroke-width

Post by andrew » Mon Mar 23, 2020 8:43 am

Confirmed. SVG import is definitely only partial, mainly to import the geometry. We currently have no plans to improve SVG import. Note that SVG also has many features not available in DXF and vice versa. It's a presentation format, not a CAD format.

Post Reply

Return to “QCAD 'How Do I' Questions”