1
$\begingroup$

I want to get a position and handle the type of specific spline

enter image description here

as you know there are some types

enter image description here

for example, I want to get point 1 type and position

position = Vector(2.0, 0.0, 0.0)
type = 'ALIGNED'
$\endgroup$

1 Answer 1

2
$\begingroup$

based on bezier spline point documentation and this useful blog

you can get the position of handle by handle_left and handle_right

Handl positions handle_left handle_right

you can get handle type by handle_left_type and handle_right_type

Handle types

 enum in [‘FREE’, ‘VECTOR’, ‘ALIGNED’, ‘AUTO’], default ‘FREE’

so you can get them easily

import bpy

# Type of the first handle        
print(bpy.data.curves['BezierCurve'].splines[0].bezier_points[0].handle_left_type)

# Type of the second handle
print(bpy.data.curves['BezierCurve'].splines[0].bezier_points[0].handle_right_type)

# Coordinates of the first handle 
print(bpy.data.curves['BezierCurve'].splines[0].bezier_points[0].handle_left)

# Coordinates of the second handle
print(bpy.data.curves['BezierCurve'].splines[0].bezier_points[0].handle_right)

enter image description here

$\endgroup$
3
  • $\begingroup$ Consider for the second part of code using the python console, which will echo the value. $\endgroup$
    – batFINGER
    Commented Aug 22, 2020 at 17:17
  • $\begingroup$ @batFINGER I attached an Image as you can see it works on console $\endgroup$ Commented Aug 23, 2020 at 5:31
  • 1
    $\begingroup$ Can select and copy text from console. Simply typing in the path eg D.curves['BezierCurve'].splines[0].bezier_points[0].handle_rightwill echo result back to console. $\endgroup$
    – batFINGER
    Commented Aug 23, 2020 at 6:45

You must log in to answer this question.

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