0
$\begingroup$

I am really new to bpy and I wrote this script:

import bpy

for obj in bpy.context.scene.objects:
    if "Sphere" in obj.name:
        bpy.ops.object.gpencil_add(align='WORLD', location=(0, 0, 0), scale=(1, 1, 1), type='LRT_OBJECT')
        bpy.context.object.grease_pencil_modifiers["Line Art"].source_object = bpy.data.objects[obj.name]
        bpy.ops.object.gpencil_modifier_apply(modifier="Line Art")

which adds a GreasePencil with an Object Line Art modifier for each sphere in my scene. I tried to convert each LineArt to a poly curve by adding:

bpy.ops.gpencil.convert(type='POLY')

But i end up with a runtime error that says context is incorrect:

RuntimeError: Operator bpy.ops.gpencil.convert.poll() failed, context is incorrect

How do I correctly convert each LineArt to a PolyCurve?

New contributor
Psyduck Fan is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$
2

0

You must log in to answer this question.

Browse other questions tagged .