NX二次开发-UFUN计算两点距离UF_VEC3_distance

时间:2023-03-10 05:06:35
NX二次开发-UFUN计算两点距离UF_VEC3_distance
     NX11+VS2013

     #include <uf.h>
#include <uf_curve.h>
#include <uf_vec.h> UF_initialize(); //创建点1
double Point1[] = { 10.0, 10.0, 10.0 };
tag_t PointTag1 = NULL_TAG;
UF_CURVE_create_point(Point1, &PointTag1); //创建点2
double Point2[] = { 100.0, 100.0, 100.0 };
tag_t PointTag2 = NULL_TAG;
UF_CURVE_create_point(Point2, &PointTag2); //求两点距离 //方法1(数学方法)
double Distance = sqrt(pow(Point2[] - Point1[], ) + pow(Point2[] - Point1[], ) + pow(Point2[] - Point1[], )); //方法2(函数UF_VEC3_distance)
double Distance1;
UF_VEC3_distance(Point1, Point2, &Distance1); //打印
char msg[];
sprintf_s(msg, "两点之间距离为:%f", Distance);
lw->Open();
lw->WriteLine(msg); UF_terminate(); Caesar
注:(方法1是看唐工百度传课NX二次开发课程学会的)

NX二次开发-UFUN计算两点距离UF_VEC3_distance