In a previous version of blender I had script that applied a bevel to a curve, but now cannot get it to work in 2.92. or above. I want to apply the bevel to an object referenced by the variable curveOB1 and have tried the following.
bpy.data.objects[curveOB1.name].select_set(True)
bpy.context.object.data.bevel_mode = 'OBJECT'
bpy.context.object.data.bevel_object = bpy.data.objects['BezCirc-001']
Everything else in my script works but the above, seems to do nothing and no errors. As an alternative I have aslo tried
bpy.ops.object.select_pattern(pattern=curveOB1.name) in place of the first line.
The old code was:
bpy.context.scene.objects.active = curveOB1
bpy.context.object.data.bevel_object = bpy.data.objects['BezCirc-001']
This gives an error on the first line.
If I use the object data properties manually it works fine.
Any help would be appreciated.
John
bpy.data.objects[curveOB1.name].select_set(True)orbpy.ops.object.select_pattern(pattern=curveOB1.name)not work when they also apprear to select the object and allow it to be manipulated. As inbpy.ops.object.select_pattern(pattern=curveOB1.name) bpy.ops.transform.translate(value=(displaceX, 0, 0))– John Jan 05 '23 at 10:07poll()method is used to prevent operators being executed in invalid scenarios. Typically operators are executed through UI interaction. So while it might be possible to change the selection state for objects using an operator in a particular context, other operators might not be available. – user2431714 Jan 05 '23 at 19:29