【NX二次开发】获取相邻面UF_MODL_ask_adjac_faces
获取箭头指示的面的相邻面
源码:
1 extern DllExport void ufsta(char *param, int *returnCode, int rlen) 2 { 3 UF_initialize(); 4 tag_t tagFace=47466; 5 uf_list_p_t adjacent_faces; 6 UF_MODL_ask_adjac_faces(tagFace, &adjacent_faces); //获得相邻面 7 int list_count = 0; 8 UF_MODL_ask_list_count(adjacent_faces, &list_count); 9 for (int i = 0; i < list_count; i++) 10 { 11 tag_t tFace = NULL_TAG; 12 UF_MODL_ask_list_item(adjacent_faces, i, &tFace); 13 UF_DISP_set_highlight(tFace, TRUE); 14 } 15 UF_MODL_delete_list(&adjacent_faces); 16 17 UF_terminate(); 18 } 19 20 extern int ufusr_ask_unload(void) 21 { 22 return (UF_UNLOAD_IMMEDIATELY); 23 }
不知道这个函数之前自己也可以封装一个函数使用:
1 int get_NeighborFaces(tag_t tagFace, vector<tag_t> *vecFaces) 2 { 3 vector<tag_t> vecAllFaces; 4 vector<tag_t> vecEdges; 5 //获取面的边【自定义函数】 6 get_face_edges(tagFace, 0, &vecEdges); 7 for (int i = 0; i < vecEdges.size(); i++) 8 { 9 vector<tag_t> vecTempFaces; 10 //获取边的面【自定义函数】 11 get_edge_faces(vecEdges[i], &vecTempFaces); 12 for (int j = 0; j < vecTempFaces.size(); j++) 13 { 14 15 vecAllFaces.push_back(vecTempFaces[j]); 16 } 17 } 18 //排序去重【自定义函数】 19 Setting_Order(vecAllFaces, vecFaces, 3); 20 21 for (vector<tag_t>::iterator itor = (*vecFaces).begin(); itor != (*vecFaces).end(); /*++itor*/) 22 { 23 if (*itor == tagFace) 24 { 25 itor = (*vecFaces).erase(itor); 26 } 27 else 28 { 29 ++itor; 30 } 31 } 32 return 0; 33 }