I can make a curve with python, but I'd like to convert that curve into a renderable tube. In blender 2.6 and up, I can just select the "Fill Mode" of the curve as "full", change the "Preview U" and "Bevel" properties, and I haz a tube.

How I can I do that in python?


This script will add a new bezier curve, and set its bevel and resolution properties:

import bpy


c = bpy.context.object

c.data.resolution_u     = 24     # Preview U
c.data.fill_mode        = 'FULL' # Fill Mode ==> Full
c.data.bevel_depth      = 0.02   # Bevel Depth
c.data.bevel_resolution = 4      # Bevel Resolution

On a more general note, Blender can help you find the Python API commands and properties for doing most anything. When you hover with your mouse cursor on a property in the UI, you'll see a tooltip message, that includes the Python API at the bottom (in the example below I placed the cursor over the Bevel Depth property):


Also, the online API documentation is your best friend. There's a convenient search box on the left menu, that will get you all kinds of useful stuff if you type in "curve bevel", for instance.

  • $\begingroup$ @nbubis - Need to note that I fixed a little bug there with the curve object reference $\endgroup$ – TLousky Dec 3 '15 at 16:30

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.