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 UF_initialize();
9
10 //在建模里创建点
11 double p1[3] = { 20, 20, 20 };
12 tag_t p1_tag = NULL_TAG;
13 UF_CURVE_create_point(p1, &p1_tag);
14
15 //获得图纸页tag
16 int num_drawings = 0;
17 tag_p_t drawing_tags = NULL_TAG;
18 UF_DRAW_ask_drawings(&num_drawings, &drawing_tags);
19
20 //打开图纸页
21 UF_DRAW_open_drawing(drawing_tags[0]);
22
23 //获得图纸页里的视图tag
24 int num_views = NULL_TAG;
25 tag_p_t view_tag = NULL_TAG;
26 UF_DRAW_ask_views(drawing_tags[0], &num_views, &view_tag);
27
28 //将绝对空间中的点映射到绘图坐标
29 double map_pt[2];
30 UF_VIEW_map_model_to_drawing(view_tag[0], p1, map_pt);
31
32 //转换
33 char msg[256];
34 sprintf_s(msg, "%f,%f", map_pt[0], map_pt[1]);
35
36 //打印
37 UF_UI_open_listing_window();
38 UF_UI_write_listing_window(msg);
39
40 UF_terminate();
41
42 Caesar卢尚宇
43 2019年11月7日