Anyone have a good function to find the longest dimension of a solid? I know we can use the bounding box to find the longest dimension along any given axis, but we are looking for the absolute longest measurement NOT along any particular axis known in advance.
Solved! Go to Solution.
After thinking this over a bit more and experimenting, I think I might have a solution:
1. Create a bounding sphere passing through the bounding box points
2. Find minimum distance from sphere to body
3. Find the maximum distance between the min distance point on the body and the body
I think a dumb/smart way is to do Measure "Between Objects Sets". For Start Object and and End Object select the same Body. If you put the setting for Distance: Maximum it should give you the maximum measurment.
I tried it on a free form part ( 2x2 cm with 1000 surfaces) and it looks ok. (I can't show that)
The bottom is one of the NX courses parts
I found an even easier method:
MeasureDistance maxDst = WrkPrt.MeasureManager.NewDistance(null, MeasureManager.MeasureType.Maximum, bod, bod);
NxSes.ListingWindow.WriteFullline("Maximum Distance is " + maxDst.Value.ToString("F3"));