How can I play a blend space 1d from code?

Custom Animation Blueprint

You need a custom animation blueprint class (anim instance)

then you can create a variable that you interpolate in the code, to connect to the 1D Blend Space

In code, obtain your custom anim instance from the character

and then interpolate your custom variable which is attached to the 1D blendspace in The Animation Blueprint

UYourAnimInstance * Animation = 
  Cast<UYourAnimInstance>( Mesh->GetAnimInstance() );
if(!Animation) return;
 
Animation->BlendAlpha = FMath::FInterpTo(Animation->BlendAlpha,1,GDeltaTime,7);

#Wiki tutorial

Rama