2
$\begingroup$

I made a small addon for how I block out for sculpting & I want a button to add a NURBS path aligned to the z axis with filled caps and a bevel of O.25. This gets the path, but no bevel:

class MakeTube(bpy.types.Operator):

    bl_idname = "object.make_tube"
    bl_label = "Make Tube"

    def execute(self, context):
     
        bpy.ops.curve.primitive_nurbs_path_add(radius=1, enter_editmode=False, align='WORLD', location=(0, 0, 1), rotation=(0, 1.5708, 0), scale=(1, 1, 1))
        bpy.ops.object.transform_apply(location=False, rotation=True, scale=True)
        bpy.data.curves["NurbsPath"].bevel_depth = 0.25
        bpy.data.curves["NurbsPath"].bevel_resolution = 4
        bpy.data.curves["NurbsPath"].use_fill_caps = True

        return {'FINISHED'}

What am I missing? Thanks!

$\endgroup$

1 Answer 1

2
$\begingroup$

I know it's a name/context thing & I'm not sure why it works but changing

 bpy.data.curves["NurbsPath"]

to:

 bpy.context.object.data

Maybe a python smartie can explain this but it solved the problem. I'm assuming the "NurbsPath" was pointing to a specific object that wasn't updating.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .