Curve from objects?

Anyone know if there is a way to create a curve from a array of object origins?

I don’t want to snap each curve point to the objects because in my case there is many.

I probably need a script but thought I’d ask here first.