Seeking better way to add precise hemispherical caps to a swept curve Given an arbitrary curve swept with a circular profile of a specific radius and side count (controlled using the Depth and Resolution parameters of the curve's Geometry), is there a reasonably efficient way to add hemispherical caps of the same radius to each end of the swept curve to produce an arbitrarily curved capsule shape?

The desired result is the 3D equivalent of this (please see the Blender screenshot lower down as well):



My definition of "reasonably efficient" is "more efficient than my current procedure", which is:


Add a Bezier curve and modify it as desired.
Under Object Data Properties, set the curve's Depth to the desired radius R and its Resolution such that the desired side count C is obtained (e.g., a resolution of 2 gives 8 sides).
Convert the curve into a mesh (I'll refer to this as the tube mesh).
Add a UV sphere with C segments, C rings, and a radius of R.
Delete the bottom half of the UV sphere, leaving a hemisphere.
Select the edge loop at one end of the tube mesh, create a face, create a transform orientation named "End of tube 1" (for example), and delete the face. (Note that creating a transform orientation with the edge loop selected is not sufficient: the resulting transform orientation is based on the active edge only.)
Select the hemisphere and perform the Align to Transform Orientation operation with "End of tube 1" as the target orientation.
Select the edge loop at one end of the tube mesh and perform the Cursor to Selected operation.
Select the hemisphere and perform the Selection to Cursor operation.
Rotate the hemisphere by an appropriate angle about the Z axis of the "End of tube 1" transform. For example, with C = 8, the angle is 22.5 degrees because 360 degrees/8 sides = 45 degrees per side, which is then divided by two since the hemisphere's rotation is off by half the angular extent of one side relative to the end of the tube.)
Join the hemisphere to the tube, select all vertices, and merge By Distance. This removes the C duplicates where the hemisphere and the tube meet.
Repeat steps 4 through 11 to add a hemispherical cap to the other end of the tube.


Here's a screenshot of a blend file containing all the steps (from left to right along the global X axis; two empties mark steps 6 and 8, although only one is visible in the screenshot):


I'm hoping there's a quicker way to achieve the same result. I've tried using the bevel tool (as suggested in this answer), but it requires cleanup at the convergence point when the bevel distance is set to R.
Maybe, instead of the native curve bevel, you can use Array and Curve modifiers on a profile segment ..(blue section, below)



The array can have 'Start' and 'End' caps (red and yellow). It's easier to use Constant Offset in the array. Adjust (here, in  Z,) the positions of the caps in Edit Mode, until the  'Merge' in the array takes, before giving the array a Curve modifier.

You can set the count of the array to fit the curve, and parent the curve to the mesh to keep it all together.

This is reasonably reusable, the curve and array can be duplicated together, and the curve edited as you like, the caps will stay in place.

If / When you want to fix the mesh, you can Header > Object > Convert To > Mesh, which will apply all the modifiers at once.