While making this image, I needed a fast way to adjust Curve handles for the Minolta logo. Blender doesn't have exactly what I need so I propose something like
import bpy
from mathutils import Vector
def adjust_bezier_controls(instruction='average'):
'''
W -> resize longest
W -> resize shortest
W -> normalize
W -> average
'''
bpy.ops.object.mode_set(mode = 'OBJECT')
ao = bpy.context.active_object
if not ao.type == 'CURVE':
return
active_spline = ao.data.splines.active
for s in active_spline.bezier_points:
if not (s.select_control_point and s.select_left_handle and s.select_right_handle):
continue
else:
distance_1 = (s.co - s.handle_left).length
distance_2 = (s.co - s.handle_right).length
if instruction == 'average':
avg = (distance_1 + distance_2) / 2
s.handle_left = s.co.lerp(s.handle_left, avg / distance_1)
s.handle_right = s.co.lerp(s.handle_right, avg / distance_2)
# break
bpy.ops.object.mode_set(mode = 'EDIT')
adjust_bezier_controls(instruction='average')
Which will be the first Curve Specials item for tinyCAD :)
While making this image, I needed a fast way to adjust Curve handles for the Minolta logo. Blender doesn't have exactly what I need so I propose something like
Which will be the first Curve Specials item for tinyCAD :)