1 #include <uf.h>
2 #include <uf_ui.h>
3 #include <uf_draw.h>
4 #include <uf_view.h>
5 #include <uf_curve.h>
6
7
8
9 UF_initialize();
10
11 //在工程图里创建点
12 double p1[3] = { 106.905267, 139.431151 };
13
14 //获得图纸页tag
15 int num_drawings = 0;
16 tag_p_t drawing_tags = NULL_TAG;
17 UF_DRAW_ask_drawings(&num_drawings, &drawing_tags);
18
19 //打开图纸页
20 UF_DRAW_open_drawing(drawing_tags[0]);
21
22 //获得图纸页里的视图tag
23 int num_views = NULL_TAG;
24 tag_p_t view_tag = NULL_TAG;
25 UF_DRAW_ask_views(drawing_tags[0], &num_views, &view_tag);
26
27 //将绘图空间中的点映射到绝对坐标
28 double model_pt[3];
29 UF_VIEW_map_drawing_to_model(view_tag[0], p1, model_pt);
30
31 //转换
32 char msg[256];
33 sprintf_s(msg, "%f,%f,%f", model_pt[0], model_pt[1], model_pt[2]);
34
35 //打印
36 UF_UI_open_listing_window();
37 UF_UI_write_listing_window(msg);
38
39 UF_terminate();
40
41 Caesar卢尚宇
42 2019年11月7日
NX二次开发-UFUN将工程图中的点映射到建模绝对坐标UF_VIEW_map_drawing_to_model