UF_MODL_ask_bounding_box函数可以实现包容盒的功能
/******************************************************************************
Returns the bounding box of wireframe and solid type objects.
Wireframe objects include lines, arcs, splines, and conics. Solid type
objects include bodies, faces, and edges. Bounding box values are
returned in absolute coordinate values according to where the object
exists in the part file.
If you call this function with an occurrence, the bounding box
of the underlying geometry is transformed into assembly space. This
may cause the bounding box that is returned to be larger than
expected. This happens in cases when the axes of the component part
are transformed such that they don't align with the axes of the
assembly coordinate system.
Environment: Internal and External
See Also:
History:
******************************************************************************/
extern UFUNEXPORT int UF_MODL_ask_bounding_box(
tag_t object ,/* <I>
Object identifier of object to ask bounding box.
*/
double bounding_box[6] /* <O>
Bounding box of object.
[0] - minimum x value
[1] - minimum y value
[2] - minimum z value
[3] - maximum x value
[4] - maximum y value
[5] - maximum z value
*/
);
但是这个函数得到包容盒在某些情况下比实际的包容盒要大一些,这时这个函数就不太准确了,而且UG也没有提供其他更好的函数,也许要自己运用几何原理自己解决了。 |