manim
manim copied to clipboard
NameError: name 'SVGPathMobject' is not defined
Description of bug / unexpected behavior
Using SVGMobject works, but SVGPathMobject seems to not exists.
Expected behavior
It creates an Mobject from the Path value of an SVG as described here: https://docs.manim.community/en/stable/reference/manim.mobject.svg.svg_path.SVGPathMobject.html
How to reproduce the issue
Just try to use SVGPathMobject.
class CreateSquare(Scene):
def construct(self):
squarepath = SVGPathMobject("M0 0 C41.29 0, 82.57 0, 115.31 0 M0 0 C42.98 0, 85.96 0, 115.31 0 M115.31 0 C115.31 23.62, 115.31 47.25, 115.31 115.31 M115.31 0 C115.31 26.32, 115.31 52.63, 115.31 115.31 M115.31 115.31 C77.19 115.31, 39.07 115.31, 0 115.31 M115.31 115.31 C74.87 115.31, 34.43 115.31, 0 115.31 M0 115.31 C0 77.81, 0 40.31, 0 0 M0 115.31 C0 80.12, 0 44.93, 0 0")
self.play(Create(squarepath))
Logs
Terminal output
File c:\Python310\lib\site-packages\IPython\core\interactiveshell.py:2357, in InteractiveShell.run_cell_magic(self, magic_name, line, cell)
2355 with self.builtin_trap:
2356 args = (magic_arg_s, cell)
-> 2357 result = fn(*args, **kwargs)
2358 return result
File C:\tools\Manim\Lib\site-packages\manim\utils\ipython_magic.py:150, in ManimMagic.manim(self, line, cell, local_ns)
148 SceneClass = local_ns[config["scene_names"][0]]
149 scene = SceneClass(renderer=renderer)
--> 150 scene.render()
151 finally:
152 # Shader cache becomes invalid as the context is destroyed
153 shader_program_cache.clear()
File C:\tools\Manim\Lib\site-packages\manim\scene\scene.py:222, in Scene.render(self, preview)
220 self.setup()
221 try:
--> 222 self.construct()
223 except EndSceneEarlyException:
224 pass
File <string>:16, in construct(self)
NameError: name 'SVGPathMobject' is not defined
System specifications
- OS (Windows 10):
- Manim Version: v0.16.0.post0
- Python version (
python/py/python3 --version): Python 3.10.5