Building an assembly to animate a unit vector in space.


import bpy, math


#An assembly to animate the rotation 
#and magnitude of a vector in space
bpy.ops.mesh.primitive_cylinder_add( 
vertices=32,radius=0.01,depth=1, location=(.5,0,0),
rotation=(0,math.pi/2,0) 
);
cylinder=bpy.context.active_object;
bpy.context.scene.cursor_location = (0.0, 0.0, 0.0);
bpy.ops.object.origin_set(type='ORIGIN_CURSOR');
bpy.ops.object.transform_apply(rotation=True);
        
bpy.ops.mesh.primitive_cone_add( 
rotation=(0,math.pi/2,0), location=(1,0,0),
radius1=0.025, depth=0.2
);
cone=bpy.context.active_object;
bpy.ops.object.transform_apply(rotation=True);


bpy.ops.object.empty_add(type='PLAIN_AXES');
axis=bpy.context.active_object;
axis.location=(1,0,0);
axis.parent=cylinder;
bpy.ops.object.select_all(action='DESELECT');


constraint = cone.constraints.new('COPY_LOCATION');
constraint.target=axis;
constraint = cone.constraints.new('COPY_ROTATION');
constraint.target=axis;
constraint.use_offset=True;

An assembly I created consisting of a cylinder a cone and an empty and two constraints for location and rotation of the empty. The X axis of the cylinder can now be scaled and the cylinder rotated to represent the coordinates of a vector that it is possible to animate with some key frames.

Is it possible with Blender to somehow combine the assembly consisting of the three objects into some form that acts as one? I am familiar with groups however I am not sure if that is the construct that I specifically am looking for. For instance I would like to be able to clone the assembly with the constraints as well and be able to create multiple copies of the assembly that could potentially be named: Vec1,Vec2,Vec3 etc. Currently I have to see each individual object such as cylinder, cone and empty in the Outliner and it seems that doing things this way seems cluttered.

Thank you.


Hum,
Try to model the “assembly” or at least you can join the cylinder and cone into one object.
For the empty you can’t join it with the mesh object.