How to snap pivot to the edge of the mesh automatically?

Title pretty much sums it up, I’m asking if there’s a way to snap the pivot to the edge of a static mesh and not manually.