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 }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM