svgpathtools icon indicating copy to clipboard operation
svgpathtools copied to clipboard

getting paths per layer from svg

Open otmezger opened this issue 5 years ago • 2 comments

Hi, I have a complex SVG file generated by Inkscape. It contains several nested layers, and some of the layers contain polygons. I need to access those polygons by understanding on which layer they are.

Is there a way to access the layer information? I'm doing

paths, attributes = svgpathtools.svg2paths(svg_file_path)

but I don't see the layer information in paths or attributes.

thanks!

otmezger avatar Mar 26 '20 17:03 otmezger

The latest version of the master branch (but not the most recent release, 1.3.3) includes a new feature, svgpathtools.Document, that lets you access the DOM of the SVG XML. This lets you traverse the groups that make up Inkscape layers.

SebKuzminsky avatar May 15 '20 16:05 SebKuzminsky

I can print graphic information by using ’print‘. There is a class parameter in print which I think is the presentation layer, but I don't know how to separate the path from the lay. image Like this one, I want to extract the path of the green block. Once I've extracted the path, I can fill it with layers of color. (I don't know if my description is clear. I translated it into English through software.)

buyifadu avatar Dec 03 '21 13:12 buyifadu