1     NX11+VS2013
 2     
 3     #include <uf.h>
 4     #include <uf_curve.h>
 5     #include <uf_vec.h>
 6     
 7     UF_initialize();
 8 
 9     //创建点1
10     double Point1[3] = { 10.0, 10.0, 10.0 };
11     tag_t  PointTag1 = NULL_TAG;
12     UF_CURVE_create_point(Point1, &PointTag1);
13 
14     //创建点2
15     double Point2[3] = { 100.0, 100.0, 100.0 };
16     tag_t  PointTag2 = NULL_TAG;
17     UF_CURVE_create_point(Point2, &PointTag2);
18     
19     //求两点距离
20 
21     //方法1(数学方法)
22     double Distance = sqrt(pow(Point2[0] - Point1[0], 2) + pow(Point2[1] - Point1[1], 2) + pow(Point2[2] - Point1[2], 2));
23 
24     //方法2(函数UF_VEC3_distance)
25     double  Distance1;
26     UF_VEC3_distance(Point1, Point2, &Distance1);
27 
28     //打印
29     char msg[256];
30     sprintf_s(msg, "两点之间距离为:%f", Distance);
31     lw->Open();
32     lw->WriteLine(msg);
33 
34     UF_terminate();
35 
36     Caesar
37     注:(方法1是看唐工百度传课NX二次开发课程学会的)

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

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-19
  • 2021-12-11
  • 2022-12-23
  • 2022-12-23
  • 2022-01-28
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案