Add support for Inkscape SVGs
See original GitHub issueSituation: I have a maths paper. I run pdf2svg or dvisvgm. I modify the svg with inkscape just minimally (for example I change the grouping of elements). I try to load it with SVGMobject. This fails.
Cause of the Problem:
Manim does not expect g and defs tags to have an id.
They have no id on dvisvgm output, but they do when saving the same svg from Inkscape.
Solution in svg_mobject.py replace get_all_childNodes_have_id with
def get_all_childNodes_have_id(self, element):
all_childNodes_have_id = []
if not isinstance(element, minidom.Element):
return
if element.hasAttribute('id') and (
not element.tagName == "g"
and
not element.tagName == "defs"
):
return [element]
for e in element.childNodes:
all_childNodes_have_id.append(self.get_all_childNodes_have_id(e))
return self.flatten([e for e in all_childNodes_have_id if e])
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Essential Step to Save SVGs Correctly in Inkscape! - YouTube
Ever get errors when you upload SVG files to Design Space or cutting software? It's probably because you forgot this SUPER important step....
Read more >How To Create SVGs in Inkscape - YouTube
Learn how to create SVG files for free in Inkscape. We'll go over everything you need to make easy to use SVG files...
Read more >About SVG - Inkscape
Inkscape prides itself on being a fully standard-compliant SVG editor. As of March 2015, it even supports rendering of SVG properties which are...
Read more >How to Make an SVG File in Inkscape in Five Easy Steps!
Step 1. Install Inkscape on your Computer · Step 2. Open Your Image File in Inkscape · Step 3. Select and Trace Your...
Read more >How to Make an SVG in Inkscape Easily | Design Bundles
Open Inkscape and click on New Document. On the left side panel click Create and Edit Text Objects then click anywhere on the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Looks good to me, I’ll get this change made in the
svg_parserbranchYes it needs a lot of work, but thanks for closing this one. cc @yoshiask