标题: 请教UG编程:对任一物体,做一长方体恰好包住它,如何实现? [打印本页] 作者: jimstill 时间: 2004-10-18 18:57 标题: 请教UG编程:对任一物体,做一长方体恰好包住它,如何实现? 如题所示,这在模具设计、数控加工中是一个很普通的功能,但在UG编程中
如何实现呢?好像没有这方面的命令,有谁做过吗?能否提供一点思路。作者: 深夜摔键盘 时间: 2004-10-18 19:15
能计算出该物体的X,Y,Z的最大值和最小值吗?作者: huashanyjj 时间: 2004-10-18 22:22
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
*/
);