UF_MODL_ask_bounding_box_aligned
Defined in: uf_modl_utilities.h
int UF_MODL_ask_bounding_box_aligned(tag_t object, tag_t csys_tag, logical expand, 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.
Due to distance and angle tolerances, the data returned cannot be guaranteed to be larger than the original object. The expand parameter allows for an expanded box to be created. The expand option will expand the box in all directions by a factor of 0.1 of the prototype part units.
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]
Note that the box returned favors speed over accuracy. The returned box will contain the given entity and it will usually be close to the minimum bounding box but this is not guaranteed.
返回与 CSYS 对齐的线框和实体类型对象的边界框信息。线框对象包括线、弧、样条和二次曲线。实体类型的物体包括主体、面和边。边框值根据对象在零件文件中的位置以绝对坐标值返回,并与输入的 CSYS 对齐。如果使用匹配项调用此函数,则基础几何图形的边框将转换为程序集空间。在程序集上下文中工作时使用匹配对象标记,在非程序集情况下工作时使用原型对象标记。在程序集中传入原型对象标记可能会产生不希望的结果。Csys _ tag 应该始终位于当前工作部件的上下文中。由于距离和角度公差,不能保证返回的数据大于原始对象。扩展参数允许创建扩展框。扩展选项将扩展盒子在所有方向的0.1倍的原型零件单位。为了得到角点,使用 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 ]距离[ j ]注意,盒子返回的结果偏重于速度而不是准确性。返回的方块会包含给定的实体,而且通常会接近 OBB树,但这并不能保证。
UFUN例子
获取源码例子请搜索 里海NX二次开发3000例专栏
parameters 参数
| tag_t | object | Input | Object identifier of object to ask bounding box. 要询问边界框的对象标识符。 |
| tag_t | csys_tag | Input | CSYS to use for box alignment. NULL_TAG - Use Work CSYS 使用 CSYS 进行盒子对齐 |
| logical | expand | Input | Expand the box to increase enclosure coverage FALSE - Do not expand TRUE - Expand 展开该框以增加外壳覆盖范围 FALSE-不要展开 TRUE-展开 |
| double | min_corner [ 3 ] | Output | Minimum corner of box of object. [0] - minimum x value [1] - minimum y value [2] - minimum z value 物体盒子的最小角。[0]-最小 x 值[1]-最小 y 值[2]-最小 z 值 |
| double | directions [ 3 ] [ 3 ] | Output | : direction vectors of bounding box [0][] - X Direction [1][] - Y Direction [2][] - Z Direction : 包围盒的方向向量[0][]-X 方向[1][]-Y 方向[2][]-Z 方向 |
| double | distances [ 3 ] | Output | Distances 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 距离值 |