NX二次开发-UFUN单对象选择对话框UF_UI_select_with_single_dialog

 1 #include <uf.h>
 2 #include <uf_ui.h>
 3 
 4 
 5 static int select_filter_proc_fn(tag_t object, int type[3], void* user_data, UF_UI_selection_p_t select)
 6 {
 7     if (object == NULL)
 8     {
 9         return UF_UI_SEL_REJECT;
10     }
11     else
12     {
13         return UF_UI_SEL_ACCEPT;
14     }
15 }
16 
17 static int init_proc(UF_UI_selection_p_t select, void* user_data)
18 {
19     int num_triples = 3;//可选类型的数量
20     UF_UI_mask_t mask_triples[] = 
21     {UF_point_type, UF_point_subtype, UF_UI_SEL_NOT_A_FEATURE,
22      UF_line_type, UF_line_normal_subtype, UF_UI_SEL_NOT_A_FEATURE,
23      UF_solid_type, UF_solid_body_subtype, UF_UI_SEL_FEATURE_BODY
24     };//可选对象类型
25     UF_UI_set_sel_mask(select, UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC, num_triples, mask_triples);
26     if ((UF_UI_set_sel_procs(select, select_filter_proc_fn, NULL, user_data)) == 0)
27     {
28         return UF_UI_SEL_SUCCESS;
29     }
30     else
31     {
32         return UF_UI_SEL_FAILURE;
33     }
34 }
35 
36 
37 
38 
39 
40 
41 UF_initialize();
42 
43 //单对象选择对话框
44 char sCue[] = "单对象选择对话框";
45 char sTitle[] = "单对象选择对话框";
46 int iScope = UF_UI_SEL_SCOPE_NO_CHANGE;
47 int iResponse;
48 tag_t tObject;
49 tag_t tView;
50 double adCursor[3];
51 UF_UI_select_with_single_dialog(sCue, sTitle, iScope, init_proc, NULL, &iResponse, &tObject, adCursor, &tView);
52 
53 UF_terminate();
54 
55 Caesar卢尚宇
56 2019年7月1日

附加代码

 1 常用图纸视图类型
 2 static int init_proc(UF_UI_selection_p_t select, void* user_data)
 3 {
 4     int num_triples = 1;//可选类型的数量
 5     UF_UI_mask_t mask_triples[] =
 6     { UF_view_type, UF_UI_SEL_NOT_A_FEATURE };//图纸视图类型
 7     UF_UI_set_sel_mask(select, UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC, num_triples, mask_triples);
 8     if ((UF_UI_set_sel_procs(select, select_filter_proc_fn, NULL, user_data)) == 0)
 9     {
10         return UF_UI_SEL_SUCCESS;
11     }
12     else
13     {
14         return UF_UI_SEL_FAILURE;
15     }
16 }
原文地址:https://www.cnblogs.com/nxopen2018/p/11116342.html