Page 1 of 1

SVG import function - maintaining line data.

Posted: Thu Jan 20, 2022 9:09 pm
by davecoventry
If I export a 2D render of a FreeCAD model, I can specify that hidden lines can be presented in a specific colour so that they may be passed to a HIDDEN layer which I can specify the line type as dotted (HIDDEN) and the line colour as grey.

The Import SVG function in QCAD is a great facility, but it does not preserve this information in the imported file.

It would be great if this could be addressed.

Many thanks,

Dave

Re: SVG import function - maintaining line data.

Posted: Wed Feb 02, 2022 5:12 am
by davecoventry
If anybody else is looking for the same feature, it does already exist.

If one imports an SVG file which defines the line colour by using the xml description stroke="#ff00ff", for example, this is ignored as I have found previously.

However, if one uses the xml description style="stroke:#ff00ff", then the colour information is maintained and the line is rendered as magenta.

In linux, running the following command will set up the svg file for you:

sed -i 's/stroke=\"#ff00ff\"/style=\"stroke:#ff00ff\"/g' FreeCAD.svg

Re: SVG import function - maintaining line data.

Posted: Fri Feb 04, 2022 8:42 am
by CVH
Nice catch.
davecoventry wrote:
Thu Jan 20, 2022 9:09 pm
...
this is ignored as I have found previously.
...
but it does not preserve this information in the imported file.
It would be great if this could be addressed.
Remark that the technology of dxf and svg is quite different.
One shouldn't expect a one-on-one conversion.

"Ignored" is a big word, properties are also inherited.
http://www.w3.org/TR/SVG/painting.html#StrokeProperty
Here stroke="#ff00ff" is a property.
From CAD point of view it inherits the Layer Properties.

style="stroke:#ff00ff" is an inline style.
From CAD point of view that is a specific property.

Regards,
CVH