NX二次开发-UFUN获取工程图的数量和tag UF_DRAW_ask_drawings
作者:互联网
1 NX9+VS2012 2 3 #include <uf.h> 4 #include <uf_draw.h> 5 #include <uf_part.h> 6 #include <uf_ui.h> 7 8 9 10 UF_initialize(); 11 12 //新建工程图(A4图纸) 13 char* DrawingName = "ABC";//设置图纸名字 14 UF_DRAW_info_t DrawingInfo;//设置图纸大小、投影视角、视图比例等 15 DrawingInfo.size_state = UF_DRAW_METRIC_SIZE;//设置图纸类型 16 DrawingInfo.size.metric_size_code = UF_DRAW_A4;//设置图纸大小 17 DrawingInfo.drawing_scale = 1.0;//设置比例 18 DrawingInfo.units = UF_PART_METRIC;//设置单位 19 DrawingInfo.projection_angle = UF_DRAW_FIRST_ANGLE_PROJECTION;//设置投影视角 20 tag_t DrawingTag = NULL_TAG; 21 UF_DRAW_create_drawing(DrawingName, &DrawingInfo, &DrawingTag); 22 23 //新建工程图(自定义大小) 24 char* DrawingName1 = "EDF";//设置图纸名字 25 UF_DRAW_info_t DrawingInfo1;//设置图纸大小、投影视角、视图比例等 26 DrawingInfo1.size_state = UF_DRAW_CUSTOM_SIZE;//设置图纸类型 27 DrawingInfo1.size.custom_size[0] = 300;//设置图纸高度 28 DrawingInfo1.size.custom_size[1] = 300;//设置图纸长度 29 DrawingInfo1.drawing_scale = 1.0;//设置比例 30 DrawingInfo1.units = UF_PART_METRIC;//设置单位 31 DrawingInfo1.projection_angle = UF_DRAW_FIRST_ANGLE_PROJECTION;//设置投影视角 32 tag_t DrawingTag1 = NULL_TAG; 33 UF_DRAW_create_drawing(DrawingName1, &DrawingInfo1, &DrawingTag1); 34 35 //打开工程图 36 UF_DRAW_open_drawing(DrawingTag1); 37 38 //重命名工程图 39 UF_DRAW_rename_drawing(DrawingTag1, "LSY"); 40 41 //删除工程图 42 //UF_DRAW_delete_drawing(DrawingTag); 43 44 //获取工程图的数量和tag 45 int NumDrawings = 0; 46 tag_p_t DrawingList = NULL_TAG; 47 UF_DRAW_ask_drawings(&NumDrawings, &DrawingList); 48 49 //打印 50 char msg[256]; 51 sprintf_s(msg, "当前工程图数量为:%d\n", NumDrawings); 52 UF_UI_open_listing_window(); 53 UF_UI_write_listing_window(msg); 54 55 for (int i = 0; i < NumDrawings; i++) 56 { 57 sprintf_s(msg,"每个Tag值为:%d\n", DrawingList[i]); 58 UF_UI_write_listing_window(msg); 59 } 60 61 UF_terminate();
标签:DRAW,DrawingInfo1,UFUN,工程图,设置,二次开发,UF,size 来源: https://www.cnblogs.com/nxopen2018/p/10957662.html