NX11+VS2013
#include <uf.h>
#include <uf_curve.h>
#include <uf_vec.h>
UF_initialize();
//创建点1
double Point1[3] = { 10.0, 10.0, 10.0 };
tag_t PointTag1 = NULL_TAG;
UF_CURVE_create_point(Point1, &PointTag1);
//创建点2
double Point2[3] = { 100.0, 100.0, 100.0 };
tag_t PointTag2 = NULL_TAG;
UF_CURVE_create_point(Point2, &PointTag2);
//求两点距离
//方法1(数学方法)
double Distance = sqrt(pow(Point2[0] - Point1[0], 2) + pow(Point2[1] - Point1[1], 2) + pow(Point2[2] - Point1[2], 2));
//方法2(函数UF_VEC3_distance)
double Distance1;
UF_VEC3_distance(Point1, Point2, &Distance1);
//打印
char msg[256];
sprintf_s(msg, "两点之间距离为:%f", Distance);
lw->Open();
lw->WriteLine(msg);
UF_terminate();
Caesar卢尚宇 [email protected]
注:(方法1是看唐工百度传课NX二次开发课程学会的)
NX二次开发-UFUN计算两点距离UF_VEC3_distance
猜你喜欢
转载自blog.csdn.net/lu1287580078/article/details/82915686
今日推荐
周排行