Find Maximum Linear Length of A Solid Body

Is there any way to find (measure) the maximum linear length of a solid body programmingly?

It's not easy. There are functions to find maximum "extents" in a given direction, so you can get the length in this given direction. Then you'd have to do an optimisation where the direction is the variable and the length is the objective function. It can be done, if you have a good optimisation function.

Does this relate to the "length of tube" question that you asked recently? Or are you looking for the dimensions of a "box" that would contain the model in its current form?

Just want to get the dimension of the "box" that covers the part (max linear length, width, and height). Part can be in any shape. This is for something else.

The NXOpen API has the functions .AskBoundingBox, .AskBoundingBoxAligned, and .AskBoundingBoxExact to calculate the bounding box of the model. The .AskBoundingBox method will calculate a box that has edges aligned to the absolute coordinate system. The .AskBoundingBoxAligned will allow you to specify the orientation of the box. There is no API function (that I know of) that will calculate the direction to maximize (or minimize) certain bounding box dimensions. As ciao mentioned, this is a difficult problem to solve.

Thanks!

If you have access to SNAP, it's pretty easy. The Snap.NX.Body class has a "Box" property. I think its aligned with the absolute axes, though. If that's not what you want, ask here again -- there's a workaround for other orientations. Or you could use the NX/Open function.

The ultimate goal is to find the dimensions L x W x H of the "box", Box properties return max and min of X,Y,Z - from the min and max, I guess I could find the max linear distance between the min point and the max point - but how do I go from here to get dimensions L x W x H ?

I think the code in here is okay
http://www.nxjournaling.com/content/creating-bounding-box-arround-solid
- I think it is good enough for me to get some estimated values that I would like to have