UFUN function UF_UI UF_PART function (UF_UI_select_with_class_dialog, UF_PART_export_with_options)

/ * The main demonstration
This function UF_PART_export_with_options
*/
1
//设置class_dialog选择过滤 2 static int init_proc(UF_UI_selection_p_t select,void* user_data) 3 { 4 int num_triples = 1; 5 //实体 片体 6 UF_UI_mask_t mask_triples[] = {UF_solid_type,0,0}; 7 /* enable only lines and edges */ 8 if((UF_UI_set_sel_mask(select,UF_UI_SEL_MASK_CLEAR_AND_ENABLE_SPECIFIC,num_triples, mask_triples)) == 0) 9 { 10 return (UF_UI_SEL_SUCCESS); 11 } 12 else 13 { 14 return (UF_UI_SEL_FAILURE); 15 } 16 } 17 extern DllExport void ufsta( char *param, int *returnCode, int rlen ) 18 { 19 /* Initialize the API environment */ 20 if( UF_CALL(UF_initialize()) ) 21 { 22 /* Failed to initialize */ 23 return; 24 } 25 26 /* TODO: Add your application code here */ 27 UF_initialize(); 28 29 //select_with_class_dialog 30 char message[]="类选择对话框"; 31 char title[]="按类选择:"; 32 int scope=UF_UI_SEL_SCOPE_ANY_IN_ASSEMBLY; 33 int response=0; 34 int count=0; 35 tag_t* objects=NULL; 36 //export_with_options 37 string part_name="G:\\look\\123.prt"; 38 tag_t*object_array=NULL; 39 UF_PART_export_options_t options; 40 //多选对话框 41 UF_UI_select_with_class_dialog (message,title,scope,init_proc,NULL,&response,&count,&objects); 42 //分配内存 43 object_array=(tag_t*)malloc(sizeof(tag_t)*count); 44 if (response == UF_UI_OK && count > 0) 45 { 46 is for ( int I = 0 ; I <COUNT; I ++ ) 47 { 48 object_array [I] = Objects [I]; 49 UF_DISP_set_highlight (Objects [I], 0 ); 50 } 51 is 52 is } 53 is // new member 54 is options.new_part = to true ; 55 // remove parameter 56 is options.params_mode = UF_PART_remove_params; 57 is // copy expression 58 options.expression_mode =UF_PART_copy_exp_deeply; 59 //导出部件 60 UF_PART_export_with_options (part_name.c_str(),count,object_array,&options); 61 //释放内存 62 free(object_array); 63 UF_free(objects); 64 65 UF_terminate(); 66 67 /* Terminate the API environment */ 68 UF_CALL(UF_terminate()); 69 }

Guess you like

Origin www.cnblogs.com/zzyfym/p/12076374.html