0
$\begingroup$

the circumstance is that I trigger "GPencil Convert to Curve" operator then it creates a Curve Object deriving from selected Grease Pencil Object,

and also change Bevel depth for the Curve Object

but how do pick the Curve Object

$\endgroup$
0
$\begingroup$

Try this(I am on Blender 2.81a):

(set grease pencil object name to "Stroke")

import bpy

# De-select all
bpy.ops.object.select_all(action='DESELECT')

# Make blender think you are in a 3D drawing area
context = bpy.context.copy()
for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        for region in area.regions:
            if region.type == 'WINDOW':
                context['area'] = area
                context['region'] = region
                break
        break

# The grease pencil must be active (name = Stroke)
context['active_object'] = bpy.data.objects['Stroke']

# Convert(create a new curve) grease pencil
bpy.ops.gpencil.convert(context, type='CURVE', use_timing_data=True)

# New curve will be the only selected object
obj_curve = bpy.context.selected_objects[0]
obj_curve.data.bevel_depth = 0.04
obj_curve.data.bevel_resolution = 8

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.