NX二次开发UF_MODL_ask_bounding_box_exact 函数介绍

259 阅读2分钟

UF_MODL_ask_bounding_box_exact

Defined in: uf_modl_utilities.h 
int UF_MODL_ask_bounding_box_exact(tag_t object, tag_t csys_tag, double min_corner [ 3 ] , double directions [ 3 ] [ 3 ] , double distances [ 3 ] )

overview 概述

Returns the bounding box information of wireframe and solid type objects aligned to a CSYS.

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 and aligned to the input CSYS.

If you call this function with an occurrence, the bounding box of the underlying geometry is transformed into assembly space.

Use occurrence object tags when working in an assembly context and prototype object tags when working in non-assembly situations. Passing in a prototype object tag when in an assembly may produce undesired results.

The csys_tag should always be in the context of the current work part.

To derive the corner points, use the X,Y,X components of the min_corner and then add the X,Y,Z components of the directions multiplied by the X,Y,Z distances. For Example, to derive the 2 corner points: corner_pts[2][3]

corner_pts[0][0] = min_corner[0] corner_pts[0][1] = min_corner[1] corner_pts[0][2] = min_corner[2] for i = 0 -> 2 inclusive corner_pts[1][i] = min_corner[i] for j = 0 -> 2 inclusive corner_pts[1][i] += directions[j][i] distances[j]

While a more accurate box is produced, processing time may be increased significantly.


返回与 CSYS 对齐的线框和实体类型对象的边界框信息。线框对象包括线、弧、样条和二次曲线。实体类型的物体包括主体、面和边。边框值根据对象在零件文件中的位置以绝对坐标值返回,并与输入的 CSYS 对齐。如果使用匹配项调用此函数,则基础几何图形的边框将转换为程序集空间。在程序集上下文中工作时使用匹配对象标记,在非程序集情况下工作时使用原型对象标记。在程序集中传入原型对象标记可能会产生不希望的结果。Csys _ tag 应该始终位于当前工作部件的上下文中。为了得到角点,使用 min _ 隅的 X,Y,X 分量,然后加上方向的 X,Y,Z 分量乘以 X,Y,Z 距离。例如,为了得到2个角点: 对于 i = 0-> 2个包含的拐角点[1][ i ] = min _ Corner [ i ]对于 j = 0-> 2个包含的拐角点[1][ i ] + = 方向[ j ][ j ] ,当生成一个更精确的盒子时,处理时间可能会显著增加。

UFUN例子

获取源码例子请搜索 里海NX二次开发3000例专栏

parameters 参数

tag_tobjectInputObject identifier of object to ask bounding box.
要询问边界框的对象标识符。
tag_tcsys_tagInputCSYS to use for box alignment. NULL_TAG - Use Work CSYS
使用 CSYS 进行盒子对齐
doublemin_corner [ 3 ]OutputMinimum corner of box of object. [0] - minimum x value [1] - minimum y value [2] - minimum z value
物体盒子的最小角。[0]-最小 x 值[1]-最小 y 值[2]-最小 z 值
doubledirections [ 3 ] [ 3 ]Output: direction vectors of bounding box [0][] - X Direction [1][] - Y Direction [2][] - Z Direction
: 包围盒的方向向量[0][]-X 方向[1][]-Y 方向[2][]-Z 方向
doubledistances [ 3 ]OutputDistances to move along directions of CSYS to derive all points of the bounding box. [0] - X distance value [1] - Y distance value [2] - Z distance value
沿 CSYS 方向移动的距离,以求出包围盒的所有点。- X 距离值[1]-Y 距离值[2]-Z 距离值