So you have the confusion of how to calculate the distance between two points, and which method to use. Think of it like this:
1. If you use the method your code shows, where you break down 2 points into their 3 components (x,y,z) and then calculated the total distance, you will definitely get a ORIGIN based bounding box.
2. If you use a different method (point1.distanceto(point2)), you will get a direct calculation between two points.
Since your two points are in 3D space, you want to get distances from 2 dimensions, you need to create points that eliminate the third dimension per 'work plane' of interest. Example:
dim pXYMin as point = tg.createpoint(minPoint.x,minpoint,x,0) 'see we only drop the z value
dim pXYMax as point = tg.createpoint(maxPoint.x,maxpoint.y,0)
dim distXY as double = pxymin.distanceto(pxymax)
'repeat for yz, and xz where you drop the x value then the y value.
Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/