Script to set Taper and Bevel to multiple objects

Hi,
I found an old script to do this but I think it’s missing something. (Or I am.) I’m struggling with Bpy and can’t get it to work.


Import bpy

scn = bpy.context.scene
# get a list of of curve objects


curves = [ob for ob in scn.objects if ob.type == 'Curves']


for curveOb in curves:
    if (curveOb.getName() not in ["Taper","Bevel"]):
        curve = curveOb.getData()
        curve.setFlag(1) # set curve to 3d
        curve.setBevOb(Object.Get("Bevel")) # set the Bevel Object
        curve.setTaperOb(Object.Get("Taper")) # set the taper object


that really looks like Blender 2.4x, things work really differently nowadays:

import bpy

scn = bpy.context.scene
# get a list of of curve objects


curves = [ob for ob in scn.objects if ob.type == 'CURVE']


for curveOb in curves:
    if curveOb.name not in ("Taper", "Bevel"):
        curve = curveOb.data
        curve.dimensions = '3D'
        curve.bevel_object = bpy.data.objects.get("Bevel") # set the Bevel Object
        curve.taper_object = bpy.data.objects.get("Taper") # set the taper object

Thanks for the tip CoDEmanX. Perhaps that explains some of my difficulty in understanding Blender scripting; I’m looking at old script examples and tutorials.

Can you point me to script examples that might help me understand how to modify multiple objects?

Many thanks again CoDEmanX. There are a few pages there that I hadn’t found yet and that would be helpful for someone wanting to do what most people want to do with Blender - architecture, vehicles, animation, etc.

I am, however, trying to use Blender (and Python) to create one kind of design element only: tapered curves.

After much poking about I’m beginning to think perhaps this isn’t a job for a script. The new Blender seems to offer new ways of changing objects with Constraints and Modifiers. Or maybe Parent.

Can you give me a hint? Or tell me how the old 2.4 script would need to change?

Thanks.

Duh! Just discovered I could apply TaperOb and BevelOb after Joining all the curves.