1 //此函数的功能是判断能否接受并且创建组 2 static void judgment_create_group(tag_t *group_root,tag_t *group_tag) 3 { 4 logical answer=false; 5 char reason[UF_NCGROUP_MAX_REASON_LEN+1]; 6 UF_NCGROUP_can_accept_member(*group_root,*group_tag,&answer,reason); 7 if (answer==true) 8 { 9 UF_NCGROUP_accept_member(*group_root,*group_tag); 10 UF_UI_ONT_refresh(); 11 } 12 else 13 { 14 uc1601("不能创建!",1); 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 tag_t setup_tag=NULL_TAG; 30 31 tag_t geom_root=NULL_TAG; 32 tag_t mthd_root=NULL_TAG; 33 tag_t prog_root=NULL_TAG; 34 35 char *prog_type_name="mill_planar"; 36 char *prog_subtype_name="PROGRAM"; 37 tag_t prog_tag=NULL_TAG; 38 39 char *geom_type_name="mill_planar"; 40 char *geom_subtype_name="MCS"; 41 tag_t geom_tag=NULL_TAG; 42 43 char *mthd_type_name="mill_planar"; 44 char *mthd_subtype_name="MILL_METHOD"; 45 tag_t mthd_tag=NULL_TAG; 46 47 char *oper_type_name="mill_planar"; 48 char *oper_subtype_name="planar_mill"; 49 tag_t oper_tag=NULL_TAG; 50 51 UF_SETUP_ask_setup(&setup_tag); 52 //几何体的根 53 UF_SETUP_ask_geom_root(setup_tag,&geom_root); 54 //方法的根 55 UF_SETUP_ask_mthd_root(setup_tag,&mthd_root); 56 //程序组的根 57 UF_SETUP_ask_program_root(setup_tag,&prog_root); 58 //程序组 59 UF_NCPROG_create(prog_type_name,prog_subtype_name,&prog_tag); 60 //坐标系组 61 UF_NCGEOM_create(geom_type_name,geom_subtype_name,&geom_tag); 62 //方法工艺组 63 UF_NCMTHD_create(mthd_type_name,mthd_subtype_name,&mthd_tag); 64 //创建程序 65 UF_OPER_create(oper_type_name,oper_subtype_name,&oper_tag); 66 67 //以下是创建组 68 judgment_create_group(&prog_root,&prog_tag); 69 judgment_create_group(&geom_root,&geom_tag); 70 judgment_create_group(&mthd_root,&mthd_tag); 71 //以下是将程序放入组中 72 judgment_create_group(&prog_tag,&oper_tag); 73 judgment_create_group(&geom_tag,&oper_tag); 74 judgment_create_group(&mthd_tag,&oper_tag); 75 76 77 /* 78 79 注意: 创建程序组 方法组 几何组先去查你要创建组的名称 80 例如 : 81 mill_planar 中的创建程序组名称叫 PROGRAM 82 mill_planar 中的创建几何组名称叫 MCS 83 mill_planar 中的创建方法组名称叫 MILL_METHOD 84 */ 85 86 87 UF_terminate(); 88 /* Terminate the API environment */ 89 UF_CALL(UF_terminate()); 90 }