Hello,
I am writing an SVG Parser (in C#) so our customers can use inkscape to draw shapes for our laser cutting machines.
I have created SVG files with just lines and polylines, but inkscape saves them as paths.
Circle and ellipse save as circle and ellipse, as does a rectangle.
I need to handle all the "shapes" that inkscape may generate in the SVG file.
Question is, does/can inkscape save a line as an xml "<Line" element, or does it always use paths?
Writng an SVG Parser, question about Line, Polyline
Re: Writng an SVG Parser, question about Line, Polyline
No.EddieRich wrote:Question is, does/can inkscape save a line as an xml "<Line" element, (...)
Core inkscape supports reading (rendering) of the SVG basic shapes but neither writing (creating) nor editing of such element types.
To edit the geometry of these basic shape elements in Inkscape (i.e. to use the node tool ( ) to edit the position of the points), the shapes need to be converted to path first (Shift+Ctrl+C).
Yes.EddieRich wrote:(...) or does it always use paths?
Inkscape only supports writing path elements for (open or closed) lines with straight segments drawn e.g. with the Pencil or the Pen tool.
Re: Writng an SVG Parser, question about Line, Polyline
Fantastic, thanks for the quick reply ~suv.
The fewer shapes I need to parse, the better
The fewer shapes I need to parse, the better
Re: Writng an SVG Parser, question about Line, Polyline
Just keep in mind that users often work with third-party content (directly opened, or imported), which of course might contain these valid SVG elements, or that users might apply Inkscape extensions which could add such elements to the current drawing. As long as the user does not manually convert these basic shape elements (line, polyline, polygon) to path (in order to edit their geometry), they will persist.EddieRich wrote:The fewer shapes I need to parse, the better
In my experience, it is not safe to assume that users never have Inkscape SVG files with content other than what was purely generated (newly drawn) in core inkscape itself.
Re: Writng an SVG Parser, question about Line, Polyline
~suv wrote:In my experience, it is not safe to assume that users ...
That has been my experience as well. Never assume anything when it comes to the end user.