NX二次开发-射线交点

函数:UF_MODL_trace_a_ray()

函数说明:打射线,找交点。

用法:

 1 #include "Text.h"
 2 
 3 #include <stdio.h>
 4 #include <uf.h>
 5 #include <uf_part.h>
 6 #include <uf_defs.h>
 7 #include <uf_modl.h>
 8 void ufusr(char *param, int *retcode, int param_len)
 9 {
10     UF_initialize();
11     tag_t tagBody[2] = { 45071,138371};
12     double douPoint[3] = { 0.0,0.0,0.0 };
13     double douRaydir[3] = { 0.0,1.0,0.5 };
14     double transform[16] = { 1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0 };
15     int     hits_found;
16     UF_MODL_ray_hit_point_info_p_t  hit_list;
17     UF_MODL_trace_a_ray(2, tagBody, douPoint, douRaydir, transform, 0, &hits_found, &hit_list);
18     for (int i = 0; i < hits_found; i++)
19     {
20         tag_t tagPoint;
21         UF_CURVE_create_point(hit_list[i].hit_point, &tagPoint);
22     }
23     UF_terminate();
24 }
25 
26 int ufusr_ask_unload(void)
27 {
28     return (UF_UNLOAD_IMMEDIATELY);
29 }

效果:

 

posted @ 2020-08-28 17:27  王牌飞行员_里海  阅读(50)  评论(0编辑  收藏  举报