4 ms·
Svg is typically a lot more complicated than coordinate points... https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths https://developer.mozilla.org/
by eyegor 5y ago
Svg is typically a lot more complicated than coordinate points... https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Pa...
- lights0123 5y ago(In the context of this post, which is just straight lines)
- paulgb 5y agoIf you can use an editor like Inkscape to flatten the image (by recursively ungrouping until every path is under the top-level <svg> tag), you should have a bunch of paths that share a coordinate space. There are pathological cases like images that use CSS for positioning, but for most cases this will work. Then you can use something like svgpathtools (https://github.com/mathandy/svgpathtools https://github.com/mathandy/svgpathtools) in Python to loop over the paths and get the coordinates. In case it's useful, I have an example svg to gcode converter here: https://github.com/paulgb/penkit/blob/master/penkit/polargraph/gcode.py https://github.com/paulgb/penkit/blob/master/penkit/polargra... It is for driving a polargraph-style plotter, so it includes a coordinate transform that GP does not need to do.