Did you see the code from @JamieVJohnson2 in this post:
https://forums.autodesk.com/t5/inventor-customization/bounding-box-with-the-ucs-origin/m-p/8505370/h...
i altered his code slightly and i think it does what you want
Dim partDoc As PartDocument = ThisApplication.ActiveDocument
'get 3d solid
Dim sb As SurfaceBody = partDoc.ComponentDefinition.SurfaceBodies.Item(1)
'get custom user coordinate system
Dim ucs As UserCoordinateSystem = partDoc.ComponentDefinition.UserCoordinateSystems(1)
'create a list of points (for sorting)
Dim vPoints As New List(Of Point)
'get the transformation matrix from the usc (what it takes to translate from user ucs to origin)
Dim mat As Matrix = ucs.Transformation
'invert the matrix (what it takes to translate from origin to user ucs)
mat.Invert()
'cycle through all the points
For Each vert As Vertex In sb.Vertices
'get the point data from the vertex
Dim p As Point = vert.Point
'invert translate the point data (from origin to user ucs)
p.TransformBy(mat)
'add translated point to collection
vPoints.Add(p)
Next
Dim tg = ThisApplication.TransientGeometry
'create empty min and max points
Dim minPoint As Point = tg.CreatePoint(0, 0, 0)
Dim maxPoint As Point = tg.CreatePoint(0, 0, 0)
'sort points based on x values, and get lowest and highest value
vPoints.Sort(Function(x, y) x.X.CompareTo(y.X))
minPoint.X = vPoints.First.X
maxPoint.X = vPoints.Last.X
'sort points based on y values, and get lowest and highest values
vPoints.Sort(Function(x, y) x.Y.CompareTo(y.Y))
minPoint.Y = vPoints.First.Y
maxPoint.Y = vPoints.Last.Y
'sort points based on z values, and get lowest and highest values
vPoints.Sort(Function(x, y) x.Z.CompareTo(y.Z))
minPoint.Z = vPoints.First.Z
maxPoint.Z = vPoints.Last.Z
Dim sizeX As Double = Math.Abs(maxPoint.X - minPoint.X)
Dim sizeY As Double = Math.Abs(maxPoint.Y - minPoint.Y)
Dim sizeZ As Double = Math.Abs(maxPoint.Z - minPoint.Z)
Dim outerDim As String = String.Format("{0} x {1} x {2}", sizeX*10, sizeY*10, sizeZ*10)
iProperties.Value("Project", "Description") = outerDim
MsgBox("see iproperty description: " & outerDim)
.
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Blog: hjalte.nl - github.com