Find the middle of a box

in RobotStudio
Is there a method to find the middle of a box using the SDK? I have a addin that randomly creates variously sized boxes and i want to ensure they are laid flat and that i can align the center of the bag with a frame.
Tagged:
Comments
To do this I've created the box (Body.CreateSolidBox), then using Body.CenterOfGravity & Transformation(s) I am able to calculate where the nearest edge is on a 3D object to place a frame in the centre of the surface ensuring the frame created at the centre of the box is alway aligned with a frame. End result shown below;