OPENC函数 UF_UI UF_DISP函数( UF_UI_select_with_class_dialog 、UF_DISP_set_highlight)

 1 //设置class_dialog选择过滤
 2 static int init_proc(UF_UI_selection_p_t select,void* user_data)
 3 {
 4     //过滤类别的个数
 5     int num_triples = 1;
 6     //曲线
 7     UF_UI_mask_t mask_triples[] = {UF_line_type,0,0};
 8 
 9     if((UF_UI_set_sel_mask(select,UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,num_triples, mask_triples)) == 0)
10     {
11         return (UF_UI_SEL_SUCCESS);
12     }
13     else
14     {
15         return (UF_UI_SEL_FAILURE);
16     }
17     /*
18         此处添加过滤可查看  uf_object_types.h  头文件
19     */
20 }
21 extern DllExport void ufsta( char *param, int *returnCode, int rlen )
22 {
23     /* Initialize the API environment */
24     if( UF_CALL(UF_initialize()) ) 
25     {
26         /* Failed to initialize */
27         return;
28     }
29     
30     /* TODO: Add your application code here */
31     UF_initialize();
32 
33     char message[]="类选择对话框";
34     char title[]="按类选择:";
35     //选择范围
36     int scope=UF_UI_SEL_SCOPE_ANY_IN_ASSEMBLY;
37     int response=0;
38     int count=0;
39     tag_t* objects=NULL;
40     UF_UI_select_with_class_dialog (message,title,scope,init_proc,NULL,&response,&count,&objects);
41     if (response == UF_UI_OK && count > 0)
42     {
43         UF_UI_open_listing_window();
44         for (int i=0; i<count; i++)
45         {
46             UF_DISP_set_highlight(objects[i], 0);
47             char msg[256];
48             sprintf_s(msg,"线的tag值:%d
",objects[i]);
49             UF_UI_write_listing_window(msg);
50         }
51         UF_free(objects);
52     }
53     UF_terminate();
54 
55     /* Terminate the API environment */
56     UF_CALL(UF_terminate());
57 }

原文地址:https://www.cnblogs.com/zzyfym/p/12076108.html