# Bevel with specified radius in python script

I think this is kinda simple. I currently make a Bezier curve and set a circle curve as the bevel object.

R = 0.1

curve = bpy.context.active_object

cross_section = bpy.context.active_object

curve.data.bevel_object = cross_section
curve.data.use_fill_caps = True
curve.data.bevel_mode = 'OBJECT'


This is all fine and I can set the circle radius to control the bevel radius. But I would like to make different radii at each end but still specified by a simple parameter:

R_1 = 0.1
R_2 = 0.3


I know this can be done with a taper curve but it not clear how to set the radius with parameters. Is there some simple/obvious/clever way to do this

Assuming you have a bezier curve with only 2 control points and you always want a circle for your shape, you can do this. I think this works, its past my bedtime, but copy paste in the text editor and it should work. Feel free to expand on your wishes.

import bpy

curve = bpy.context.active_object

curve.data.use_fill_caps = True
curve.data.bevel_mode = 'ROUND'     # Gives it a circle shape without needing another object as a profile.
curve.data.bevel_depth = 1          # 1 Meter Radius (NOT DIAMETER)

# These will multipy the curve radius at each control point,
# so best to keep that at 1m and control the taper with these.