Figured it out in case anyone else is looking to do this.
The block before "combinedbodies.orientedMinimumRangeBox" is from here.
Sub Main()
Dim oApp As Inventor.Application
oApp = ThisApplication
Dim oActiveSheet As Sheet
oActiveSheet = oApp.ActiveDocument.ActiveSheet
Dim oBaseView As DrawingView
oBaseView = oActiveSheet.DrawingViews.Item(1)
Dim oDoc As Document = oBaseView.ReferencedDocumentDescriptor.ReferencedDocument
If oDoc.DocumentType = Inventor.DocumentTypeEnum.kPartDocumentObject Then
' Get the current Part document.
Dim partDoc As PartDocument = oBaseView.ReferencedDocumentDescriptor.ReferencedDocument
' Get the TransientBRep and TransientGeometry objects.
Dim transBRep As TransientBRep = oApp.TransientBRep
Dim transGeom As TransientGeometry = oApp.TransientGeometry
' Combine all bodies in Part into a single transient Surface Body.
Dim combinedBodies As SurfaceBody = Nothing
For Each surfBody As SurfaceBody In partDoc.ComponentDefinition.SurfaceBodies
If combinedBodies Is Nothing Then
combinedBodies = transBRep.Copy(surfBody)
Else
transBRep.DoBoolean(combinedBodies, surfBody, BooleanTypeEnum.kBooleanTypeUnion)
End If
Next
' Get the oriented minimum range box of all bodies in Part.
' NOTE: "OrientedMinimumRangeBox" was added in Inventor 2020.3/2021.
Dim minBox As OrientedBox = combinedBodies.OrientedMinimumRangeBox
' Get the corner points of the oriented minimum range box.
Dim cornerPoints As Point() = {
transGeom.CreatePoint(minBox.CornerPoint.X + minBox.DirectionOne.X, minBox.CornerPoint.Y + minBox.DirectionOne.Y, minBox.CornerPoint.Z + minBox.DirectionOne.Z),
transGeom.CreatePoint(minBox.CornerPoint.X + minBox.DirectionOne.X + minBox.DirectionTwo.X, minBox.CornerPoint.Y + minBox.DirectionOne.Y + minBox.DirectionTwo.Y, minBox.CornerPoint.Z + minBox.DirectionOne.Z + minBox.DirectionTwo.Z)
}
Dim Horiz As Point() = {
transGeom.CreatePoint(minBox.CornerPoint.X + minBox.DirectionOne.X + minBox.DirectionOne.X, minBox.CornerPoint.Y + minBox.DirectionOne.Y, minBox.CornerPoint.Z + minBox.DirectionOne.Z)}
angle = ThisApplication.MeasureTools.GetAngle(cornerpoints(1), cornerpoints(0), Horiz(0))
'MessageBox.Show(angle)
'True = Clockwise
oBaseView.RotateByAngle(angle, True)
Else
MessageBox.Show("Reference is not a part document")
End If
oActiveSheet.Update()
End Sub