NX二次开发UF_MODL_ask_bounding_box 函数介绍

151 阅读2分钟

UF_MODL_ask_bounding_box

Defined in: uf_modl_utilities.h 
int UF_MODL_ask_bounding_box(tag_t object, double bounding_box [ 6 ] )

overview 概述

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.

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.

This function may not return the correct information when the body has been trimmed or is the result of a boolean operation. In those cases UF_MODL_ask_extreme can be used to get the correct bounding box size.


返回线框和实体类型对象的边框。线框对象包括线、弧、样条和二次曲线。实体类型的物体包括主体、面和边。边框值根据对象在零件文件中的位置以绝对坐标值的形式返回。如果使用匹配项调用此函数,则基础几何图形的边框将转换为程序集空间。这可能导致返回的边界框大于预期。这种情况发生在组件部件的轴线转换使得它们不与组装坐标系的轴线对齐的情况下。请注意,返回的框更看重速度而不是准确性。返回的方块会包含给定的实体,而且通常会接近 OBB树,但这并不能保证。这个函数可能不会返回正确的信息时,身体已经修剪或是布尔操作的结果。在这种情况下,可以使用 UF _ MODL _ ask _ 極值来获得正确的边界框大小。

UFUN例子

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

parameters 参数

tag_tobjectInputObject identifier of object to ask bounding box.
要询问边界框的对象标识符。
doublebounding_box [ 6 ]OutputBounding 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
物体边界盒。[0]-最小 x 值[1]-最小 y 值[2]-最小 z 值[3]-最大 x 值[4]-最大 y 值[5]-最大 z 值