Skip to content

Instantly share code, notes, and snippets.

@zeffii
Last active October 19, 2018 20:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/e75d4fbccaf585d9a69fc73e47dd1db4 to your computer and use it in GitHub Desktop.
Save zeffii/e75d4fbccaf585d9a69fc73e47dd1db4 to your computer and use it in GitHub Desktop.
import bpy
obj = bpy.context.active_object
if obj.type == 'CURVE':
for subcurve in obj.data.splines:
curvetype = subcurve.type
print('curve type:', curvetype)
if curvetype == 'BEZIER':
print("curve is closed:", subcurve.use_cyclic_u)
# print(dir(subcurve))
for bezpoint in subcurve.bezier_points:
"""
'handle_left_type', # kind of handles
'handle_right_type', #
'hide', # is it hidden?
'radius', # what's the radius
'select_control_point', # is it selected?
'select_left_handle', #
'select_right_handle', #
'tilt' # investigate :)
# use print(dir(bezpoint)) to see all
"""
print('co', bezpoint.co)
print('handle_left', bezpoint.handle_left)
print('handle_right', bezpoint.handle_right)
"""
curve type: BEZIER
curve is closed: False
co <Vector (-1.0000, 0.0000, 0.0000)>
handle_left <Vector (-1.5000, -0.5000, 0.0000)>
handle_right <Vector (-0.5000, 0.5000, 0.0000)>
co <Vector (1.0000, 0.0000, 0.0000)>
handle_left <Vector (0.0000, 0.0000, 0.0000)>
handle_right <Vector (2.0000, 0.0000, 0.0000)>
curve type: BEZIER
curve is closed: False
co <Vector (-0.9387, 1.0064, 0.3927)>
handle_left <Vector (-1.1535, 0.3327, 0.3927)>
handle_right <Vector (-0.7238, 1.6800, 0.3927)>
co <Vector (1.0613, 1.0064, 0.3927)>
handle_left <Vector (0.0613, 1.0064, 0.3927)>
handle_right <Vector (2.0613, 1.0064, 0.3927)>
co <Vector (1.7982, 1.5984, 0.5769)>
handle_left <Vector (2.7749, 1.3839, 0.5769)>
handle_right <Vector (0.8215, 1.8128, 0.5769)>
curve type: BEZIER
curve is closed: True
co <Vector (-0.5928, 2.8779, 1.0686)>
handle_left <Vector (-1.1243, 3.4968, 1.0686)>
handle_right <Vector (-0.0987, 2.3027, 1.0686)>
co <Vector (1.4072, 2.8779, 1.0686)>
handle_left <Vector (0.4072, 2.3980, 1.0686)>
handle_right <Vector (2.3088, 3.3105, 1.0686)>
co <Vector (2.1441, 4.1832, 1.2528)>
handle_left <Vector (3.3460, 3.8087, 1.2528)>
handle_right <Vector (0.0999, 4.8200, 1.2528)>
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment