Orientate an object so that it is "pierced" by a Vector3

Hello,

to better explain what I’m trying to do I realized a (bad)drawing.

I realize that should be an easy thing to do but I’ve been struggling with this for a while.

Thank you in advance.

Maybe you can calculate the bounding box of the object, and then use the boxhelper to calculate the upper and lower centers of the box. You should get the vector you need.