Bootstrap

C# NX二次开发:拉伸UFUN函数避坑指南

大家好,今天想说一下拉伸相关UFUN函数的使用,尽量让大家别踩坑。

官方给出的拉伸UFUN函数有如下几个:

(1)UF_MODL_create_extruded2 (view source)

uf_list_p_tobjectsInputList of objects to be extruded.
char *taper_angleInputTaper angle (in degrees).
char *limit [ 2 ]InputLimit of extrusion. This is declared as:
char limit[2]. The first value is the start value of
the extrusion and the second value is the end of the
extrusion (see the example program).
doublepoint [ 3 ]Inputnot used
doubledirection [ 3 ]InputExtrusion axis.
UF_FEATURE_SIGNsignInputThe sign of the operation to be performed.
UF_NULLSIGN = create new target solid
UF_POSITIVE = add to target solid
UF_NEGATIVE = subtract from target solid
UF_UNSIGNED = intersect with target solid
uf_list_p_t *featuresOutput to UF_*free*List of feature identifiers created. This list
must be freed by calling UF_MODL_delete_list.

这个方法的参数分为为:

第一个参数为要进行拉伸的对象集合。

第二个参数为锥度,一般给0

第三个参数为拉伸的范围,数组中第一个值给0,第二个值自己想拉伸多少给多少。

第四个参数为点位,是一个三维的double数组固定给0,0,0就行。

第五个参数为拉伸的矢量方向,也是一个三维的double数组

第六个参数为拉伸的布尔计算方式,有无、减去、增加等

第七个参数为返回的特征数组。

这里面要注意的是第六个参数,如果使用的是布尔减,这个方法中是不能传入目标体的,所以只有当你这个模型中只有一个体的时候才会好用。

如果模型中有多个体就无法使用了。

(2)UF_MODL_create_extruded1 (view source)

uf_list_p_tobjectsInputList of objects to be extruded.
char *taper_angleInputTaper angle (in degrees).
char *limit [ 2 ]InputLimit of extrusion. This is declared as:
char limit[2]. The first value is the start value of
the extrusion and the second value is the end of the
extrusion (see the example program).
doublepoint [ 3 ]Inputnot used
doubledirection [ 3 ]InputExtrusion axis.
UF_FEATURE_SIGNsignInputThe sign of the operation to be performed.
UF_NULLSIGN = create new target solid
UF_POSITIVE = add to target solid
UF_NEGATIVE = subtract from target solid
UF_UNSIGNED = intersect with target solid
tag_ttarget_bodyInputTarget body to perform Boolean
uf_list_p_t *featuresOutput to UF_*free*List of feature identifiers created. This list
must be freed by calling UF_MODL_delete_list.

可能大家也注意到了这里面多了一个传入目标体的参数,这个时候大家可能以为这就是解决了上面所说的那个问题了,我当时也是这样认为的,可到了使用的时候才知道,你传入的Tag值也不起作用,这个API是有问题的。

在这里我提前帮大家踩坑了,大家就不用浪费时间了。

今天要讲的就是这么多,我们下篇文章再见。

散会