0
$\begingroup$

From what I've gathered, if my objective is to import an SVG file as a Grease Pencil layer in Blender, one viable strategy seems to be importing the SVG as curves first, then making subsequent modifications to simulate the functionality available through the user interface:

bpy.ops.import_curve.svg(filepath='', filter_glob='*.svg')

Alternatively, I could potentially create an addon that activates this corresponding C code which is available in the Blender source on GitHub:

https://github.com/blender/blender/blob/main/source/blender/editors/io/io_gpencil_import.cc

I'm curious though, are these two methods the only pathways to replicate the UI-based import operation through scripting? I'm open to any insights or alternative suggestions.

$\endgroup$

1 Answer 1

0
$\begingroup$

https://docs.blender.org/api/current/bpy.ops.object.html#bpy.ops.object.convert

convert to grease pencil bpy.ops.gpencil.convert(target='GPENCIL')

$\endgroup$
1
  • $\begingroup$ Hi, thanks for the post. This site is not a regular forum, answers should be substantial, stand on their own, and thoroughly explain the solution and required steps. One liners and short tips rarely make for a good answer. If you can edit your post and provide some more details about the procedure and how it works, perhaps add a few images illustrating some steps and final result. See How to write a good answer?, otherwise it may be converted to a comment. $\endgroup$ Jul 22, 2023 at 14:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .