NX二次开发UF_MODL_ask_minimum_dist 函数介绍

160 阅读3分钟

UF_MODL_ask_minimum_dist

Defined in: uf_modl.h 
int UF_MODL_ask_minimum_dist(tag_t object1, tag_t object2, int guess1_given, double guess1 [ 3 ] , int guess2_given, double guess2 [ 3 ] , double * min_dist, double pt_on_obj1 [ 3 ] , double pt_on_obj2 [ 3 ] )

overview 概述

UF_MODL_ask_minimum_dist finds the minimum distance between a pair of objects.

 The objects can be:
    1. any combination of points, curves, planes, edges, faces or bodies.
    2. a faceted body and another faceted body or a solid edge, face
       or body or a point

 For objects not listed in 1, the error INVALID_ENTITY_TYPE is returned.

 If an attempt is made to measure between a faceted body and an object
 not listed in 2, the error UNSUITABLE_OBJECT_TYPES is returned.

 The function returns a pair of points (one for each object)
 at which the minimum distance is attained.

 The user can optionally specify a point on or near each object that is
 considered to be a good guess for the nearest point.  The guess point
 is ignored if either object is a faceted or solid body.

 Or, the user can find the distance to specified point coordinates
 by setting the object tag to NULL_TAG and inputting the point coordinates
 as the "guess" point.

 If either of the objects has a tolerance associated with it, the distance
 value may only be acccurate to within that tolerance.

 When a faceted body is involved in the measurement, the result may
 not be as accurate as that obtained with the equivalent solid body.
 It is recommended that UF_MODL_ask_minimum_dist_2 be used in this
 case, as an extra argument is provided to output the accuracy of the
 measurement.


UF _ MODL _ ask _ limit _ dist 查找一对对象之间的最小距离。对象可以是: 1。任何点、曲线、平面、边、面或身体的组合。2.对于未列在1中的对象,返回错误 INVALID _ ENTITY _ TYPE。如果尝试在刻面体和2中未列出的对象之间进行度量,则返回错误 UNSUITABLE _ OBJECT _ TYPES。函数返回一对点(每个对象一个) ,在这对点上达到最小距离。用户可以选择在每个对象上或附近指定一个点,这被认为是对最近点的一个很好的猜测。如果对象是平面体或实体体,则忽略猜测点。或者,用户可以通过将对象标记设置为 NULL _ TAG 并输入点坐标作为“猜测”点来找到到指定点坐标的距离。如果任何一个物体具有与之相关的公差,则距离值可能只在该公差范围内准确。当一个多面体参与测量时,结果可能不如用等效实体得到的结果精确。建议在这种情况下使用 UF _ MODL _ ask _ best _ dist _ 2,因为它提供了一个额外的参数来输出测量的准确性。

UFUN例子

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

parameters 参数

tag_tobject1InputFirst object (if NULL_TAG, the point coordinates in guess1 are used instead)
第一个对象(如果 NULL _ TAG,则使用 guess1中的点坐标)
tag_tobject2InputSecond object (if NULL_TAG, the point coordinates in guess2 are used instead) If object1 and object2 are both NULL_TAG the distance from guess1 to guess2 is computed.
第二个对象(如果是 NULL _ TAG,则使用 guess2中的点坐标)如果 object1和 object2都是 NULL _ TAG,则计算从 guess1到 guess2的距离。
intguess1_givenInput1 - if a guess point for object1 is specified 0 otherwise Ignored if object1 is a body
1-如果对象1的猜测点被指定为0,否则忽略对象1是一个主体
doubleguess1 [ 3 ]InputGuess for the nearest point on object1, or point coordinates to use in the distance computation if object1 is a NULL_TAG. Ignored if object1 is a body.
如果 object1是 NULL _ TAG,则猜测 object1上最近的点,或者在距离计算中使用的点坐标。如果 object1是主体,则忽略它。
intguess2_givenInput1 - if a guess point for object2 is specified 0 otherwise Ignored if object2 is a body
1-如果对象2的猜测点被指定为0,否则忽略对象2是一个主体
doubleguess2 [ 3 ]InputGuess for the nearest point on object2, or point coordinates to use in the distance computation if object2 is a NULL_TAG. Ignored if object2 is a body.
如果 object2是 NULL _ TAG,则猜测 object2上最近的点,或者在距离计算中使用的点坐标。如果 object2是主体,则忽略它。
double *min_distOutputResultant minimum distance.
最小距离。
doublept_on_obj1 [ 3 ]OutputMinimum distance Point on object1.
物体上的最小距离点1。
doublept_on_obj2 [ 3 ]OutputMinimum distance Point on object2.
物体上的最小距离点2。